infinigen

repository·main·Indexed 27 days ago

https://github.com/princeton-vl/infinigen

A procedural generation framework for creating infinite, photorealistic 3D worlds, including nature, indoor environments, and articulated simulation assets. The project provides tools for generating assets via Blender Nodes, managing large-scale data generation jobs via the infinigen.datagen.manage_jobs module, and creating terrain color palettes. It supports exporting to formats such as OBJ and OpenUSD, and includes a CLI (infinigen2) for scene generation and rendering.

Tokens
29.5K
Snippets
68
Records
161
Agent score
93%

What's inside infinigen

  1. Explore Infinigen Documentation

    main

    The project provides comprehensive documentation for various tasks, including:

    • Installation & Setup: Installation Guide, Configuring Infinigen
    • Generation Workflows: "Hello World" (Nature), "Hello Room" (Indoors), Generating individual assets
    • Configuration: Configuring Infinigen, Configuring Cameras
    • Data & Exporting: Downloading pre-generated data, Exporting to external fileformats (OBJ, OpenUSD, etc), Exporting to physics simulation
    • Advanced Customization: Add external assets to indoor scenes, Implementing new materials & assets, Generating fluid simulations, Extended ground-truth
  2. Explore Infinigen documentation and guides

    main
  3. Understand the Infinigen scene generation workflow

    main

    Infinigen uses two primary Python scripts to generate datasets:

    1. infinigen_examples/generate_nature.py: The scene composition script that invokes and places assets to create a realistic nature scene.
    2. manage_jobs.py: A job management script that invokes the composition script multiple times to generate a large dataset.

    Scene Tasks

    To complete a single scene, manage_jobs.py executes several tasks:

    • coarse: Generates coarse terrain shape, places placeholders for creatures/trees, and generates small instanced assets (twigs, particles, etc.).
    • populate: Replaces placeholders with unique, detailed assets (trees, creatures) based on the camera trajectory.
    • rendershort: Renders the scene using Blender's CYCLES renderer (usually 16 frames for video).
      • renderbackup: A retry step for rendershort with more RAM to handle high-cost scenes that might otherwise crash.
    • blender_gt or opengl_gt: (Optional via --pipeline_configs) Extracts ground truth labels for AI training.

    Output Structure

    Outputs are stored in outputs/MYJOB/SEED, where MYJOB is the name provided to --output_folder and SEED is the random seed used.

    Detailed logs can be found at:

    • outputs/MYJOB/SEED/logs/TASKNAME.log
    • outputs/MYJOB/SEED/logs/TASKNAME.err (Check these if jobs crash).
  4. Setup for Fluid Simulations

    main

    Fluid simulations (fire and water) require significant computational resources and an additional installation step.

    1. Compile FLIP Fluids: Run the following script to compile and install the flip fluids addon. This must be done after the initial Infinigen installation.
    2. Interactive Blender Requirement: To avoid Mantaflow errors when baking fire simulations in Headless Blender, you must use interactive Blender for fire simulations by running via python -m infinigen.launch_blender.
    bash scripts/install/compile_flip_fluids.sh
  5. Install and use Dancing Script fonts

    main

    Dancing Script is available as a variable font or as a set of static font files.

    Variable Font

    If your application supports variable fonts, use the single file containing the wght axis to access intermediate styles:

    • Dancing_Script/DancingScript-VariableFont_wght.ttf

    Static Fonts

    If your application does not support variable fonts, use the specific static files for standard styles:

    • Dancing_Script/static/DancingScript-Regular.ttf
    • Dancing_Script/static/DancingScript-Medium.ttf
    • Dancing_Script/static/DancingScript-SemiBold.ttf
    • Dancing_Script/static/DancingScript-Bold.ttf

    Installation Steps

    1. Install the desired font files onto your system.
    2. Use your application's font picker to select the Dancing Script family and the desired style.
  6. Enable dense room-mesh subdivision with OcMesher

    main

    By default, Infinigen-Indoors uses large polygons for walls, floors, and ceilings, which can result in inaccurate ground truth for surface normals and depth. To achieve fine mesh subdivision and material displacements, you must install OcMesher and use specific .gin configurations.

    Important Limitations:

    • Displacement: Material displacement is currently only valid for blender_gt extracted with Cycles. For OpenGL or non-Blender mesh exports, the mesh will be subdivided but will not have material displacements applied.
    • Object Assets: Most indoor object assets (e.g., cabinets, doors) do not support dense meshes reliably. If you require accurate material geometry for ground truth, set set_displacement_mode.displacement_mode = "NONE" for these objects.

    Installation and Usage:

    1. Clone and install OcMesher:
    # install terrain
    git clone https://github.com/princeton-vl/OcMesher.git src/infinigen/OcMesher
    pip install -e .[terrain]
    1. Run the generation command using real_geometry_with_bump.gin (for fine mesh + displacements) or real_geometry.gin (for subdivided mesh without displacement).
    # install terrain
    git clone https://github.com/princeton-vl/OcMesher.git src/infinigen/OcMesher
    pip install -e .[terrain]
    
    python -m infinigen_examples.generate_indoors -- --output_folder outputs/indoors/coarse --seed 0 --task coarse -g forest singleroom real_geometry_with_bump -p compose_indoors.terrain_enabled=True restrict_solving.restrict_parent_rooms=\["DiningRoom"\] compose_indoors.solve_small_enabled=False
  7. Install Infinigen 2.0

    main

    Infinigen 2.0 is currently in alpha. It is recommended to use uv for installation and to pin a specific version to avoid breaking changes in the evolving API.

    First, install uv if you haven't already: curl -LsSf https://astral.sh/uv/install.sh | sh

    Then, install the pre-release version of Infinigen via PyPI:

    uv pip install "infinigen==2.0.0a1"

    Or, if you are working within a project:

    uv add "infinigen==2.0.0a1"
  8. Use Open Sans Variable or Static fonts

    main

    The Open Sans asset package provides two ways to use the font depending on your application's support for variable fonts:

    1. Variable Fonts

    If your application supports variable fonts, use the files in the root directory. These files contain multiple styles controlled by the wdth (width) and wght (weight) axes, allowing you to select intermediate styles.

    • Open_Sans/OpenSans-VariableFont_wdth,wght.ttf
    • Open_Sans/OpenSans-Italic-VariableFont_wdth,wght.ttf

    2. Static Fonts

    If your application does not support variable fonts, use the individual static files located in the static/ directory. These files represent specific, fixed styles (e.g., Open_Sans/static/OpenSans-Bold.ttf).

  9. Generate scenes in one command using manage_jobs

    main

    To automate the entire pipeline (layout, population, and rendering) in a single execution, use the infinigen.datagen.manage_jobs utility. This is the recommended way to generate multiple scenes efficiently.

    Full logs for each task can be found in the logs subdirectory within the specific scene's output folder.

    python -m infinigen.datagen.manage_jobs --output_folder outputs/hello_world --num_scenes 1 --specific_seed 0 \
    --configs desert.gin simple.gin --pipeline_configs local_16GB.gin monocular.gin blender_gt.gin --pipeline_overrides LocalScheduleHandler.use_gpu=False