SceneSmith

repository·main·Indexed 19 days ago

https://github.com/nepfaff/scenesmith

A system for the agentic, fully automated generation of simulation-ready indoor scenes from text prompts. SceneSmith generates separable 3D objects with estimated physical properties for use in physics simulators. It supports multiple asset generation backends including SAM3D and Hunyuan3D-2, as well as asset retrieval from HSSD, Objaverse, PartNet-Mobility, and ArtVIP datasets. The pipeline consists of five sequential stages: floor_plan, furniture, wall_mounted, ceiling_mounted, and manipuland.

Tokens
13.4K
Snippets
45
Records
58
Agent score
65%

What's inside SceneSmith

  1. Run the Robot Evaluation pipeline

    main

    The robot evaluation module automates the process of converting human tasks into generated scenes and validating robot task completion. The pipeline consists of four stages:

    1. Generate Prompts: Converts a human task (e.g., "Find a fruit") into diverse scene prompts using an LLM.
    2. Generate Scenes: Runs the standard SceneSmith pipeline using the generated prompts.
    3. Policy Interface (Optional): Converts scene states into robot-executable poses (target/reference bindings). This is useful for model-based policies.
    4. Validate: A VLM agent compares the robot's final output poses against the original scene metadata to verify success.

    Robot Policy Contract: The robot must receive the initial scene.dmd.yaml, perform the task, and output a modified scene.dmd.yaml containing the updated object poses.

  2. Compare Hunyuan3D and SAM3D backends

    main

    Choose a backend based on your requirements for quality, speed, and available hardware:

    FeatureHunyuan3DSAM3D
    QualityGoodHigher
    SpeedFasterSlower
    GPU Memory~24GB~32GB
    TexturesBasicUV-mapped
    Best forDevelopmentProduction
    • Hunyuan3D: Diffusion-based image-to-3D. Faster and lower memory footprint.
    • SAM3D: Segmentation + Gaussian splatting reconstruction. Higher quality and UV-mapped textures, but slower and requires more VRAM.
  3. Set up AmbientCG PBR materials

    main

    To enable PBR material retrieval for scene rendering:

    1. Download materials:
      python scripts/download_ambientcg.py --output data/materials
      Options: -r <res> (e.g., 2K), -f <format> (e.g., PNG), --limit <n>, or --dry-run.
    2. Download pre-computed CLIP embeddings (Recommended):
      huggingface-cli download nepfaff/scenesmith-preprocessed-data \
       --repo-type dataset \
       --include "ambientcg/embeddings/**" \
       --local-dir data/scenesmith-preprocessed-data
      mv data/scenesmith-preprocessed-data/ambientcg/embeddings data/materials/embeddings
      rm -rf data/scenesmith-preprocessed-data
       *Alternatively, compute them yourself:* `python scripts/compute_ambientcg_embeddings.py --materials-dir data/materials`.
    
  4. Set up the Objaverse (ObjectThor) asset retrieval

    main

    Objaverse (via ObjectThor) provides asset retrieval using GLB meshes and pre-computed CLIP features.

    1. Download data (~50GB):
      bash scripts/download_objaverse_data.sh
    2. Preprocess for retrieval to create embeddings and metadata:
      python scripts/prepare_objaverse.py
    3. Enable Objaverse in your experiment configuration:
      asset_manager:
        general_asset_source: "objaverse"
    # In your experiment config file
    asset_manager:
      general_asset_source: "objaverse"  # Use Objaverse retrieval
  5. Run the Geometry Generation Server in Standalone Mode

    main

    You can run the server as an independent microservice or for testing/debugging using the standalone_server module. By default, it uses the Hunyuan3D backend. To use the SAM3D backend, you must provide the required checkpoint paths via CLI flags.

    # Hunyuan3D backend (default)
    python -m scenesmith.agent_utils.geometry_generation_server.standalone_server
    
    # SAM3D backend
    python -m scenesmith.agent_utils.geometry_generation_server.standalone_server \
      --backend sam3d \
      --sam3-checkpoint external/checkpoints/sam3.pt \
      --sam3d-checkpoint external/checkpoints/pipeline.yaml
  6. Set up the HSSD asset retrieval dataset

    main

    HSSD (Hugging Face Semantic 3D) is an alternative asset source that uses an object library instead of generative 3D models. To use it:

    1. Accept the license at https://huggingface.co/datasets/hssd/hssd-models.
    2. Download HSSD models (~72GB) using Git LFS into the data directory:
      cd data
      git lfs install
      git clone git@hf.co:datasets/hssd/hssd-models
    3. Download preprocessed data (~2GB) for CLIP indices and support surfaces:
      bash scripts/download_hssd_data.sh
      Manual fallback: Use wget to download data.zip (CLIP indices) and support-surfaces.zip (support surfaces) and unzip them into data/preprocessed and data/hssd-models respectively.
    4. Enable HSSD in your experiment configuration:
      asset_manager:
        strategy: "hssd"
    # In your experiment config file
    asset_manager:
      strategy: "hssd"  # Use HSSD retrieval instead of generation
  7. Set up ArtVIP articulated object datasets

    main

    ArtVIP provides preprocessed assets (Drake SDFormat with collision geometries and CLIP embeddings). It is the recommended articulated source.

    Option 1: Download preprocessed VHACD variant (Recommended)

    huggingface-cli download nepfaff/scenesmith-preprocessed-data \
        artvip/artvip_vhacd.tar.gz --repo-type dataset --local-dir .
    mkdir -p data/artvip_sdf
    tar xzf artvip/artvip_vhacd.tar.gz -C data/artvip_sdf
    rm -rf artvip

    Option 2: Download CoACD variant (Faster simulation)

    huggingface-cli download nepfaff/scenesmith-preprocessed-data \
        artvip/artvip_coacd.tar.gz --repo-type dataset --local-dir .
    mkdir -p data/artvip_sdf
    tar xzf artvip/artvip_coacd.tar.gz -C data/artvip_sdf
    rm -rf artvip

    Option 3: Manual preprocessing If you have custom USD assets, use mesh-to-sim-asset to convert to Drake SDFormat, then run:

    python scripts/compute_articulated_embeddings.py \
        --source artvip \
        --data-path data/artvip_sdf \
        --output-path data/artvip_sdf/embeddings
  8. Run project tests

    main

    Use pytest to run unit or integration tests. The --testmon flag enables test monitoring/caching. Use -x to stop on the first failure.

    # Run unit tests
    pytest tests/unit/ --testmon
    
    # Run integration tests
    pytest tests/integration/ --testmon
    
    # Run all tests
    pytest tests/ --testmon
  9. Visualize intermediate and portable house scenes

    main

    SceneSmith generates intermediate scene states as scene.dmd.yaml files within scene_renders/ directories. You can inspect these using Drake's model visualizer to check object placement, collisions, and joints.

    For final combined house scenes, SceneSmith uses package://scene/ URIs for portability. To view these, you must set the ROS_PACKAGE_PATH to the scene directory so Drake can resolve the package names via the package.xml file found in the scene directory.

    To load scenes programmatically in Python, use the Drake Parser to add the scene directory to the package map.

    # View an intermediate scene
    python -m pydrake.visualization.model_visualizer \
        outputs/YYYY-MM-DD/HH-MM-SS/scene_000/room_*/scene_renders/furniture/renders_001/scene.dmd.yaml
    
    # View a portable house scene
    export ROS_PACKAGE_PATH=/path/to/outputs/YYYY-MM-DD/HH-MM-SS/scene_000:$ROS_PACKAGE_PATH
    python -m pydrake.visualization.model_visualizer \
        outputs/YYYY-MM-DD/HH-MM-SS/scene_000/combined_house_after_furniture/house.dmd.yaml
    from pydrake.multibody.parsing import Parser
    
    parser = Parser(plant)
    parser.package_map().Add("scene", "/path/to/scene_000")
  10. Install SceneSmith locally using uv

    main

    SceneSmith uses uv for dependency management. Follow these steps to set up a local development environment:

    1. Install uv:
      curl -LsSf https://astral.sh/uv/install.sh | sh
    2. Sync dependencies (creates .venv):
      uv sync
      To exclude development tools (like pytest), use uv sync --no-dev.
    3. Activate the environment:
      source .venv/bin/activate
    4. Install pre-commit hooks:
      pre-commit install

    Note: Installation is not complete after these steps. You must still configure asset generation backends (SAM3D or Hunyuan3D-2), articulated object datasets, and PBR materials.

    curl -LsSf https://astral.sh/uv/install.sh | sh
    uv sync
    source .venv/bin/activate
    pre-commit install
  11. Control and resume pipeline stages

    main

    The scene generation pipeline consists of five sequential stages:

    1. floor_plan (walls, floor)
    2. furniture (furniture placement)
    3. wall_mounted (mirrors, artwork, etc.)
    4. ceiling_mounted (lights, fans, etc.)
    5. manipuland (small objects on surfaces)

    Stage Control: Use experiment.pipeline.stop_stage to halt the pipeline after a specific stage, or experiment.pipeline.start_stage to skip early stages and resume from a later one.

    Resuming from a checkpoint: The pipeline saves state after every stage (e.g., house_layout.json, scene_states/scene_after_furniture/). When you set a start_stage, the pipeline automatically loads the state from the previous stage.

    # Stop after furniture stage
    python main.py +name=my_experiment experiment.pipeline.stop_stage=furniture
    
    # Resume starting from the manipuland stage
    python main.py +name=my_experiment experiment.pipeline.start_stage=manipuland