├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── data_scripts
├── analyze.py
├── analyze_all.py
├── code_formatter.py
├── copy_subset_llm.py
├── curation.py
├── default_ranges.json
├── filter_all.py
├── gen_programs_llm_async.py
├── package_data.py
├── param_stats.py
├── render.py
├── sample_params.py
├── sample_params_all.py
├── ssim.py
├── transpile.py
└── utils.py
├── environment.yml
├── infinigen
├── .github
│ └── ISSUE_TEMPLATE
│ │ ├── bug-report.md
│ │ └── request.md
├── .gitignore
├── .gitmodules
├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
├── __init__.py
├── docs
│ ├── CHANGELOG.md
│ ├── ConfiguringInfinigen.md
│ ├── GeneratingFluidSimulations.md
│ ├── GeneratingIndividualAssets.md
│ ├── GroundTruthAnnotations.md
│ ├── HelloWorld.md
│ ├── ImplementingAssets.md
│ ├── Installation.md
│ └── images
│ │ ├── gt_annotations
│ │ ├── Depth_0001_00_00.png
│ │ ├── OcclusionBoundaries_0001_00_00.png
│ │ ├── SurfaceNormal_0001_00_00.png
│ │ ├── blender_rock_2d.png
│ │ ├── blender_rock_3d.png
│ │ ├── caves.png
│ │ ├── petal.png
│ │ └── warped_rocks.png
│ │ ├── hello_world
│ │ ├── Depth0048_00_00.png
│ │ ├── Image0048_00_00.png
│ │ ├── InstanceSegmentation_0001_00_00.png
│ │ └── SurfaceNormal_0001_00_00.png
│ │ ├── implementing_assets
│ │ ├── setting_up_blender_ui_1.png
│ │ ├── setting_up_blender_ui_2.png
│ │ ├── setting_up_blender_ui_grassdemo.png
│ │ ├── snow_demo.png
│ │ └── transpiler_demo.png
│ │ ├── individual_assets
│ │ ├── chunkyrock.png
│ │ ├── coral.png
│ │ └── seashells.png
│ │ └── video_thumbnail.png
├── install.sh
├── process_mesh
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── blender_object.cpp
│ ├── blender_object.hpp
│ ├── buffer_arrays.cpp
│ ├── buffer_arrays.hpp
│ ├── camera_view.cpp
│ ├── camera_view.hpp
│ ├── dependencies
│ │ ├── glad
│ │ │ ├── include
│ │ │ │ ├── EGL
│ │ │ │ │ └── eglplatform.h
│ │ │ │ ├── KHR
│ │ │ │ │ └── khrplatform.h
│ │ │ │ └── glad
│ │ │ │ │ ├── glad.h
│ │ │ │ │ └── glad_egl.h
│ │ │ └── src
│ │ │ │ ├── glad.c
│ │ │ │ └── glad_egl.c
│ │ └── scharstein_flow_viz
│ │ │ ├── README.txt
│ │ │ ├── colorcode.cpp
│ │ │ └── colorcode.h
│ ├── glsl
│ │ ├── hair.frag
│ │ ├── hair.geom
│ │ ├── hair.vert
│ │ ├── next_wings.vert
│ │ ├── spine.frag
│ │ ├── spine.geom
│ │ ├── wings.frag
│ │ ├── wings.geom
│ │ └── wings.vert
│ ├── io.cpp
│ ├── io.hpp
│ ├── load_blender_mesh.cpp
│ ├── load_blender_mesh.hpp
│ ├── main.cpp
│ ├── shader.cpp
│ ├── shader.hpp
│ ├── show.py
│ ├── string_tools.cpp
│ ├── string_tools.hpp
│ ├── utils.cpp
│ └── utils.hpp
├── requirements.txt
└── worldgen
│ ├── __init__.py
│ ├── asset_demo.py
│ ├── assets
│ ├── __init__.py
│ ├── blender_rock.py
│ ├── boulder.py
│ ├── cactus
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── columnar.py
│ │ ├── generate.py
│ │ ├── globular.py
│ │ ├── kalidium.py
│ │ ├── pricky_pear.py
│ │ └── spike.py
│ ├── caustics_lamp.py
│ ├── cloud
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── cloud.py
│ │ ├── generate.py
│ │ └── node.py
│ ├── corals
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── diff_growth.py
│ │ ├── elkhorn.py
│ │ ├── fan.py
│ │ ├── generate.py
│ │ ├── laplacian.py
│ │ ├── reaction_diffusion.py
│ │ ├── star.py
│ │ ├── tentacles.py
│ │ ├── tree.py
│ │ └── tube.py
│ ├── creatures
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── animation
│ │ │ ├── curve_slither.py
│ │ │ ├── driver_repeated.py
│ │ │ ├── driver_wiggle.py
│ │ │ ├── idle.py
│ │ │ └── run_cycle.py
│ │ ├── boid_swarm.py
│ │ ├── cloth_sim.py
│ │ ├── creature.py
│ │ ├── creature_util.py
│ │ ├── generate.py
│ │ ├── genome.py
│ │ ├── genomes
│ │ │ ├── beetle.py
│ │ │ ├── bird.py
│ │ │ ├── carnivore.py
│ │ │ ├── crustacean.py
│ │ │ ├── fish.py
│ │ │ ├── herbivore.py
│ │ │ ├── nurbs
│ │ │ │ ├── body_bird_duck.npy
│ │ │ │ ├── body_bird_gull.npy
│ │ │ │ ├── body_bird_robin.npy
│ │ │ │ ├── body_feline_cheetah.npy
│ │ │ │ ├── body_feline_housecat.npy
│ │ │ │ ├── body_feline_tiger.npy
│ │ │ │ ├── body_feline_tiger_2.npy
│ │ │ │ ├── body_feline_wolf.npy
│ │ │ │ ├── body_fish_bluefish.npy
│ │ │ │ ├── body_fish_crappie.npy
│ │ │ │ ├── body_fish_eel.npy
│ │ │ │ ├── body_fish_pickerel.npy
│ │ │ │ ├── body_fish_pufferfish.npy
│ │ │ │ ├── body_fish_spadefish.npy
│ │ │ │ ├── body_herbivore_cow.npy
│ │ │ │ ├── body_herbivore_giraffe.npy
│ │ │ │ ├── body_herbivore_goat.npy
│ │ │ │ ├── body_herbivore_llama.npy
│ │ │ │ ├── body_insect_bee.npy
│ │ │ │ ├── body_insect_beetle.npy
│ │ │ │ ├── body_insect_tarantula.npy
│ │ │ │ ├── body_llama.npy
│ │ │ │ ├── head_carnivore_tiger.npy
│ │ │ │ ├── head_carnivore_wolf.npy
│ │ │ │ ├── head_herbivore_cow.npy
│ │ │ │ ├── head_herbivore_giraffe.npy
│ │ │ │ ├── head_herbivore_goat.npy
│ │ │ │ ├── head_herbivore_llama.npy
│ │ │ │ ├── head_insect_beetle.npy
│ │ │ │ └── head_insect_wasp.npy
│ │ │ └── reptile.py
│ │ ├── geometry
│ │ │ ├── __init__.py
│ │ │ ├── blending.py
│ │ │ ├── cpp_utils
│ │ │ │ ├── .gitignore
│ │ │ │ ├── bnurbs.pyx
│ │ │ │ ├── setup_linux.py
│ │ │ │ ├── setup_macos.py
│ │ │ │ └── setup_macos_as.py
│ │ │ ├── curve.py
│ │ │ ├── lofting.py
│ │ │ ├── metaballs.py
│ │ │ ├── nurbs.py
│ │ │ └── skin_ops.py
│ │ ├── hair.py
│ │ ├── nodegroups
│ │ │ ├── __init__.py
│ │ │ ├── attach.py
│ │ │ ├── curve.py
│ │ │ ├── geometry.py
│ │ │ ├── hair.py
│ │ │ ├── math.py
│ │ │ ├── sculpt_v1.py
│ │ │ └── shader.py
│ │ ├── parts
│ │ │ ├── __init__.py
│ │ │ ├── beak.py
│ │ │ ├── body.py
│ │ │ ├── chameleon.py
│ │ │ ├── crustacean
│ │ │ │ ├── __init__.py
│ │ │ │ ├── antenna.py
│ │ │ │ ├── body.py
│ │ │ │ ├── claw.py
│ │ │ │ ├── eye.py
│ │ │ │ ├── fin.py
│ │ │ │ ├── leg.py
│ │ │ │ └── tail.py
│ │ │ ├── eye.py
│ │ │ ├── eye_new.py
│ │ │ ├── fin_old.py
│ │ │ ├── foot.py
│ │ │ ├── generic_nurbs.py
│ │ │ ├── head.py
│ │ │ ├── head_detail.py
│ │ │ ├── hoof.py
│ │ │ ├── horn.py
│ │ │ ├── leg.py
│ │ │ ├── reptile_detail.py
│ │ │ ├── ridged_fin.py
│ │ │ ├── tail.py
│ │ │ ├── utils
│ │ │ │ └── draw.py
│ │ │ └── wings.py
│ │ ├── rigging.py
│ │ ├── tools
│ │ │ └── dev_script_save_nurbs_handles.py
│ │ └── util
│ │ │ ├── __init__.py
│ │ │ ├── creature_parser.py
│ │ │ ├── geonode_part.py
│ │ │ ├── join_smoothing.py
│ │ │ ├── part_util.py
│ │ │ └── tree.py
│ ├── deformed_trees
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── fallen.py
│ │ ├── generate.py
│ │ ├── hollow.py
│ │ ├── rotten.py
│ │ └── truncated.py
│ ├── flower.py
│ ├── fruits
│ │ ├── __init__.py
│ │ ├── apple.py
│ │ ├── blackberry.py
│ │ ├── coconutgreen.py
│ │ ├── coconuthairy.py
│ │ ├── compositional_fruit.py
│ │ ├── cross_section_lib.py
│ │ ├── durian.py
│ │ ├── fruit_utils.py
│ │ ├── general_fruit.py
│ │ ├── pineapple.py
│ │ ├── seed_lib.py
│ │ ├── starfruit.py
│ │ ├── stem_lib.py
│ │ ├── strawberry.py
│ │ └── surfaces
│ │ │ ├── apple_surface.py
│ │ │ ├── blackberry_surface.py
│ │ │ ├── coconutgreen_surface.py
│ │ │ ├── coconuthairy_surface.py
│ │ │ ├── durian_surface.py
│ │ │ ├── pineapple_surface.py
│ │ │ ├── starfruit_surface.py
│ │ │ ├── strawberry_surface.py
│ │ │ └── surface_utils.py
│ ├── glowing_rocks.py
│ ├── grassland
│ │ ├── __init__.py
│ │ ├── dandelion.py
│ │ ├── flowerplant.py
│ │ └── grass_tuft.py
│ ├── insects
│ │ ├── assembled
│ │ │ └── dragonfly.py
│ │ ├── parts
│ │ │ ├── antenna
│ │ │ │ └── dragonfly_antenna.py
│ │ │ ├── body
│ │ │ │ └── dragonfly_body.py
│ │ │ ├── eye
│ │ │ │ └── dragonfly_eye.py
│ │ │ ├── hair
│ │ │ │ └── principled_hair.py
│ │ │ ├── head
│ │ │ │ └── dragonfly_head.py
│ │ │ ├── leg
│ │ │ │ └── dragonfly_leg.py
│ │ │ ├── mouth
│ │ │ │ └── dragonfly_mouth.py
│ │ │ ├── tail
│ │ │ │ └── dragonfly_tail.py
│ │ │ └── wing
│ │ │ │ └── dragonfly_wing.py
│ │ └── utils
│ │ │ ├── geom_utils.py
│ │ │ └── shader_utils.py
│ ├── jellyfish.py
│ ├── leaves
│ │ ├── __init__.py
│ │ ├── leaf.py
│ │ ├── leaf_broadleaf.py
│ │ ├── leaf_ginko.py
│ │ ├── leaf_maple.py
│ │ ├── leaf_pine.py
│ │ ├── leaf_v2.py
│ │ └── leaf_wrapped.py
│ ├── mollusk
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── generate.py
│ │ ├── shell.py
│ │ └── snail.py
│ ├── monocot
│ │ ├── __init__.py
│ │ ├── agave.py
│ │ ├── banana.py
│ │ ├── generate.py
│ │ ├── grasses.py
│ │ ├── growth.py
│ │ ├── kelp.py
│ │ ├── pinecone.py
│ │ ├── tussock.py
│ │ └── veratrum.py
│ ├── mushroom
│ │ ├── __init__.py
│ │ ├── cap.py
│ │ ├── generate.py
│ │ ├── growth.py
│ │ └── stem.py
│ ├── particles.py
│ ├── pile.py
│ ├── seaweed.py
│ ├── small_plants
│ │ ├── __init__.py
│ │ ├── fern.py
│ │ ├── leaf_general.py
│ │ ├── leaf_heart.py
│ │ ├── num_leaf_grass.py
│ │ ├── snake_plant.py
│ │ ├── spider_plant.py
│ │ └── succulent.py
│ ├── trees
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── branch.py
│ │ ├── generate.py
│ │ ├── tree.py
│ │ ├── tree_flower.py
│ │ ├── treeconfigs.py
│ │ └── utils
│ │ │ ├── geometrynodes.py
│ │ │ ├── helper.py
│ │ │ ├── materials.py
│ │ │ └── mesh.py
│ ├── tropic_plants
│ │ ├── __init__.py
│ │ ├── coconut_tree.py
│ │ ├── leaf_banana_tree.py
│ │ ├── leaf_palm_plant.py
│ │ ├── leaf_palm_tree.py
│ │ ├── palm_tree.py
│ │ └── tropic_plant_utils.py
│ ├── urchin.py
│ └── utils
│ │ ├── __init__.py
│ │ ├── decorate.py
│ │ ├── draw.py
│ │ ├── laplacian.py
│ │ ├── mesh.py
│ │ ├── misc.py
│ │ ├── nodegroup.py
│ │ ├── object.py
│ │ ├── physics.py
│ │ ├── reaction_diffusion.py
│ │ ├── shortest_path.py
│ │ └── tag.py
│ ├── config
│ ├── .gitignore
│ ├── asset_demo.gin
│ ├── base.gin
│ ├── base_surface_registry.gin
│ ├── disable_assets
│ │ ├── no_assets.gin
│ │ ├── no_creatures.gin
│ │ ├── no_particles.gin
│ │ └── no_rocks.gin
│ ├── experimental.gin
│ ├── monocular.gin
│ ├── natural.gin
│ ├── palette
│ │ ├── desert.json
│ │ ├── mountain soil.json
│ │ ├── sandstone.json
│ │ └── water.json
│ ├── performance
│ │ ├── dev.gin
│ │ ├── fast_terrain_assets.gin
│ │ ├── high_quality_terrain.gin
│ │ ├── reuse_terrain_assets.gin
│ │ └── simple.gin
│ ├── scene_types
│ │ ├── arctic.gin
│ │ ├── canyon.gin
│ │ ├── cave.gin
│ │ ├── cliff.gin
│ │ ├── coast.gin
│ │ ├── coral_reef.gin
│ │ ├── desert.gin
│ │ ├── forest.gin
│ │ ├── kelp_forest.gin
│ │ ├── mountain.gin
│ │ ├── plain.gin
│ │ ├── river.gin
│ │ ├── snowy_mountain.gin
│ │ └── under_water.gin
│ ├── scene_types_fluidsim
│ │ ├── simulated_river.gin
│ │ └── tilted_river.gin
│ ├── stereo_training.gin
│ ├── use_cached_fire.gin
│ └── use_on_the_fly_fire.gin
│ ├── core.py
│ ├── fluid
│ ├── __init__.py
│ ├── asset_cache.py
│ ├── bounding_box.py
│ ├── cached_factory_wrappers.py
│ ├── duplication_geomod.py
│ ├── flip_fluid.py
│ ├── flip_init.py
│ ├── fluid.py
│ ├── fluid_scenecomp_additions.py
│ ├── generate.py
│ ├── liquid_particle_material.py
│ ├── run_asset_cache.py
│ ├── run_tests.py
│ └── unit_tests.py
│ ├── generate.py
│ ├── lighting
│ ├── __init__.py
│ ├── kole_clouds.py
│ └── lighting.py
│ ├── nodes
│ ├── __init__.py
│ ├── color.py
│ ├── node_info.py
│ ├── node_transpiler
│ │ ├── changelog.md
│ │ ├── transpiler.py
│ │ ├── transpiler_blender.py
│ │ └── transpiler_dev_script.py
│ ├── node_utils.py
│ ├── node_wrangler.py
│ └── nodegroups
│ │ ├── __init__.py
│ │ └── transfer_attributes.py
│ ├── placement
│ ├── animation_policy.py
│ ├── camera.py
│ ├── density.py
│ ├── detail.py
│ ├── factory.py
│ ├── instance_scatter.py
│ ├── particles.py
│ ├── placement.py
│ └── split_in_view.py
│ ├── rendering
│ ├── __init__.py
│ ├── auto_exposure.py
│ ├── post_render.py
│ ├── render.py
│ └── resample.py
│ ├── surfaces
│ ├── __init__.py
│ ├── dev_script.py
│ ├── scatters
│ │ ├── __init__.py
│ │ ├── chopped_trees.py
│ │ ├── coral_reef.py
│ │ ├── decorative_plants.py
│ │ ├── fern.py
│ │ ├── flowerplant.py
│ │ ├── grass.py
│ │ ├── ground_leaves.py
│ │ ├── ground_mushroom.py
│ │ ├── ground_twigs.py
│ │ ├── ivy.py
│ │ ├── jellyfish.py
│ │ ├── lichen.py
│ │ ├── mollusk.py
│ │ ├── monocot.py
│ │ ├── moss.py
│ │ ├── mushroom.py
│ │ ├── pine_needle.py
│ │ ├── pinecone.py
│ │ ├── rocks.py
│ │ ├── seashells.py
│ │ ├── seaweed.py
│ │ ├── slime_mold.py
│ │ ├── snow_layer.py
│ │ ├── urchin.py
│ │ └── utils
│ │ │ ├── __init__.py
│ │ │ ├── cluster.py
│ │ │ ├── selection.py
│ │ │ └── wind.py
│ ├── surface.py
│ ├── surface_mixing_dev_script.py
│ ├── surface_utils.py
│ └── templates
│ │ ├── __init__.py
│ │ ├── aluminumdisp2tut.py
│ │ ├── atmosphere_light_haze.py
│ │ ├── bark.py
│ │ ├── bark_birch.py
│ │ ├── bark_random.py
│ │ ├── basic_bsdf.py
│ │ ├── beak.py
│ │ ├── bird.py
│ │ ├── blackbody_shader.py
│ │ ├── bone.py
│ │ ├── chitin.py
│ │ ├── chunkyrock.py
│ │ ├── cobble_stone.py
│ │ ├── cracked_ground.py
│ │ ├── dirt.py
│ │ ├── eyeball.py
│ │ ├── face_size_visualizer.py
│ │ ├── fish_eye_shader.py
│ │ ├── fishbody.py
│ │ ├── fishfin.py
│ │ ├── giraffe_attr.py
│ │ ├── grass_blade_texture.py
│ │ ├── horn.py
│ │ ├── ice.py
│ │ ├── lava.py
│ │ ├── mountain.py
│ │ ├── mud.py
│ │ ├── new_whitewater.py
│ │ ├── nose.py
│ │ ├── reptile_brown_circle_attr.py
│ │ ├── reptile_gray_attr.py
│ │ ├── reptile_two_color_attr.py
│ │ ├── river_water.py
│ │ ├── sand.py
│ │ ├── sandstone.py
│ │ ├── scale.py
│ │ ├── simple_brownish.py
│ │ ├── simple_greenery.py
│ │ ├── simple_whitish.py
│ │ ├── slimy.py
│ │ ├── smoke_material.py
│ │ ├── snake_plant.py
│ │ ├── snake_scale.py
│ │ ├── snake_shaders.py
│ │ ├── snow.py
│ │ ├── soil.py
│ │ ├── spider_plant.py
│ │ ├── spot_sparse_attr.py
│ │ ├── stone.py
│ │ ├── succulent.py
│ │ ├── three_color_spots.py
│ │ ├── tiger_attr.py
│ │ ├── tongue.py
│ │ ├── two_color_spots.py
│ │ ├── twocolorz.py
│ │ ├── water.py
│ │ ├── waterfall_material.py
│ │ └── wood.py
│ ├── terrain
│ ├── .gitignore
│ ├── __init__.py
│ ├── assets
│ │ ├── caves
│ │ │ ├── __init__.py
│ │ │ ├── cfg.txt
│ │ │ ├── core.py
│ │ │ ├── geometry_utils.py
│ │ │ └── pcfg.py
│ │ ├── landtiles
│ │ │ ├── __init__.py
│ │ │ ├── ant_landscape.py
│ │ │ ├── core.py
│ │ │ └── custom.py
│ │ ├── ocean.py
│ │ └── upsidedown_mountains.py
│ ├── core.py
│ ├── elements
│ │ ├── atmosphere.py
│ │ ├── caves.py
│ │ ├── core.py
│ │ ├── ground.py
│ │ ├── landtiles.py
│ │ ├── mountains.py
│ │ ├── upsidedown_mountains.py
│ │ ├── voronoi_rocks.py
│ │ ├── warped_rocks.py
│ │ └── waterbody.py
│ ├── install_terrain.sh
│ ├── land_process
│ │ ├── erosion.py
│ │ └── snowfall.py
│ ├── marching_cubes
│ │ ├── .gitignore
│ │ └── _marching_cubes_lewiner_cy.pyx
│ ├── mesh_to_sdf
│ │ ├── LICENSE
│ │ ├── __init__.py
│ │ ├── pyrender_wrapper.py
│ │ ├── scan.py
│ │ ├── shaders
│ │ │ ├── mesh.frag
│ │ │ └── mesh.vert
│ │ ├── surface_point_cloud.py
│ │ └── utils.py
│ ├── mesher
│ │ ├── __init__.py
│ │ ├── _marching_cubes_lewiner.py
│ │ ├── _marching_cubes_lewiner_luts.py
│ │ ├── cube_spherical_mesher.py
│ │ ├── frontview_spherical_mesher.py
│ │ ├── spherical_mesher.py
│ │ └── uniform_mesher.py
│ ├── scene.py
│ ├── setup.py
│ ├── source
│ │ ├── common
│ │ │ ├── elements
│ │ │ │ ├── atmosphere.h
│ │ │ │ ├── caves.h
│ │ │ │ ├── ground.h
│ │ │ │ ├── landtiles.h
│ │ │ │ ├── mountains.h
│ │ │ │ ├── upsidedown_mountains.h
│ │ │ │ ├── voronoi_rocks.h
│ │ │ │ ├── warped_rocks.h
│ │ │ │ └── waterbody.h
│ │ │ ├── surfaces
│ │ │ │ ├── chunkyrock.h
│ │ │ │ ├── cobble_stone.h
│ │ │ │ ├── cracked_ground.h
│ │ │ │ ├── dirt.h
│ │ │ │ ├── ice.h
│ │ │ │ ├── mountain.h
│ │ │ │ ├── mud.h
│ │ │ │ ├── sand.h
│ │ │ │ ├── sandstone.h
│ │ │ │ ├── snow.h
│ │ │ │ ├── soil.h
│ │ │ │ └── stone.h
│ │ │ └── utils
│ │ │ │ ├── FastNoiseLite.h
│ │ │ │ ├── elements_util.h
│ │ │ │ ├── smooth_bool_ops.h
│ │ │ │ └── vectors.h
│ │ ├── cpu
│ │ │ ├── elements
│ │ │ │ ├── atmosphere.cpp
│ │ │ │ ├── core.cpp
│ │ │ │ ├── ground.cpp
│ │ │ │ ├── header.h
│ │ │ │ ├── landtiles.cpp
│ │ │ │ ├── mountains.cpp
│ │ │ │ ├── upsidedown_mountains.cpp
│ │ │ │ ├── voronoi_rocks.cpp
│ │ │ │ ├── warped_rocks.cpp
│ │ │ │ └── waterbody.cpp
│ │ │ ├── meshing
│ │ │ │ ├── cube_spherical_mesher.cpp
│ │ │ │ ├── frontview_spherical_mesher.cpp
│ │ │ │ ├── uniform_mesher.cpp
│ │ │ │ ├── utils.cpp
│ │ │ │ └── visibility_test.cpp
│ │ │ ├── soil_machine
│ │ │ │ ├── SoilMachine.cpp
│ │ │ │ ├── include
│ │ │ │ │ ├── FastNoiseLite.h
│ │ │ │ │ ├── distribution.h
│ │ │ │ │ └── vertexpool.h
│ │ │ │ ├── io.h
│ │ │ │ ├── layermap.h
│ │ │ │ ├── particle
│ │ │ │ │ ├── particle.h
│ │ │ │ │ ├── water.h
│ │ │ │ │ └── wind.h
│ │ │ │ ├── soil
│ │ │ │ │ ├── README.md
│ │ │ │ │ ├── default.soil
│ │ │ │ │ ├── rockgravelpebbles.soil
│ │ │ │ │ ├── rockgravelpebblessand.soil
│ │ │ │ │ ├── rocksand.soil
│ │ │ │ │ └── sand.soil
│ │ │ │ └── surface.h
│ │ │ ├── surfaces
│ │ │ │ ├── chunkyrock.cpp
│ │ │ │ ├── cobble_stone.cpp
│ │ │ │ ├── cracked_ground.cpp
│ │ │ │ ├── dirt.cpp
│ │ │ │ ├── header.h
│ │ │ │ ├── ice.cpp
│ │ │ │ ├── mountain.cpp
│ │ │ │ ├── mud.cpp
│ │ │ │ ├── sand.cpp
│ │ │ │ ├── sandstone.cpp
│ │ │ │ ├── snow.cpp
│ │ │ │ ├── soil.cpp
│ │ │ │ └── stone.cpp
│ │ │ └── utils
│ │ │ │ └── FastNoiseLite.cpp
│ │ └── cuda
│ │ │ ├── elements
│ │ │ ├── atmosphere.cu
│ │ │ ├── core.cu
│ │ │ ├── ground.cu
│ │ │ ├── header.h
│ │ │ ├── landtiles.cu
│ │ │ ├── mountains.cu
│ │ │ ├── upsidedown_mountains.cu
│ │ │ ├── voronoi_rocks.cu
│ │ │ ├── warped_rocks.cu
│ │ │ └── waterbody.cu
│ │ │ ├── surfaces
│ │ │ ├── chunkyrock.cu
│ │ │ ├── cobble_stone.cu
│ │ │ ├── cracked_ground.cu
│ │ │ ├── dirt.cu
│ │ │ ├── header.h
│ │ │ ├── ice.cu
│ │ │ ├── mountain.cu
│ │ │ ├── mud.cu
│ │ │ ├── sand.cu
│ │ │ ├── sandstone.cu
│ │ │ ├── snow.cu
│ │ │ ├── soil.cu
│ │ │ └── stone.cu
│ │ │ └── utils
│ │ │ └── FastNoiseLite.cu
│ ├── surface_kernel
│ │ ├── core.py
│ │ └── kernelizer.py
│ └── utils
│ │ ├── __init__.py
│ │ ├── camera.py
│ │ ├── ctype_util.py
│ │ ├── image_processing.py
│ │ ├── kernelizer_util.py
│ │ ├── logging.py
│ │ ├── mesh.py
│ │ └── random.py
│ ├── tools
│ ├── blendscript_import_infinigen.py
│ ├── dev
│ │ ├── generate_terrain_assets.py
│ │ ├── kernelize_surfaces.py
│ │ ├── landtile_viewer.py
│ │ ├── palette
│ │ │ ├── .gitignore
│ │ │ ├── demo1.png
│ │ │ ├── demo2.png
│ │ │ ├── demo3.png
│ │ │ ├── demo4.png
│ │ │ ├── palette.py
│ │ │ └── readme.md
│ │ └── params_parser.py
│ ├── export
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── export.py
│ │ └── install.sh
│ ├── generate_individual_assets.py
│ ├── ground_truth
│ │ ├── bounding_boxes_3d.py
│ │ ├── depth_to_normals.py
│ │ ├── optical_flow_warp.py
│ │ ├── rigid_warp.py
│ │ └── segmentation_lookup.py
│ ├── install
│ │ ├── compile_flip_fluids.sh
│ │ └── compile_opengl.sh
│ ├── manage_datagen_jobs.py
│ ├── pipeline_configs
│ │ ├── .gitignore
│ │ ├── asset_demo.gin
│ │ ├── base.gin
│ │ ├── compute_platform
│ │ │ ├── local_128GB.gin
│ │ │ ├── local_16GB.gin
│ │ │ ├── local_256GB.gin
│ │ │ ├── local_64GB.gin
│ │ │ ├── slurm.gin
│ │ │ ├── slurm_1h.gin
│ │ │ └── slurm_high_memory.gin
│ │ ├── cuda_terrain.gin
│ │ ├── data_schema
│ │ │ ├── monocular.gin
│ │ │ ├── monocular_flow.gin
│ │ │ ├── monocular_video.gin
│ │ │ ├── stereo.gin
│ │ │ ├── stereo_1h_jobs.gin
│ │ │ └── stereo_video.gin
│ │ ├── gt_options
│ │ │ ├── blender_gt.gin
│ │ │ ├── gt_test.gin
│ │ │ ├── opengl_gt.gin
│ │ │ └── opengl_gt_noshortrender.gin
│ │ └── opengl_gt_noshortrender.gin
│ ├── scripts
│ │ ├── render_river_video.sh
│ │ ├── render_video_1080p.sh
│ │ ├── render_video_720p.sh
│ │ ├── render_video_fire.sh
│ │ └── render_video_stereo.sh
│ ├── submit_asset_cache.py
│ ├── template.html
│ ├── testing
│ │ ├── conftest.py
│ │ ├── run_tests.sh
│ │ └── test_infinigen.py
│ └── util
│ │ ├── cancel_jobs.py
│ │ ├── cleanup.py
│ │ ├── google_drive_client.py
│ │ ├── show_gpu_table.py
│ │ ├── smb_client.py
│ │ ├── submitit_emulator.py
│ │ └── upload_util.py
│ └── util
│ ├── blender.py
│ ├── camera.py
│ ├── exporting.py
│ ├── logging.py
│ ├── math.py
│ ├── organization.py
│ ├── pipeline.py
│ └── random.py
├── llava_hf
├── dataset.py
├── inference.py
├── model.py
├── param_search.py
├── scripts
│ ├── eval_sllm_p10.sh
│ ├── peft_sllm_p10.sh
│ ├── render_sllm_p10.sh
│ └── zero3.json
├── train.py
├── trainer.py
├── utils.py
└── vgg.py
└── misc
└── teaser.jpg
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | *.DS_Store
3 | __pycache__
4 | checkpoint*
5 | material_dataset*
6 | result*
7 | test_images*
8 | data_scripts/figure*
9 | data_scripts/blender*
10 | infinigen/blender
11 | infinigen/Python-3.10.2
12 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to the codebase will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and adheres to [Semantic Versioning](https://semver.org/).
6 |
7 | ## [0.1.0] - 2025-02-16
8 | ### Added
9 | - Initial release
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 Massachusetts Institute of Technology
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/infinigen/.github/ISSUE_TEMPLATE/bug-report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Report an issue with using or installing infinigen
4 | title: ""
5 | labels: 'bug'
6 | assignees: ''
7 |
8 | ---
9 |
10 | # Describe the bug
11 | A clear and concise description of what the bug is.
12 |
13 | ## Steps to Reproduce
14 |
15 | ### What version of the code were you using?
16 | '''
17 | What is the output of `git log -n 1`?
18 | '''
19 |
20 | ### What command did you run?
21 | ```
22 |
23 | ```
24 |
25 | ### What are your FULL output logs?
26 | ```
27 |
28 | ```
29 |
30 | ### If this is your first time running Infinigen, what are the full output logs of `install.sh` ?**
31 |
32 |
33 | ### Platform
34 | - OS & OS Version:
35 | - GPU (?) :
36 | - GPU Driver Version (?) :
37 | - RAM (GB):
38 |
39 | # Additional context
40 | Add any other context about the problem here.
41 |
--------------------------------------------------------------------------------
/infinigen/.github/ISSUE_TEMPLATE/request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Request
3 | about: Request a feature!
4 | title: ""
5 | labels: 'enhancement'
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the feature you would like to see implemented**
11 |
12 |
--------------------------------------------------------------------------------
/infinigen/.gitignore:
--------------------------------------------------------------------------------
1 | Python-3.10.2
2 | Python-3.10.2.tgz
3 | blender
4 | blender.tar.xz
5 | Blender.app
6 |
7 | */rclone.zip
8 | */miniconda.sh
9 |
10 | .vscode
11 | */wandb
12 | .vscode
13 |
14 | slurm-*.out
15 | __pycache__
16 | *.blend
17 | *.blend1
18 | */worldgen/terrain/gen_occlusions/dependencies/*
19 | *.obj
20 | *.DS_Store
21 | **._.DS_Store
22 | **.swp
23 |
24 | .idea
25 | Blender.app/
26 | blender.dmg
27 | screenlog.*
28 |
29 | dev_install.sh
30 |
31 | dev.py
32 |
33 | cache
34 | Blender-FLIP-Fluids
35 | *.mp4
36 |
37 | *.npz
38 | *.obj
39 | *.blend
40 | *.blend1
41 | *.in
42 | *.out
43 | profiles_*.npz
44 | *outputs
45 | snippets
46 | resources
47 | times.txt
48 | wandb
49 | screenlog.0
50 | polycounts.txt
51 | START_*
52 | FINISH_*
53 | *_times.txt
54 | _start.txt
55 | config/custom.gin
56 | *.so
57 | *pyx.cpp
58 | blends
59 | generated_surface_script.py
60 | build
61 | *egg-info
62 | dist
63 | build
64 | blends
65 | *.ipynb_checkpoints
66 |
--------------------------------------------------------------------------------
/infinigen/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "worldgen/infinigen_gpl"]
2 | path = worldgen/infinigen_gpl
3 | url = https://github.com/princeton-vl/infinigen_gpl.git
4 | [submodule "process_mesh/dependencies/eigen"]
5 | path = process_mesh/dependencies/eigen
6 | url = https://gitlab.com/libeigen/eigen.git
7 | [submodule "process_mesh/dependencies/argparse"]
8 | path = process_mesh/dependencies/argparse
9 | url = https://github.com/p-ranav/argparse.git
10 | [submodule "process_mesh/dependencies/cnpy"]
11 | path = process_mesh/dependencies/cnpy
12 | url = https://github.com/rogersce/cnpy.git
13 | [submodule "process_mesh/dependencies/indicators"]
14 | path = process_mesh/dependencies/indicators
15 | url = https://github.com/p-ranav/indicators.git
16 | [submodule "process_mesh/dependencies/tinycolormap"]
17 | path = process_mesh/dependencies/tinycolormap
18 | url = https://github.com/yuki-koyama/tinycolormap.git
19 | [submodule "process_mesh/dependencies/glm"]
20 | path = process_mesh/dependencies/glm
21 | url = https://github.com/g-truc/glm.git
22 | [submodule "process_mesh/dependencies/fast_obj"]
23 | path = process_mesh/dependencies/fast_obj
24 | url = https://github.com/thisistherk/fast_obj.git
25 | [submodule "process_mesh/dependencies/json"]
26 | path = process_mesh/dependencies/json
27 | url = https://github.com/nlohmann/json.git
28 | [submodule "process_mesh/dependencies/stb"]
29 | path = process_mesh/dependencies/stb
30 | url = https://github.com/nothings/stb.git
31 | [submodule "process_mesh/dependencies/glfw"]
32 | path = process_mesh/dependencies/glfw
33 | url = https://github.com/glfw/glfw.git
34 |
--------------------------------------------------------------------------------
/infinigen/Dockerfile:
--------------------------------------------------------------------------------
1 | ARG APP_IMAGE=continuumio/miniconda3
2 | FROM ${APP_IMAGE}
3 | ARG APP_IMAGE
4 | ENV PATH="/root/miniconda3/bin:${PATH}"
5 | RUN if [ "$APP_IMAGE" = "nvidia/cuda:12.0.0-devel-ubuntu22.04" ]; then \
6 | echo "Using CUDA image" && \
7 | apt-get update && \
8 | apt-get install -y unzip sudo git g++ libglm-dev libglew-dev libglfw3-dev libgles2-mesa-dev zlib1g-dev wget cmake vim libxi6 libgconf-2-4 && \
9 | wget \
10 | https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
11 | && mkdir /root/.conda \
12 | && bash Miniconda3-latest-Linux-x86_64.sh -b \
13 | && rm -f Miniconda3-latest-Linux-x86_64.sh; \
14 | else \
15 | echo "Using Conda image" && \
16 | apt-get update -yq \
17 | && apt-get install -yq \
18 | cmake \
19 | g++ \
20 | libgconf-2-4 \
21 | libgles2-mesa-dev \
22 | libglew-dev \
23 | libglfw3-dev \
24 | libglm-dev \
25 | libxi6 \
26 | sudo \
27 | unzip \
28 | vim \
29 | zlib1g-dev; \
30 | fi
31 |
32 | RUN mkdir /opt/infinigen
33 | WORKDIR /opt/infinigen
34 | COPY . .
35 | RUN chmod +x worldgen/tools/install/compile_opengl.sh
36 | RUN conda init bash \
37 | && . ~/.bashrc \
38 | && conda create --name infinigen python=3.10 \
39 | && conda activate infinigen \
40 | && ./install.sh
--------------------------------------------------------------------------------
/infinigen/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2023, Princeton University
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | 1. Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | 2. Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation
13 | and/or other materials provided with the distribution.
14 |
15 | 3. Neither the name of the copyright holder nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/infinigen/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/__init__.py
--------------------------------------------------------------------------------
/infinigen/docs/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | v1.0.0 - Beta code release
2 | v1.0.1 - BSD-3 license, expanded ground-truth docs, show line-credits, miscellaneous fixes
3 | v1.0.2 - New documentation, plant improvements, disk and reproducibility improvements
4 | v1.0.3 - Fluid code release, implementing assets documentation, render tools improvements, integration tests
5 |
--------------------------------------------------------------------------------
/infinigen/docs/images/gt_annotations/Depth_0001_00_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/gt_annotations/Depth_0001_00_00.png
--------------------------------------------------------------------------------
/infinigen/docs/images/gt_annotations/OcclusionBoundaries_0001_00_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/gt_annotations/OcclusionBoundaries_0001_00_00.png
--------------------------------------------------------------------------------
/infinigen/docs/images/gt_annotations/SurfaceNormal_0001_00_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/gt_annotations/SurfaceNormal_0001_00_00.png
--------------------------------------------------------------------------------
/infinigen/docs/images/gt_annotations/blender_rock_2d.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/gt_annotations/blender_rock_2d.png
--------------------------------------------------------------------------------
/infinigen/docs/images/gt_annotations/blender_rock_3d.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/gt_annotations/blender_rock_3d.png
--------------------------------------------------------------------------------
/infinigen/docs/images/gt_annotations/caves.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/gt_annotations/caves.png
--------------------------------------------------------------------------------
/infinigen/docs/images/gt_annotations/petal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/gt_annotations/petal.png
--------------------------------------------------------------------------------
/infinigen/docs/images/gt_annotations/warped_rocks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/gt_annotations/warped_rocks.png
--------------------------------------------------------------------------------
/infinigen/docs/images/hello_world/Depth0048_00_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/hello_world/Depth0048_00_00.png
--------------------------------------------------------------------------------
/infinigen/docs/images/hello_world/Image0048_00_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/hello_world/Image0048_00_00.png
--------------------------------------------------------------------------------
/infinigen/docs/images/hello_world/InstanceSegmentation_0001_00_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/hello_world/InstanceSegmentation_0001_00_00.png
--------------------------------------------------------------------------------
/infinigen/docs/images/hello_world/SurfaceNormal_0001_00_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/hello_world/SurfaceNormal_0001_00_00.png
--------------------------------------------------------------------------------
/infinigen/docs/images/implementing_assets/setting_up_blender_ui_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/implementing_assets/setting_up_blender_ui_1.png
--------------------------------------------------------------------------------
/infinigen/docs/images/implementing_assets/setting_up_blender_ui_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/implementing_assets/setting_up_blender_ui_2.png
--------------------------------------------------------------------------------
/infinigen/docs/images/implementing_assets/setting_up_blender_ui_grassdemo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/implementing_assets/setting_up_blender_ui_grassdemo.png
--------------------------------------------------------------------------------
/infinigen/docs/images/implementing_assets/snow_demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/implementing_assets/snow_demo.png
--------------------------------------------------------------------------------
/infinigen/docs/images/implementing_assets/transpiler_demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/implementing_assets/transpiler_demo.png
--------------------------------------------------------------------------------
/infinigen/docs/images/individual_assets/chunkyrock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/individual_assets/chunkyrock.png
--------------------------------------------------------------------------------
/infinigen/docs/images/individual_assets/coral.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/individual_assets/coral.png
--------------------------------------------------------------------------------
/infinigen/docs/images/individual_assets/seashells.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/individual_assets/seashells.png
--------------------------------------------------------------------------------
/infinigen/docs/images/video_thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/docs/images/video_thumbnail.png
--------------------------------------------------------------------------------
/infinigen/process_mesh/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | CMakeFiles
3 | *.cmake
4 | *.jpg
5 | *.jpeg
6 | model-test
7 | CMakeCache.txt
8 | DartConfiguration.tcl
9 | build
10 |
--------------------------------------------------------------------------------
/infinigen/process_mesh/camera_view.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Lahav Lipson
5 |
6 |
7 | #include "shader.hpp"
8 | #include "utils.hpp"
9 | #include
10 | #include "io.hpp"
11 |
12 |
13 | class CameraView
14 | {
15 |
16 | private:
17 |
18 | float calc_resolution_scale();
19 | unsigned int create_framebuffer();
20 |
21 | glm::mat4 wc2img, projection, current_frame_view_matrix, next_frame_view_matrix;
22 | glm::vec3 position;
23 | double fx, fy, cx, cy;
24 | const int buffer_width, buffer_height;
25 | const fs::path frames_directory;
26 |
27 | public:
28 |
29 | const std::string frame_string;
30 | unsigned int framebuffer, framebuffer_ob, framebuffer_next_faceids;
31 |
32 | CameraView(const std::string fstr, const fs::path fdir, const fs::path input_dir, const int width, const int height);
33 | void activateShader(Shader &shader) const;
34 | Eigen::Tensor project(const Eigen::Tensor &cam_coords) const;
35 |
36 | };
37 |
--------------------------------------------------------------------------------
/infinigen/process_mesh/dependencies/glad/src/glad_egl.c:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | EGL loader generated by glad 0.1.35 on Mon Jan 17 21:14:15 2022.
4 |
5 | Language/Generator: C/C++
6 | Specification: egl
7 | APIs: egl=1.5
8 | Profile: -
9 | Extensions:
10 |
11 | Loader: True
12 | Local files: False
13 | Omit khrplatform: False
14 | Reproducible: False
15 |
16 | Commandline:
17 | --api="egl=1.5" --generator="c" --spec="egl" --extensions=""
18 | Online:
19 | https://glad.dav1d.de/#language=c&specification=egl&loader=on&api=egl%3D1.5
20 | */
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | int gladLoadEGL(void) {
28 | return gladLoadEGLLoader((GLADloadproc)eglGetProcAddress);
29 | }
30 |
31 | static int find_extensionsEGL(void) {
32 | return 1;
33 | }
34 |
35 | static void find_coreEGL(void) {
36 | }
37 |
38 | int gladLoadEGLLoader(GLADloadproc load) {
39 | (void) load;
40 | find_coreEGL();
41 |
42 | if (!find_extensionsEGL()) return 0;
43 | return 1;
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/infinigen/process_mesh/dependencies/scharstein_flow_viz/README.txt:
--------------------------------------------------------------------------------
1 | Some utilities for reading, writing, and color-coding .flo images
2 |
3 | Daniel Scharstein, 7/2/07
4 | updated 2/9/08 to fix bug in color_flow.cpp
5 | updated 6/9/09 to make robust to NaN or constant 0 flow (thanks Jan Bouecke)
6 |
7 | See flowIO.cpp for sample code for reading and writing .flo files.
8 | Here's an excerpt from this file describing the flow file format:
9 |
10 | // ".flo" file format used for optical flow evaluation
11 | //
12 | // Stores 2-band float image for horizontal (u) and vertical (v) flow components.
13 | // Floats are stored in little-endian order.
14 | // A flow value is considered "unknown" if either |u| or |v| is greater than 1e9.
15 | //
16 | // bytes contents
17 | //
18 | // 0-3 tag: "PIEH" in ASCII, which in little endian happens to be the float 202021.25
19 | // (just a sanity check that floats are represented correctly)
20 | // 4-7 width as an integer
21 | // 8-11 height as an integer
22 | // 12-end data (width*height*2*4 bytes total)
23 | // the float values for u and v, interleaved, in row order, i.e.,
24 | // u[row0,col0], v[row0,col0], u[row0,col1], v[row0,col1], ...
25 | //
26 |
27 |
28 | Once you have a .flo file, you can create a color coding of it using
29 | color_flow
30 |
31 | Use colortest to visualize the encoding
32 |
33 |
34 | To compile
35 |
36 | cd imageLib
37 | make
38 | cd ..
39 | make
40 | ./colortest 10 colors.png
41 |
--------------------------------------------------------------------------------
/infinigen/process_mesh/dependencies/scharstein_flow_viz/colorcode.h:
--------------------------------------------------------------------------------
1 |
2 | typedef unsigned char uchar;
3 |
4 | void computeColor(float fx, float fy, uchar *pix);
5 |
--------------------------------------------------------------------------------
/infinigen/process_mesh/glsl/hair.vert:
--------------------------------------------------------------------------------
1 | // VERTEX SHADER
2 |
3 | #version 440 core
4 |
5 | layout (location = 0) in mat4 instanceMatrix;
6 | layout (location = 4) in mat4 instanceMatrixNext;
7 | layout (location = 8) in vec3 aPos;
8 | layout (location = 9) in vec3 aPos_next;
9 | layout (location = 10) in ivec2 instance_id;
10 | layout (location = 11) in int tag;
11 | layout (location = 12) in float radius;
12 |
13 | uniform mat4 projection;
14 | uniform mat4 view;
15 | uniform mat4 viewNext;
16 |
17 | out VS_OUT {
18 | vec3 pos_wc;
19 | vec3 pos_cc;
20 | vec3 pos_cc_next;
21 | float radius;
22 | } vs_out;
23 |
24 | void main() {
25 | vec4 pos_wc = instanceMatrix * vec4(aPos, 1.0);
26 | vs_out.pos_wc = vec3(pos_wc);
27 | vec4 pos_cc = view * pos_wc;
28 | vs_out.pos_cc = pos_cc.xyz / pos_cc.w;
29 |
30 | vec4 pos_wc_next = instanceMatrixNext * vec4(aPos_next, 1.0);
31 | vec4 pos_cc_next = viewNext * pos_wc_next;
32 | vs_out.pos_cc_next = pos_cc_next.xyz / pos_cc_next.w;
33 |
34 | gl_Position = projection * pos_cc;
35 | vs_out.radius = radius;
36 | }
37 |
--------------------------------------------------------------------------------
/infinigen/process_mesh/glsl/next_wings.vert:
--------------------------------------------------------------------------------
1 | // VERTEX SHADER
2 |
3 | #version 440 core
4 |
5 | layout (location = 0) in mat4 instanceMatrix;
6 | layout (location = 4) in mat4 instanceMatrixNext;
7 | layout (location = 8) in vec3 aPos;
8 | layout (location = 9) in vec3 aPos_next;
9 | layout (location = 10) in ivec2 instance_id;
10 | layout (location = 11) in int tag;
11 |
12 |
13 | uniform mat4 projection;
14 | uniform mat4 view;
15 | uniform mat4 viewNext;
16 |
17 | mat4 opengl_to_cv = mat4(
18 | vec4(1., 0., 0., 0.),
19 | vec4(0., -1., 0., 0.),
20 | vec4(0., 0., -1., 0.),
21 | vec4(0., 0., 0., 1.));
22 |
23 | out VS_OUT {
24 | vec3 pos_wc;
25 | vec3 pos_cc;
26 | vec3 pos_cc_next;
27 | bool has_flow;
28 | int vertex_id;
29 | ivec2 instance_id;
30 | int tag;
31 | } vs_out;
32 |
33 | void main() {
34 | vec4 pos_wc = instanceMatrix * vec4(aPos, 1.0);
35 | vs_out.pos_wc = vec3(pos_wc);
36 |
37 | vec4 pos_cc_opengl = view * pos_wc;
38 | vec4 pos_cc = opengl_to_cv * pos_cc_opengl;
39 | vs_out.pos_cc = pos_cc.xyz / pos_cc.w;
40 |
41 | vs_out.has_flow = (abs(instanceMatrixNext[3][3]) > 1e-4);
42 |
43 | vec4 pos_wc_next = instanceMatrixNext * vec4(aPos_next, 1.0);
44 | vec4 pos_cc_next_opengl = viewNext * pos_wc_next;
45 | vec4 pos_cc_next = opengl_to_cv * pos_cc_next_opengl;
46 | vs_out.pos_cc_next = pos_cc_next.xyz / pos_cc_next.w;
47 |
48 | gl_Position = projection * pos_cc_next_opengl;
49 |
50 | vs_out.vertex_id = gl_VertexID;
51 | vs_out.instance_id = instance_id;
52 |
53 | vs_out.tag = tag;
54 | }
55 |
--------------------------------------------------------------------------------
/infinigen/process_mesh/glsl/spine.frag:
--------------------------------------------------------------------------------
1 | // FRAGMENT SHADER
2 |
3 | #version 440 core
4 |
5 | layout (location = 0) out ivec4 rasterized_occ_bounds;
6 |
7 | void main() {
8 | rasterized_occ_bounds = ivec4(0, 1, 0, 1);
9 | }
10 |
--------------------------------------------------------------------------------
/infinigen/process_mesh/glsl/spine.geom:
--------------------------------------------------------------------------------
1 | #version 440 core
2 |
3 | layout (lines_adjacency) in;
4 | layout (line_strip, max_vertices = 2) out;
5 |
6 | uniform mat4 wc2img;
7 |
8 | out vec3 normal;
9 | out vec3 interp_pos_wc;
10 |
11 | in VS_OUT {
12 | vec3 pos_wc;
13 | vec3 pos_cc;
14 | vec3 pos_cc_next;
15 | bool has_flow;
16 | int vertex_id;
17 | ivec2 instance_id;
18 | int tag;
19 | } gs_in[];
20 |
21 | vec2 proj(vec3 v){
22 | vec4 h = wc2img * vec4(v, 1.0);
23 | return vec2(h[0] / abs(h[2]), h[1] / abs(h[2]));
24 | }
25 |
26 | vec4 offset_amount = vec4(0.0, 0.0, -0.00001, 0.00);
27 |
28 | bool is_frontfacing(vec3 v1, vec3 v2, vec3 v3){
29 | vec2 uv1 = proj(v1);
30 | vec2 uv2 = proj(v2);
31 | vec2 uv3 = proj(v3);
32 |
33 | vec2 a = (uv2-uv1);
34 | vec2 b = (uv3-uv2);
35 | float winding = a.x * b.y - b.x * a.y;
36 | return winding > 0;
37 |
38 | }
39 |
40 | void main() {
41 | vec3 v1 = gs_in[0].pos_wc; // A
42 | vec3 v2 = gs_in[1].pos_wc; // B
43 | vec3 v3 = gs_in[2].pos_wc;
44 | vec3 v4 = gs_in[3].pos_wc;
45 |
46 | bool draw_boundary = (is_frontfacing(v1, v2, v3) != is_frontfacing(v2, v1, v4));
47 |
48 | if (draw_boundary){
49 | gl_Position = gl_in[0].gl_Position + offset_amount;
50 | EmitVertex();
51 | gl_Position = gl_in[1].gl_Position + offset_amount;
52 | EmitVertex();
53 | }
54 | }
--------------------------------------------------------------------------------
/infinigen/process_mesh/glsl/wings.vert:
--------------------------------------------------------------------------------
1 | // VERTEX SHADER
2 |
3 | #version 440 core
4 |
5 | layout (location = 0) in mat4 instanceMatrix;
6 | layout (location = 4) in mat4 instanceMatrixNext;
7 | layout (location = 8) in vec3 aPos;
8 | layout (location = 9) in vec3 aPos_next;
9 | layout (location = 10) in ivec2 instance_id;
10 | layout (location = 11) in int tag;
11 |
12 |
13 | uniform mat4 projection;
14 | uniform mat4 view;
15 | uniform mat4 viewNext;
16 |
17 | mat4 opengl_to_cv = mat4(
18 | vec4(1., 0., 0., 0.),
19 | vec4(0., -1., 0., 0.),
20 | vec4(0., 0., -1., 0.),
21 | vec4(0., 0., 0., 1.));
22 |
23 | out VS_OUT {
24 | vec3 pos_wc;
25 | vec3 pos_cc;
26 | vec3 pos_cc_next;
27 | bool has_flow;
28 | int vertex_id;
29 | ivec2 instance_id;
30 | int tag;
31 | } vs_out;
32 |
33 | void main() {
34 | vec4 pos_wc = instanceMatrix * vec4(aPos, 1.0);
35 | vs_out.pos_wc = vec3(pos_wc);
36 |
37 | vec4 pos_cc_opengl = view * pos_wc;
38 | vec4 pos_cc = opengl_to_cv * pos_cc_opengl;
39 | vs_out.pos_cc = pos_cc.xyz / pos_cc.w;
40 |
41 | vs_out.has_flow = (abs(instanceMatrixNext[3][3]) > 1e-4);
42 |
43 | vec4 pos_wc_next = instanceMatrixNext * vec4(aPos_next, 1.0);
44 | vec4 pos_cc_next = opengl_to_cv * viewNext * pos_wc_next;
45 | vs_out.pos_cc_next = pos_cc_next.xyz / pos_cc_next.w;
46 |
47 | gl_Position = projection * pos_cc_opengl;
48 |
49 | vs_out.vertex_id = gl_VertexID;
50 | vs_out.instance_id = instance_id;
51 |
52 | vs_out.tag = tag;
53 | }
54 |
--------------------------------------------------------------------------------
/infinigen/process_mesh/load_blender_mesh.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Lahav Lipson
5 |
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include "glm/gtx/string_cast.hpp"
18 | #include
19 | #include "utils.hpp"
20 | #include "cnpy/cnpy.h"
21 | #include "blender_object.hpp"
22 | #include
23 | #include "io.hpp"
24 |
25 | inline std::string truncate(const std::string &str, const size_t width){
26 | if (str.length() > width)
27 | return str.substr(0, width-3) + "...";
28 | return str + std::string(width - str.length(), ' ');
29 | }
30 |
31 | std::shared_ptr load_blender_mesh(const fs::path json_path);
32 |
33 | std::vector generate_buffer(const std::vector &indices);
34 |
35 |
36 |
--------------------------------------------------------------------------------
/infinigen/process_mesh/string_tools.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Lahav Lipson
5 |
6 |
7 | #include
8 | #include
9 | #include "string_tools.hpp"
10 |
11 | std::vector match_regex(const std::string &pattern, const std::string &input){
12 | const std::regex regex{pattern.c_str()};
13 | std::smatch m;
14 | std::vector output;
15 | if (std::regex_match(input, m, regex)){
16 | for (auto it : m)
17 | output.push_back(it.str());
18 | }
19 | return output;
20 | }
21 |
22 | std::string increment_int_substr(const std::vector &patterns, const std::string &input_orig){
23 | std::string input(input_orig);
24 | std::smatch res;
25 |
26 | for (const auto pattern : patterns){
27 | std::string::const_iterator searchStart( input.cbegin() );
28 | std::regex exp(pattern.c_str());
29 | while ( std::regex_search( searchStart, input.cend(), res, exp ) )
30 | {
31 | std::string number = res[1];
32 | std::string new_number = zfill(number.size(), std::atoi(number.c_str())+1);
33 | input.replace(res[1].first, res[1].second, new_number);
34 |
35 | searchStart = res.suffix().first;
36 | }
37 | }
38 |
39 | return input;
40 |
41 | }
--------------------------------------------------------------------------------
/infinigen/process_mesh/string_tools.hpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Lahav Lipson
5 |
6 |
7 | #include
8 | #include
9 |
10 | std::vector match_regex(const std::string &pattern, const std::string &input);
11 |
12 | std::string increment_int_substr(const std::vector &patterns, const std::string &input);
13 |
14 | template
15 | std::string zfill(const size_t n_zero, const T old_obj){
16 | const auto old_str = std::to_string(old_obj);
17 | return std::string(n_zero - std::min(n_zero, old_str.length()), '0') + old_str;
18 | }
--------------------------------------------------------------------------------
/infinigen/requirements.txt:
--------------------------------------------------------------------------------
1 | gin-config>=0.5.0
2 | tqdm
3 | opencv-python<=4.8.0.74
4 | matplotlib
5 | scipy
6 | fastcore
7 | imageio
8 | scikit-image==0.19.3
9 | termcolor
10 | submitit
11 | frozendict
12 | flow_vis
13 | vnoise
14 | trimesh==3.22.1
15 | einops
16 | geomdl
17 | numpy==1.21.5
18 | wandb
19 | zarr
20 | jinja2
21 | shapely
22 | rtree
23 | pycparser==2.21
24 | json5==0.9.10
25 | google-images-search==1.4.4
26 | landlab==2.4.1
27 | scikit-learn
28 | psutil
29 | pyrender
30 | pytest
31 | pandas
32 |
--------------------------------------------------------------------------------
/infinigen/worldgen/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/cactus/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 | # Date: April 13 2023
6 |
7 | from .generate import CactusFactory, ColumnarCactusFactory, GlobularCactusFactory, PrickyPearCactusFactory, \
8 | KalidiumCactusFactory
9 | from .columnar import ColumnarBaseCactusFactory
10 | from .globular import GlobularBaseCactusFactory
11 | from .pricky_pear import PrickyPearBaseCactusFactory
12 | from .kalidium import KalidiumBaseCactusFactory
13 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/cactus/base.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import bpy
8 |
9 | from assets.cactus.spike import make_default_selections
10 | from assets.utils.decorate import write_attribute
11 | from nodes.node_info import Nodes
12 | from nodes.node_wrangler import NodeWrangler
13 | from placement.factory import AssetFactory
14 |
15 | class BaseCactusFactory(AssetFactory):
16 | spike_distance = .025
17 | cap_percentage = .1
18 | noise_strength = .02
19 | base_radius = .002
20 | density = 5e4
21 |
22 | def __init__(self, factory_seed, coarse=False):
23 | super(BaseCactusFactory, self).__init__(factory_seed, coarse)
24 | self.points_fn = make_default_selections(self.spike_distance, self.cap_percentage, self.density)
25 |
26 | def create_asset(self, **params) -> bpy.types.Object:
27 | raise NotImplemented
28 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/cloud/__init__.py:
--------------------------------------------------------------------------------
1 | from .generate import CloudFactory, CumulonimbusFactory, CumulusFactory, AltocumulusFactory, \
2 | StratocumulusFactory
3 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/cloud/base.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/cloud/base.py
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/corals/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | from .diff_growth import DiffGrowthBaseCoralFactory, TableBaseCoralFactory, LeatherBaseCoralFactory
8 | from .generate import CoralFactory, LeatherCoralFactory, TableCoralFactory, CauliflowerCoralFactory, \
9 | BrainCoralFactory, HoneycombCoralFactory, BushCoralFactory, TwigCoralFactory, TubeCoralFactory, \
10 | FanCoralFactory, ElkhornCoralFactory, StarCoralFactory
11 | from .laplacian import CauliflowerBaseCoralFactory
12 | from .elkhorn import ElkhornBaseCoralFactory
13 | from .reaction_diffusion import BrainBaseCoralFactory, HoneycombBaseCoralFactory, \
14 | ReactionDiffusionBaseCoralFactory
15 | from .tree import BushBaseCoralFactory, TreeBaseCoralFactory, TwigBaseCoralFactory
16 | from .tube import TubeBaseCoralFactory
17 | from .fan import FanBaseCoralFactory
18 | from .star import StarBaseCoralFactory
19 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/corals/base.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import bpy
8 |
9 | from placement.factory import AssetFactory
10 |
11 |
12 | class BaseCoralFactory(AssetFactory):
13 |
14 | tentacle_distance = .05
15 | default_scale = [.8] * 3
16 | noise_strength = .02
17 | tentacle_prob = .5
18 | bump_prob = .3
19 | density = 500
20 |
21 | def __init__(self, factory_seed, coarse=False):
22 | super(BaseCoralFactory, self).__init__(factory_seed, coarse)
23 | self.points_fn = lambda nw, points: points
24 |
25 | def create_asset(self, **params) -> bpy.types.Object:
26 | raise NotImplemented
27 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/corals/laplacian.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | from assets.corals.base import BaseCoralFactory
8 | from assets.corals.tentacles import make_radius_points_fn
9 | from assets.utils.laplacian import build_laplacian_3d
10 | from assets.utils.object import mesh2obj
11 | from assets.utils.decorate import geo_extension
12 | import util.blender as butil
13 | from surfaces import surface
14 | from assets.utils.tag import tag_object, tag_nodegroup
15 |
16 | class CauliflowerBaseCoralFactory(BaseCoralFactory):
17 | tentacle_prob = 0.4
18 | noise_strength = .015
19 |
20 | def __init__(self, factory_seed, coarse=False):
21 | super(CauliflowerBaseCoralFactory, self).__init__(factory_seed, coarse)
22 | self.points_fn = make_radius_points_fn(.05, .6)
23 |
24 | def create_asset(self, face_size=0.01, **params):
25 | mesh = build_laplacian_3d()
26 | obj = mesh2obj(mesh)
27 | surface.add_geomod(obj, geo_extension, apply=True)
28 | levels = 1
29 | butil.modify_mesh(obj, 'SUBSURF', levels=levels, render_levels=levels)
30 | tag_object(obj, 'cauliflower_coral')
31 | return obj
32 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/__init__.py:
--------------------------------------------------------------------------------
1 | from .genomes.beetle import BeetleFactory, AntSwarmFactory
2 | from .genomes.bird import BirdFactory, FlyingBirdFactory
3 | from .genomes.carnivore import CarnivoreFactory
4 | from .genomes.fish import FishFactory, FishSchoolFactory
5 | from .genomes.herbivore import HerbivoreFactory
6 | from .genomes.crustacean import CrustaceanFactory, CrabFactory, LobsterFactory, SpinyLobsterFactory
7 | from .genomes.reptile import FrogFactory, LizardFactory, SnakeFactory
8 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_bird_duck.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_bird_duck.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_bird_gull.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_bird_gull.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_bird_robin.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_bird_robin.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_feline_cheetah.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_feline_cheetah.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_feline_housecat.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_feline_housecat.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_feline_tiger.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_feline_tiger.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_feline_tiger_2.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_feline_tiger_2.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_feline_wolf.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_feline_wolf.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_bluefish.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_bluefish.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_crappie.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_crappie.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_eel.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_eel.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_pickerel.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_pickerel.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_pufferfish.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_pufferfish.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_spadefish.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_fish_spadefish.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_herbivore_cow.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_herbivore_cow.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_herbivore_giraffe.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_herbivore_giraffe.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_herbivore_goat.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_herbivore_goat.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_herbivore_llama.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_herbivore_llama.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_insect_bee.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_insect_bee.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_insect_beetle.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_insect_beetle.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_insect_tarantula.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_insect_tarantula.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/body_llama.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/body_llama.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/head_carnivore_tiger.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/head_carnivore_tiger.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/head_carnivore_wolf.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/head_carnivore_wolf.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/head_herbivore_cow.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/head_herbivore_cow.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/head_herbivore_giraffe.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/head_herbivore_giraffe.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/head_herbivore_goat.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/head_herbivore_goat.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/head_herbivore_llama.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/head_herbivore_llama.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/head_insect_beetle.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/head_insect_beetle.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/genomes/nurbs/head_insect_wasp.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/genomes/nurbs/head_insect_wasp.npy
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/geometry/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/geometry/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/geometry/cpp_utils/.gitignore:
--------------------------------------------------------------------------------
1 | bnurbs.c*
2 | build
3 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/geometry/cpp_utils/setup_linux.py:
--------------------------------------------------------------------------------
1 | from distutils.core import setup, Extension
2 | import numpy
3 | from Cython.Distutils import build_ext
4 | from Cython.Build import cythonize
5 |
6 |
7 | extra_compile_args = []
8 | extra_link_args = []
9 |
10 | setup(
11 | cmdclass={'build_ext': build_ext},
12 | ext_modules=cythonize([
13 | Extension(
14 | "bnurbs",
15 | sources=["bnurbs.pyx"],
16 | include_dirs=[numpy.get_include()],
17 | extra_compile_args=extra_compile_args,
18 | extra_link_args=extra_link_args
19 | )
20 | ])
21 | )
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/geometry/cpp_utils/setup_macos.py:
--------------------------------------------------------------------------------
1 | from distutils.core import setup, Extension
2 | import numpy
3 | from Cython.Distutils import build_ext
4 | from Cython.Build import cythonize
5 |
6 |
7 | extra_compile_args = []
8 | extra_link_args = []
9 |
10 | setup(
11 | cmdclass={'build_ext': build_ext},
12 | ext_modules=cythonize([
13 | Extension(
14 | "bnurbs",
15 | sources=["bnurbs.pyx"],
16 | include_dirs=[numpy.get_include()],
17 | extra_compile_args=extra_compile_args,
18 | extra_link_args=extra_link_args
19 | )
20 | ])
21 | )
22 |
23 |
24 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/geometry/cpp_utils/setup_macos_as.py:
--------------------------------------------------------------------------------
1 | from distutils.core import setup, Extension
2 | import numpy
3 | from Cython.Distutils import build_ext
4 | from Cython.Build import cythonize
5 |
6 | extra_compile_args = []
7 | extra_link_args = ['-L/opt/homebrew/lib']
8 |
9 | setup(
10 | cmdclass={'build_ext': build_ext},
11 | ext_modules=cythonize([
12 | Extension(
13 | "bnurbs",
14 | sources=["bnurbs.pyx"],
15 | include_dirs=[numpy.get_include()],
16 | extra_compile_args=extra_compile_args,
17 | extra_link_args=extra_link_args
18 | )
19 | ])
20 | )
21 |
22 |
23 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/nodegroups/__init__.py:
--------------------------------------------------------------------------------
1 | from . import geometry, attach, curve
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/parts/__init__.py:
--------------------------------------------------------------------------------
1 | from . import body, foot, wings, leg, head, \
2 | head_detail, tail, \
3 | fin_old, ridged_fin, \
4 | beak, horn, \
5 | generic_nurbs, hoof, eye, reptile_detail, chameleon
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/parts/crustacean/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/parts/crustacean/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/parts/crustacean/eye.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import bpy
8 | import numpy as np
9 | from numpy.random import uniform
10 |
11 | from assets.creatures.creature import Part, PartFactory
12 | from assets.utils.decorate import join_objects
13 | from assets.utils.object import new_icosphere, origin2leftmost
14 | from placement.detail import remesh_with_attrs
15 |
16 |
17 | class CrustaceanEyeFactory(PartFactory):
18 | tags = ['eye']
19 | min_spike_distance = .05
20 | min_spike_radius = .02
21 |
22 | def make_part(self, params) -> Part:
23 | length = params['length']
24 | sphere = new_icosphere(radius=params['radius'])
25 | bpy.ops.mesh.primitive_cylinder_add(radius=.01, depth=length, location=(-length / 2, 0, 0))
26 | cylinder = bpy.context.active_object
27 | cylinder.rotation_euler[1] = np.pi / 2
28 | obj = join_objects([sphere, cylinder])
29 | remesh_with_attrs(obj, .005)
30 | origin2leftmost(obj)
31 |
32 | skeleton = np.zeros((2, 3))
33 | skeleton[1, 0] = length
34 | return Part(skeleton, obj)
35 |
36 | def sample_params(self):
37 | radius = uniform(.03, .05)
38 | length = radius * uniform(1, 1.5)
39 | return {'radius': radius, 'length': length}
40 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/parts/crustacean/fin.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform
9 |
10 | from assets.creatures.creature import Part, PartFactory
11 | from assets.utils.draw import leaf
12 | from surfaces.surface import write_attr_data
13 | from util import blender as butil
14 |
15 |
16 | class CrustaceanFinFactory(PartFactory):
17 | tags = ['body']
18 |
19 | def make_part(self, params) -> Part:
20 | x_length, y_length, x_tip, y_mid = map(params.get, ['x_length', 'y_length', 'x_tip', 'y_mid'])
21 | x_anchors = 0, x_tip / 2, x_tip, 1
22 | y_anchors = 0, y_mid, 1, 0
23 | obj = leaf(np.array(x_anchors) * x_length, np.array(y_anchors) * y_length)
24 | butil.modify_mesh(obj, 'SOLIDIFY', thickness=.01, offset=0.)
25 | write_attr_data(obj, 'ratio', np.ones(len(obj.data.vertices)))
26 | skeleton = np.zeros((2, 3))
27 | skeleton[1, 0] = x_length
28 | return Part(skeleton, obj)
29 |
30 | def sample_params(self):
31 | x_length = uniform(.15, .3)
32 | y_length = x_length * uniform(.3, .4)
33 | x_tip = uniform(.7, .8)
34 | y_mid = uniform(.6, .8)
35 | return {'x_length': x_length, 'y_length': y_length, 'x_tip': x_tip, 'y_mid': y_mid}
36 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/tools/dev_script_save_nurbs_handles.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Alexander Raistrick
5 |
6 |
7 | '''
8 | 1. Copy this script into the blender scripting UI
9 | 2. Select a Nurbs Cylinder object you have modified into some shape
10 | 3. Run the script
11 | '''
12 |
13 | import pdb
14 |
15 | import bpy
16 | import mathutils
17 | import numpy as np
18 |
19 | from assets.creatures.geometry import lofting, nurbs, skin_ops
20 | from assets.creatures.util.creature_parser import parse_nurbs_data
21 | from util import blender as butil
22 |
23 | vis = False
24 |
25 | for obj in bpy.context.selected_objects:
26 | handles = parse_nurbs_data(obj)[..., :3]
27 |
28 | # blender uses V = long axis of a cylinder by default, this is not our convention
29 | handles = handles.transpose(0, 1, 2)
30 |
31 | # blender has U = 0 face right, ours faces down
32 | handles = np.roll(handles, 2, axis=1)
33 |
34 |
35 | handles = handles[:, ::-1]
36 |
37 | if vis:
38 | new_obj = nurbs.nurbs(handles, method='blender', face_size=0.05)
39 | new_obj.location = obj.location + mathutils.Vector((0, 0.5, 0))
40 |
41 | path = f'{obj.name}.npy'
42 | np.save(path, handles)
43 | print('Saved', path)
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/creatures/util/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/creatures/util/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/deformed_trees/__init__.py:
--------------------------------------------------------------------------------
1 | from .fallen import FallenTreeFactory
2 | from .rotten import RottenTreeFactory
3 | from .truncated import TruncatedTreeFactory
4 | from .hollow import HollowTreeFactory
5 | from .generate import DeformedTreeFactory
6 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/deformed_trees/generate.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 |
9 | from assets.deformed_trees import FallenTreeFactory, HollowTreeFactory, RottenTreeFactory
10 | from assets.deformed_trees.truncated import TruncatedTreeFactory
11 | from placement.factory import AssetFactory
12 | from util.math import FixedSeed
13 | from assets.utils.tag import tag_object, tag_nodegroup
14 |
15 | class DeformedTreeFactory(AssetFactory):
16 |
17 | def __init__(self, factory_seed, coarse=False):
18 | super(DeformedTreeFactory, self).__init__(factory_seed, coarse)
19 | self.makers = [FallenTreeFactory, RottenTreeFactory, TruncatedTreeFactory, HollowTreeFactory]
20 | self.weights = np.array([1, 1, 1, 1])
21 | with FixedSeed(factory_seed):
22 | self.maker = np.random.choice(self.makers, p=self.weights / self.weights.sum())
23 |
24 | def create_asset(self, **params):
25 | return self.maker(**params)
26 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/fruits/__init__.py:
--------------------------------------------------------------------------------
1 | from .apple import FruitFactoryApple
2 | from .blackberry import FruitFactoryBlackberry
3 | from .coconutgreen import FruitFactoryCoconutgreen
4 | from .coconuthairy import FruitFactoryCoconuthairy
5 | from .durian import FruitFactoryDurian
6 | from .pineapple import FruitFactoryPineapple
7 | from .starfruit import FruitFactoryStarfruit
8 | from .strawberry import FruitFactoryStrawberry
9 | from .compositional_fruit import FruitFactoryCompositional
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/grassland/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Beining Han
5 |
6 |
7 | from .dandelion import DandelionFactory, DandelionSeedFactory
8 | from .flowerplant import FlowerPlantFactory
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/leaves/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/assets/leaves/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/mollusk/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | from .generate import MolluskFactory, NautilusFactory, ConchFactory, AugerFactory, VoluteFactory, \
8 | ScallopFactory, ClamFactory, MusselFactory
9 | from .snail import SnailBaseFactory, NautilusBaseFactory, ConchBaseFactory, AugerBaseFactory, VoluteBaseFactory
10 | from .shell import ShellBaseFactory, ScallopBaseFactory, ClamBaseFactory, MusselBaseFactory
11 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/mollusk/base.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import bpy
8 |
9 | from placement.factory import AssetFactory
10 |
11 |
12 | class BaseMolluskFactory(AssetFactory):
13 | max_expected_radius = .5
14 | noise_strength = .02
15 | ratio = 1
16 | x_scale = 2
17 | z_scale = 1
18 | distortion = 1
19 |
20 | def __init__(self, factory_seed, coarse=False):
21 | super(BaseMolluskFactory, self).__init__(factory_seed, coarse)
22 |
23 | def create_asset(self, **params) -> bpy.types.Object:
24 | raise NotImplemented
25 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/monocot/__init__.py:
--------------------------------------------------------------------------------
1 | from .agave import AgaveMonocotFactory
2 | from .grasses import GrassesMonocotFactory, WheatMonocotFactory, WheatEarMonocotFactory, MaizeMonocotFactory, \
3 | ReedMonocotFactory
4 | from .tussock import TussockMonocotFactory
5 | from .pinecone import PineconeFactory
6 | from .generate import MonocotFactory
7 | from .banana import BananaMonocotFactory, TaroMonocotFactory
8 | from .veratrum import VeratrumMonocotFactory
9 | from .kelp import KelpMonocotFactory
10 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/mushroom/__init__.py:
--------------------------------------------------------------------------------
1 | from .growth import MushroomGrowthFactory
2 | from .generate import MushroomFactory
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/small_plants/__init__.py:
--------------------------------------------------------------------------------
1 | from .fern import FernFactory
2 | from .succulent import SucculentFactory
3 | from .spider_plant import SpiderPlantFactory
4 | from .snake_plant import SnakePlantFactory
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/trees/.gitignore:
--------------------------------------------------------------------------------
1 | *.blend
2 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/trees/__init__.py:
--------------------------------------------------------------------------------
1 | from .generate import BushFactory, TreeFactory
2 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/tropic_plants/__init__.py:
--------------------------------------------------------------------------------
1 | from .leaf_banana_tree import LeafBananaTreeFactory, PlantBananaTreeFactory
2 | from .leaf_palm_plant import LeafPalmPlantFactory
3 | from .leaf_palm_tree import LeafPalmTreeFactory
4 | from .coconut_tree import CoconutTreeFactory
5 | from .palm_tree import PalmTreeFactory
6 |
--------------------------------------------------------------------------------
/infinigen/worldgen/assets/utils/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/.gitignore:
--------------------------------------------------------------------------------
1 | local_debug*.gin
--------------------------------------------------------------------------------
/infinigen/worldgen/config/asset_demo.gin:
--------------------------------------------------------------------------------
1 | compose_scene.inview_distance = 30
2 |
3 | full/render_image.min_samples = 50
4 | full/render_image.num_samples = 300
5 |
6 | render_image.motion_blur = False
7 | render_image.use_dof = True
8 |
9 | full/render_image.passes_to_save = []
--------------------------------------------------------------------------------
/infinigen/worldgen/config/base_surface_registry.gin:
--------------------------------------------------------------------------------
1 | surface.registry.ground_collection = [
2 | ('mud', 2),
3 | ('sand', 1),
4 | ('cobble_stone', 1),
5 | ('cracked_ground', 1),
6 | ('dirt', 1),
7 | ('stone', 1),
8 | ('soil', 1),
9 | ('chunkyrock', 0),
10 | ]
11 |
12 | surface.registry.beach = [
13 | ('sand', 10),
14 | ('cracked_ground', 1),
15 | ('dirt', 1),
16 | ('stone', 1),
17 | ('soil', 1),
18 | ]
19 |
20 | surface.registry.eroded = [
21 | ('sand', 1),
22 | ('cracked_ground', 1),
23 | ('dirt', 1),
24 | ('stone', 1),
25 | ('soil', 1),
26 | ]
27 |
28 | surface.registry.mountain_collection = [
29 | ('mountain', 10),
30 | ("sandstone", 2),
31 | ]
32 |
33 | surface.registry.rock_collection = [
34 | # ('aluminumdisp2tut', 0.5),
35 | ('stone', 1),
36 | ('mountain', 5),
37 | # ('ice', 1),
38 | ]
39 |
40 | surface.registry.liquid_collection = [
41 | ('water', 0.95),
42 | # ('lava', 0.05),
43 | ]
44 |
45 | surface.registry.lava = [
46 | ('lava', 1),
47 | ]
48 |
49 | surface.registry.snow = [
50 | ('snow', 1),
51 | ]
52 |
53 | surface.registry.atmosphere = [
54 | ('atmosphere_light_haze', 1),
55 | ]
56 |
57 | surface.registry.bark = [
58 | ('bark_birch', 0.1),
59 | ('bark_random', 0.9),
60 | #('wood', 0.01),
61 | ]
62 |
63 | surface.registry.greenery = [
64 | ('simple_greenery', 1),
65 | ]
66 |
67 | surface.registry.smooth_categories = 0
68 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/disable_assets/no_creatures.gin:
--------------------------------------------------------------------------------
1 | compose_scene.ground_creatures_chance = 0.0
2 | compose_scene.flying_creatures_chance = 0.0
3 | compose_scene.fish_school_chance = 0.0
4 | compose_scene.bug_swarm_chance = 0.0
5 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/disable_assets/no_particles.gin:
--------------------------------------------------------------------------------
1 | compose_scene.rain_particles_chance = 0.0
2 | compose_scene.snow_particles_chance = 0.0
3 | compose_scene.leaf_particles_chance = 0.0
4 | compose_scene.dust_particles_chance = 0.0
5 | compose_scene.marine_snow_particles_chance = 0.0
--------------------------------------------------------------------------------
/infinigen/worldgen/config/disable_assets/no_rocks.gin:
--------------------------------------------------------------------------------
1 | compose_scene.boulders_chance = 0.0
2 | compose_scene.rocks_chance = 0.0
--------------------------------------------------------------------------------
/infinigen/worldgen/config/experimental.gin:
--------------------------------------------------------------------------------
1 | # things that are not quite fully working correctly, but you can use if you please
2 |
3 | render_image.motion_blur = True # not fully supported in ground truth
4 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/monocular.gin:
--------------------------------------------------------------------------------
1 | camera.spawn_camera_rigs.camera_rig_config = [
2 | {'loc': (0, 0, 0), 'rot_euler': (0, 0, 0)},
3 | ]
4 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/natural.gin:
--------------------------------------------------------------------------------
1 | # surfaces.templates.water.shader.color = ("palette", "water")
2 | surfaces.templates.mountain.shader.color = ("palette", "mountain soil")
3 | surfaces.templates.sandstone.shader.color = ("palette", "sandstone")
--------------------------------------------------------------------------------
/infinigen/worldgen/config/performance/dev.gin:
--------------------------------------------------------------------------------
1 | compose_scene.generate_resolution = (960, 540)
2 |
3 | full/render_image.min_samples = 32
4 | full/render_image.num_samples = 512
5 |
6 | OpaqueSphericalMesher.pixels_per_cube = 4
7 | TransparentSphericalMesher.pixels_per_cube = 4
8 | target_face_size.global_multiplier = 2
9 |
10 | compose_scene.ground_creatures_chance = 0.0
11 | compose_scene.flying_creatures_chance = 0.0
12 |
13 | compose_scene.inview_distance = 35
14 | placement.populate_all.dist_cull = 35
15 | compose_scene.near_distance = 10
16 | compose_scene.center_distance = 20
--------------------------------------------------------------------------------
/infinigen/worldgen/config/performance/fast_terrain_assets.gin:
--------------------------------------------------------------------------------
1 | landtiles.load_assets.on_the_fly_instances = 1
2 | upsidedown_mountains.load_assets.on_the_fly_instances = 1
3 | caves.load_assets.on_the_fly_instances = 1
4 | run_erosion.n_iters = [10000, 50000]
--------------------------------------------------------------------------------
/infinigen/worldgen/config/performance/high_quality_terrain.gin:
--------------------------------------------------------------------------------
1 | OpaqueSphericalMesher.pixels_per_cube = 0.92
2 | TransparentSphericalMesher.pixels_per_cube = 1.38
3 |
4 | get_surface_type.degrade_sdf_to_displacement = 0
5 | voronoi_grains_chance = 0.5
6 |
7 | execute_tasks.optimize_terrain_diskusage=True
--------------------------------------------------------------------------------
/infinigen/worldgen/config/performance/reuse_terrain_assets.gin:
--------------------------------------------------------------------------------
1 | Terrain.asset_folder = None
2 |
3 | landtiles.load_assets.on_the_fly_instances = 0
4 | landtiles.load_assets.reused_instances = 5
5 |
6 | upsidedown_mountains.load_assets.on_the_fly_instances = 0
7 | upsidedown_mountains.load_assets.reused_instances = 5
8 |
9 | caves.load_assets.on_the_fly_instances = 0
10 | caves.load_assets.reused_instances = 5
11 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/performance/simple.gin:
--------------------------------------------------------------------------------
1 | include 'config/performance/dev.gin'
2 | include 'config/disable_assets/no_creatures.gin'
3 | include 'config/performance/fast_terrain_assets.gin'
4 | run_erosion.n_iters = [1,1]
5 | full/render_image.num_samples = 64
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/arctic.gin:
--------------------------------------------------------------------------------
1 | surface.registry.mountain_collection = [
2 | ('ice', 1),
3 | ]
4 |
5 | surface.registry.rock_collection = [
6 | ('ice', 1),
7 | ]
8 |
9 | compose_scene.ground_creature_registry = [
10 | (@CarnivoreFactory, 0),
11 | (@HerbivoreFactory, 0.3),
12 | (@BirdFactory, 1),
13 | ]
14 |
15 | Terrain.main_terrain = "CollectiveTransparentTerrain"
16 | # scene composition config
17 | LandTiles.transparency = "CollectiveTransparent"
18 | VoronoiRocks.transparency = "CollectiveTransparent"
19 |
20 | LandTiles.randomness = 1
21 | LandTiles.land_process = "ice_erosion"
22 | LandTiles.tiles = ["Mesa"]
23 | LandTiles.tile_heights = [-2.75]
24 | LandTiles.tile_density = 0.4
25 | LandTiles.height_modification_start = -1.5
26 | LandTiles.height_modification_end = -2.5
27 | scene.ground_chance = 0
28 | scene.warped_rocks_chance = 0
29 | scene.ground_ice_chance = 1
30 | scene.waterbody_chance = 1
31 |
32 | include 'config/disable_assets/no_assets.gin'
33 |
34 | compose_scene.wind_chance = 0.5
35 | compose_scene.turbulence_chance = 0.5
36 | compose_scene.boulders_chance = 0.3
37 | compose_scene.rocks_chance = 0.3
38 |
39 | shader_atmosphere.density = 0
40 | water.geo.water_height = ("uniform", 0.002, 0.004)
41 |
42 | water.geo.with_ripples = 0
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/canyon.gin:
--------------------------------------------------------------------------------
1 | atmosphere_light_haze.shader_atmosphere.anisotropy = 0
2 |
3 | # scene composition config
4 | LandTiles.tiles = ["Canyons", "Canyon", "Canyons"]
5 | LandTiles.tile_heights = [-4, -4, -4]
6 | LandTiles.randomness = 1
7 |
8 | # camera selection config
9 | keep_cam_pose_proposal.terrain_coverage_range = (0.5, 0.9)
10 | camera_selection_preprocessing.terrain_tags_ratio = {("altitude", 16, 1e9): (0.01, 1)}
11 |
12 | compose_scene.ground_creatures_chance = 0.2
13 | compose_scene.ground_creature_registry = [
14 | (@SnakeFactory, 0.9)
15 | ]
16 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/cliff.gin:
--------------------------------------------------------------------------------
1 | compose_scene.ground_creature_registry = [
2 | (@CarnivoreFactory, 0.2),
3 | (@HerbivoreFactory, 1),
4 | (@BirdFactory, 1),
5 | ]
6 |
7 | # scene composition config
8 | LandTiles.tiles = ["Mountain", "Cliff", "Mountain"]
9 | LandTiles.tile_heights = [-15, -15, 10]
10 | LandTiles.tile_density = 1.6
11 | LandTiles.randomness = 1
12 | WarpedRocks.slope_shift=-15
13 | Ground.height = -15
14 |
15 | # camera selection config
16 | UniformMesher.dimensions = (-25, 25, -25, 25, -15, 35)
17 | keep_cam_pose_proposal.terrain_coverage_range = (0, 0.8)
18 | camera_selection_preprocessing.terrain_tags_ratio = {("altitude", 10, 1e9): (0.01, 1)}
19 |
20 | compose_scene.flying_creatures_chance=0.6
21 | compose_scene.flying_creature_registry = [
22 | (@FlyingBirdFactory, 1),
23 | ]
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/coast.gin:
--------------------------------------------------------------------------------
1 | water.is_ocean = ("bool", 0.5)
2 | water.coastal = 1
3 | water.shader.colored = 0
4 | water.geo.with_ripples = 0
5 | sand.shader.wet = 1
6 |
7 |
8 | # scene composition config
9 | LandTiles.tile_density = 1.5
10 | LandTiles.tiles = ["MultiMountains", "Coast", "MultiMountains"]
11 | LandTiles.tile_heights = [-10, 0, 0]
12 | LandTiles.attribute_modification_start_height = ("uniform", -6, -5)
13 | LandTiles.attribute_modification_end_height = ("uniform", 2, 4)
14 | LandTiles.use_cblerp = 1
15 | LandTiles.smooth = 1
16 |
17 | scene.ground_chance = 0
18 | scene.waterbody_chance = 1
19 | scene.warped_rocks_chance = 0
20 | scene.voronoi_rocks_chance = 0.8
21 | scene.volcanos_chance = 0.5
22 |
23 |
24 | # lighting
25 | nishita_lighting.dust_density = 0
26 | nishita_lighting.air_density = ("uniform", 0.2, 0.5)
27 |
28 | shader_atmosphere.anisotropy = 1
29 | shader_atmosphere.density = 0
30 |
31 | # camera selection config
32 | camera_selection_preprocessing.terrain_tags_ratio = {"liquid": (0.05, 0.6), "beach": (0.05, 0.6)}
33 |
34 | compose_scene.ground_creatures_chance = 0.0
35 | compose_scene.ground_creature_registry = [
36 | (@BirdFactory, 0.1),
37 | (@CrabFactory, 1)
38 | ]
39 | compose_scene.max_ground_creatures = 8
40 | compose_scene.flying_creatures_chance=0.6
41 | compose_scene.flying_creature_registry = [
42 | (@FlyingBirdFactory, 1)
43 | ]
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/coral_reef.gin:
--------------------------------------------------------------------------------
1 | include 'config/scene_types/under_water.gin'
2 |
3 | compose_scene.kelp_chance = 0.1
4 | compose_scene.urchin_chance = 0.1
5 |
6 | compose_scene.corals_chance = 1.
7 | compose_scene.seaweed_chance = 0.2
8 | compose_scene.seashell_chance = 0.7
9 | compose_scene.jellyfish_chance = 0.0
10 |
11 | water.geo.with_waves=True
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/desert.gin:
--------------------------------------------------------------------------------
1 |
2 | compose_scene.trees_chance = 0.25
3 | compose_scene.cactus_chance = .7
4 | compose_scene.ground_leaves_chance = 0.5
5 | compose_scene.ground_twigs_chance = 0.3
6 | compose_scene.chopped_trees_chance = 0.1
7 | compose_scene.grass_chance = 0.1
8 | compose_scene.ferns_chance = 0.0
9 | compose_scene.pine_needle_chance = 0.05
10 | compose_scene.fancy_clouds_chance = 0.0
11 |
12 | compose_scene.tree_density = 0.02
13 |
14 | compose_scene.rain_particles_chance = 0.01
15 | compose_scene.snow_particles_chance = 0
16 | compose_scene.leaf_particles_chance = 0.05
17 | compose_scene.dust_particles_chance = 0.0
18 |
19 | atmosphere_light_haze.shader_atmosphere.density = ("uniform", 0, 0.0015)
20 | atmosphere_light_haze.shader_atmosphere.anisotropy = 0
21 |
22 | animate_cameras.follow_poi_chance=0.5
23 |
24 | compose_scene.ground_creatures_chance = 1.0
25 | compose_scene.ground_creature_registry = [
26 | (@SnakeFactory, 1)
27 | ]
28 |
29 | surface.registry.ground_collection = [
30 | ('sand', 1),
31 | ]
32 |
33 | surface.registry.mountain_collection = [
34 | ("sandstone", 1),
35 | ]
36 |
37 | # scene composition config
38 | LandTiles.tiles = ["Mountain"]
39 | LandTiles.randomness = 1
40 | LandTiles.tile_heights = [-2]
41 | LandTiles.tile_density = 0.25
42 | WarpedRocks.slope_shift = -3
43 | Ground.with_sand_dunes = 1
44 |
45 |
46 | scene.waterbody_chance = 0
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/kelp_forest.gin:
--------------------------------------------------------------------------------
1 | include 'config/scene_types/under_water.gin'
2 |
3 | multi_mountains_params.height = ("uniform", 1, 4)
4 | multi_mountains_params.min_freq = ("uniform", 0.01, 0.015)
5 | multi_mountains_params.max_freq = ("uniform", 0.03, 0.06)
6 |
7 | compose_scene.glowing_rocks_chance = 0.
8 | compose_scene.ground_leaves_chance = 0.2
9 | compose_scene.ground_twigs_chance = 0.4
10 | compose_scene.chopped_trees_chance = 0.
11 |
12 | compose_scene.kelp_chance = 1.0
13 | compose_scene.urchin_chance = 0.7
14 |
15 | compose_scene.corals_chance = 0.0
16 | compose_scene.seaweed_chance = 0.8
17 | compose_scene.seashell_chance = 0.8
18 | compose_scene.jellyfish_chance = 0.0
19 |
20 | water.shader.volume_density = ("uniform", 0.09, 0.13)
21 | water.shader.anisotropy = ("uniform", 0.45, 0.7)
22 | water.geo.with_waves=False
23 |
24 | camera.camera_pose_proposal.pitch = ("clip_gaussian", 90, 15, 60, 140)
25 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/mountain.gin:
--------------------------------------------------------------------------------
1 | compose_scene.flying_creatures_chance=0.7
2 | compose_scene.max_flying_creatures = 3
3 |
4 | animate_cameras.follow_poi_chance=0.0
5 |
6 | compose_scene.trees_chance = 0.5
7 | compose_scene.tree_density = 0.06
8 |
9 | # scene composition config
10 | scene.upsidedown_mountains_chance = 0.4
11 | WarpedRocks.slope_shift = -3
12 |
13 | water.shader.volume_density = ("uniform", 2, 10)
14 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/plain.gin:
--------------------------------------------------------------------------------
1 | compose_scene.ground_creature_registry = [
2 | (@CarnivoreFactory, 1),
3 | (@HerbivoreFactory, 1.5),
4 | (@BirdFactory, 0.7),
5 | ]
6 |
7 | compose_scene.ground_creatures_chance = 0.0
8 | compose_scene.ground_creature_registry = [
9 | (@CarnivoreFactory, 2),
10 | (@HerbivoreFactory, 0.8),
11 | (@SnakeFactory, 2)
12 | ]
13 |
14 | compose_scene.flying_creatures_chance = 0.7
15 | compose_scene.flying_creature_registry = [
16 | (@DragonflyFactory, 1),
17 | (@FlyingBirdFactory, 0.1)
18 | ]
19 |
20 | compose_scene.grass_select_max = 0.35
21 | compose_scene.tree_density = 0.02
22 | compose_scene.grass_chance = 1
23 |
24 | compose_scene.bug_swarm_chance=0.0
25 |
26 | # scene composition config
27 | scene.landtiles_chance = 0
28 | scene.warped_rocks_chance = 0
29 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/river.gin:
--------------------------------------------------------------------------------
1 | surface.registry.erosion_collection = [
2 | ('sand', 2),
3 | ('cracked_ground', 2),
4 | ('dirt', 1),
5 | ('stone', 3),
6 | ('soil', 1),
7 | ]
8 |
9 | compose_scene.ground_creatures_chance = 0.0
10 | compose_scene.ground_creature_registry = [
11 | (@CarnivoreFactory, 2),
12 | (@HerbivoreFactory, 0.5),
13 | (@SnakeFactory, 0.5)
14 | ]
15 |
16 | compose_scene.flying_creatures_chance = 0.7
17 | compose_scene.flying_creature_registry = [
18 | (@DragonflyFactory, 1),
19 | (@FlyingBirdFactory, 0.2)
20 | ]
21 |
22 | compose_scene.rain_particles_chance = 0.4
23 | populate_scene.slime_mold_chance = 0.3
24 | populate_scene.ivy_chance = 0.3
25 | populate_scene.lichen_chance = 0.3
26 | populate_scene.moss_chance = 0.0
27 |
28 | random_season.weights = {'autumn': 1, 'summer': 1, 'spring': 1, 'winter': 0.1}
29 |
30 | # scene composition config
31 | LandTiles.tiles = ["Mountain", "River", "Mountain"]
32 | LandTiles.tile_heights = [1.75, -0.75, 1.75]
33 | LandTiles.randomness = 1
34 |
35 | scene.waterbody_chance = 1
36 | scene.ground_chance = 0
37 | scene.warped_rocks_chance = 0
38 |
39 | # camera selection config
40 | UniformMesher.dimensions = (-25, 25, -25, 25, -15, 35)
41 | camera_selection_preprocessing.terrain_tags_ratio = {("altitude", -1e9, 0.75): (0.1, 1), "liquid": (0.05, 1)}
42 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types/snowy_mountain.gin:
--------------------------------------------------------------------------------
1 | include 'config/disable_assets/no_assets.gin'
2 |
3 | surface.registry.rock_collection = [
4 | ('mountain', 1),
5 | ]
6 | surface.registry.mountain_collection = [
7 | ('mountain', 1),
8 | ]
9 |
10 | compose_scene.snow_particles_chance = 0.5
11 |
12 | shader_atmosphere.density = 0
13 | nishita_lighting.sun_elevation = ("spherical_sample", 10, 30)
14 | LandTiles.land_process = "snowfall"
15 | scene.waterbody_chance = 0
16 | scene.caves_chance = 0
17 | scene.ground_chance = 0
18 | scene.warped_rocks_chance = 0
19 | scene.voronoi_rocks_chance = 0
20 | scene.voronoi_grains_chance = 0
21 |
22 | tile_directions.MultiMountains = "initial"
23 |
24 | compose_scene.flying_creatures_chance = 0.5
25 | compose_scene.flying_creature_registry = [
26 | (@FlyingBirdFactory, 1),
27 | ]
28 |
29 | surfaces.templates.mountain.shader.layered_mountain = 0
30 | surfaces.templates.mountain.shader.snowy = 0 # TODO: re-enable once terrain flickering resolved
31 | compose_scene.boulders_chance = 1
32 |
33 | camera.camera_pose_proposal.pitch = ("clip_gaussian", 90, 30, 90, 100)
34 | keep_cam_pose_proposal.terrain_coverage_range = (0.3, 1)
35 | keep_cam_pose_proposal.min_terrain_distance = 40
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types_fluidsim/simulated_river.gin:
--------------------------------------------------------------------------------
1 | include 'config/scene_types/river.gin'
2 |
3 | UniformMesher.enclosed=1
4 | animate_cameras.policy_registry = @cam/AnimPolicyRandomForwardWalk
5 | cam/AnimPolicyRandomForwardWalk.forward_vec = (0,0,-1)
6 | cam/AnimPolicyRandomForwardWalk.speed = 1
7 | cam/AnimPolicyRandomForwardWalk.step_range = (5, 10)
8 | cam/AnimPolicyRandomForwardWalk.yaw_dist = ("uniform",-10, 10)
9 |
10 | keep_cam_pose_proposal.min_terrain_distance = 1
11 |
12 | compose_scene.hero_boulders_chance = 0.0
13 | compose_scene.simulated_river_enabled = True
14 |
15 | terrain.elements.landtiles.LandTiles.y_tilt = 0
16 | terrain.elements.landtiles.LandTiles.y_tilt_clip = 0
17 |
18 | camera_pose_proposal.override_loc = (0.45, -24, 8)
19 | camera_pose_proposal.override_rot = (-120, 180, -178)
20 |
21 |
22 | assets.boulder.create_placeholder.boulder_scale = 1
23 | LandTiles.land_process = None
24 | camera_selection_preprocessing.terrain_tags_ratio = {("altitude", -1e9, 0.75): (0, 1), "liquid": (0, 1)}
25 |
26 | core.render.hide_water = True
27 | compute_base_views.min_candidates_ratio = 1
28 | walk_same_altitude.ignore_missed_rays = True
29 |
30 | make_river.resolution = 400
31 | make_river.simulation_duration = 250
--------------------------------------------------------------------------------
/infinigen/worldgen/config/scene_types_fluidsim/tilted_river.gin:
--------------------------------------------------------------------------------
1 | include 'config/scene_types/river.gin'
2 |
3 | UniformMesher.enclosed=1
4 | animate_cameras.policy_registry = @cam/AnimPolicyRandomForwardWalk
5 | cam/AnimPolicyRandomForwardWalk.forward_vec = (0,0,-1)
6 | cam/AnimPolicyRandomForwardWalk.speed = 1
7 | cam/AnimPolicyRandomForwardWalk.step_range = (5, 10)
8 | cam/AnimPolicyRandomForwardWalk.yaw_dist = ("uniform",-10, 10)
9 |
10 |
11 | keep_cam_pose_proposal.min_terrain_distance = 1
12 |
13 | compose_scene.hero_boulders_chance = 1.0
14 |
15 | terrain.elements.landtiles.LandTiles.y_tilt = 0.7
16 | terrain.elements.landtiles.LandTiles.y_tilt_clip = 11
17 | camera_pose_proposal.override_loc = (0.678843,-30.5532, 11.7858)
18 | camera_pose_proposal.override_rot = (-110, 180, -178)
19 |
20 | compose_scene.tilted_river_enabled = True
21 |
22 | assets.boulder.create_placeholder.boulder_scale = 3
23 | LandTiles.land_process = None
24 | camera_selection_preprocessing.terrain_tags_ratio = {("altitude", -1e9, 0.75): (0, 1), "liquid": (0, 1)}
25 |
26 | core.render.hide_water = True
27 | compute_base_views.min_candidates_ratio = 1
28 | walk_same_altitude.ignore_missed_rays = True
--------------------------------------------------------------------------------
/infinigen/worldgen/config/stereo_training.gin:
--------------------------------------------------------------------------------
1 | # eliminate blurs / distortion that cause blurs or bad alignment of the depth map
2 | compositor_postprocessing.distort = False
3 | render_image.motion_blur = False
4 | render_image.use_dof = False
5 |
6 | # remove volume scatters, as the corrupt blender's depth map
7 | atmosphere_light_haze.shader_atmosphere.enable_scatter = False
8 | water.shader.enable_scatter = False
9 |
10 | # dont include tiny particles, they arent sufficiently visible
11 | compose_scene.rain_particles_chance = 0
12 | compose_scene.dust_particles_chance = 0
13 | compose_scene.snow_particles_chance = 0
14 |
15 | # eliminate lava, the emissive surface is too noisy
16 | # now by default lava is a separate material
17 | surface.registry.liquid_collection = [
18 | ('water', 0.95),
19 | ]
20 | surface.registry.lava = [
21 | ('water', 1),
22 | ]
23 |
24 | # reduce the baseline and pitch variance, requested by Lahav
25 | stereo_baseline = 0.075
26 | sample_camera_rotation.pitch_params = {'min': -20, 'max': 20, 'mean': 0, 'std': 15}
27 |
--------------------------------------------------------------------------------
/infinigen/worldgen/config/use_cached_fire.gin:
--------------------------------------------------------------------------------
1 | populate_scene.trees_fire_on_the_fly_chance = 0
2 | populate_scene.bushes_fire_on_the_fly_chance = 0
3 | populate_scene.creatures_fire_on_the_fly_chance = 0
4 | populate_scene.boulders_fire_on_the_fly_chance = 0
5 | populate_scene.cactus_fire_on_the_fly_chance = 0
6 |
7 | compose_scene.cached_fire_trees_chance= 0.5
8 | compose_scene.cached_fire_bushes_chance = 1
9 | compose_scene.cached_fire_boulders_chance = 0.3
10 | compose_scene.cached_fire_cactus_chance = 0.4
11 |
12 |
13 | render_image.exposure = 0.4
14 | compose_scene.cached_fire = True
15 | populate_scene.cached_fire = True
16 |
17 | FireCachingSystem.asset_folder = ""
--------------------------------------------------------------------------------
/infinigen/worldgen/config/use_on_the_fly_fire.gin:
--------------------------------------------------------------------------------
1 | populate_scene.trees_fire_on_the_fly_chance = 0.1
2 | #compose_scene.trees_chance = 1
3 | populate_scene.bushes_fire_on_the_fly_chance = 0.8
4 | #compose_scene.bushes_chance = 1
5 | populate_scene.creatures_fire_on_the_fly_chance = 0
6 | populate_scene.boulders_fire_on_the_fly_chance = 0.1
7 | populate_scene.cactus_fire_on_the_fly_chance = 0.1
8 | compose_scene.glowing_rocks_chance = 0.0
9 |
10 |
11 |
12 |
13 | render_image.exposure = 0.4
14 | compose_scene.cached_fire = False
15 | LandTiles.land_process = None
16 | #scene.voronoi_rocks_chance = 1
17 | #animate_cameras.follow_poi_chance=0
18 |
19 |
20 | set_obj_on_fire.resolution = 430
21 | set_obj_on_fire.dissolve_speed = 25
22 |
--------------------------------------------------------------------------------
/infinigen/worldgen/fluid/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/fluid/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/fluid/bounding_box.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Karhan Kayan
5 |
6 | import bpy
7 | import mathutils
8 | from numpy.random import uniform, normal, randint
9 | from nodes.node_wrangler import Nodes, NodeWrangler
10 | from nodes import node_utils
11 | from nodes.color import color_category
12 | from surfaces import surface
13 |
14 |
15 | def geometry_geometry_nodes(nw: NodeWrangler, obj):
16 | # Code generated using version 2.4.3 of the node_transpiler
17 |
18 | object_info = nw.new_node(Nodes.ObjectInfo, input_kwargs={"Object": obj})
19 |
20 | bounding_box = nw.new_node(
21 | Nodes.BoundingBox, input_kwargs={"Geometry": object_info.outputs["Geometry"]}
22 | )
23 |
24 | object_info.transform_space = "RELATIVE"
25 |
26 | group_output = nw.new_node(
27 | Nodes.GroupOutput,
28 | input_kwargs={"Geometry": bounding_box.outputs["Bounding Box"]},
29 | )
30 |
31 |
32 | def apply(bounding_box, obj, selection=None, **kwargs):
33 | surface.add_geomod(
34 | bounding_box,
35 | geometry_geometry_nodes,
36 | selection=selection,
37 | attributes=[],
38 | input_kwargs=dict(obj=obj),
39 | )
40 |
--------------------------------------------------------------------------------
/infinigen/worldgen/fluid/cached_factory_wrappers.py:
--------------------------------------------------------------------------------
1 |
2 | from assets.trees import TreeFactory, BushFactory
3 | from assets.creatures import CarnivoreFactory
4 | from assets.cactus import CactusFactory
5 | from assets.boulder import BoulderFactory
6 |
7 | class CachedBoulderFactory(BoulderFactory):
8 | pass
9 |
10 | class CachedCactusFactory(CactusFactory):
11 | pass
12 |
13 | class CachedCreatureFactory(CarnivoreFactory):
14 | pass
15 |
16 | class CachedBushFactory(BushFactory):
17 | pass
18 |
19 | class CachedTreeFactory(TreeFactory):
20 | pass
--------------------------------------------------------------------------------
/infinigen/worldgen/fluid/duplication_geomod.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Karhan Kayan
5 |
6 | import bpy
7 | import mathutils
8 | from numpy.random import uniform, normal, randint
9 | from nodes.node_wrangler import Nodes, NodeWrangler
10 | from nodes import node_utils
11 | from nodes.color import color_category
12 | from surfaces import surface
13 |
14 |
15 | def duplicate(nw: NodeWrangler, obj):
16 | # Code generated using version 2.4.3 of the node_transpiler
17 |
18 | object_info = nw.new_node(Nodes.ObjectInfo, input_kwargs={"Object": obj})
19 |
20 | object_info.transform_space = "RELATIVE"
21 |
22 | group_output = nw.new_node(
23 | Nodes.GroupOutput,
24 | input_kwargs={
25 | "Geometry": object_info.outputs["Geometry"],
26 | "Location": object_info.outputs["Location"],
27 | "Rotation": object_info.outputs["Rotation"],
28 | "Scale": object_info.outputs["Scale"],
29 | },
30 | )
31 |
32 |
33 | def apply(new_obj, old_obj, selection=None, **kwargs):
34 | surface.add_geomod(
35 | new_obj,
36 | duplicate,
37 | selection=selection,
38 | attributes=["Location", "Rotation", "Scale"],
39 | input_kwargs=dict(obj=old_obj),
40 | )
41 |
--------------------------------------------------------------------------------
/infinigen/worldgen/fluid/flip_init.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Karhan Kayan
5 |
6 | import bpy
7 |
8 | bpy.ops.preferences.addon_enable(module='flip_fluids_addon')
9 | bpy.ops.flip_fluid_operators.complete_installation()
10 |
--------------------------------------------------------------------------------
/infinigen/worldgen/fluid/liquid_particle_material.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Karhan Kayan
5 |
6 | import bpy
7 | import mathutils
8 | from numpy.random import uniform, normal, randint
9 | from nodes.node_wrangler import Nodes, NodeWrangler
10 | from nodes import node_utils
11 | from nodes.color import color_category
12 | from surfaces import surface
13 |
14 | def liquid_particle_material(nw: NodeWrangler):
15 | # Code generated using version 2.5.1 of the node_transpiler
16 |
17 | principled_bsdf = nw.new_node(Nodes.PrincipledBSDF,
18 | input_kwargs={
19 | 'Base Color': (1.0000, 1.0000, 1.0000, 1.0000),
20 | 'Subsurface Color': (0.7147, 0.6062, 0.8000, 1.0000),
21 | 'Specular': 0.0886,
22 | 'Roughness': 0.2705 + (0.1 * normal()),
23 | 'Sheen Tint': 0.0000,
24 | 'Clearcoat Roughness': 0.0000,
25 | 'IOR': 1.2000,
26 | 'Transmission': 0.2818 + (0.1 * normal())
27 | },
28 | attrs={'distribution': 'MULTI_GGX'})
29 |
30 | material_output = nw.new_node(Nodes.MaterialOutput,
31 | input_kwargs={'Surface': principled_bsdf})
32 |
33 |
34 |
35 | def apply(obj, selection=None, **kwargs):
36 | surface.add_material(obj, liquid_particle_material, selection=selection)
--------------------------------------------------------------------------------
/infinigen/worldgen/fluid/run_tests.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Karhan Kayan
5 |
6 | import pytest
7 | import bpy
8 |
9 | pytest.main(['fluid/unit_tests.py', '-rP'])
--------------------------------------------------------------------------------
/infinigen/worldgen/lighting/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/lighting/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/nodes/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/nodes/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/nodes/node_transpiler/changelog.md:
--------------------------------------------------------------------------------
1 | 2.0.0 - Add support for geometry node groups
2 | 2.1.0 - Add support for node groups in shader nodes
3 | 2.2.0 - Use labels as varname hints, transpile labels, prevent varname clashes with python keywords, use math ops as name hints
4 | 2.3.0 - Add support for automatic randomization based on labels
5 | 2.3.2 - Use nodegroup node_tree names as variable name hints
6 | 2.3.3 - Add type hints on nw arguments
7 | 2.4.0 - Add randomization support for Nodes.Integer, add ValueError for commonly missed ATTRS_AVAILABLE
8 | 2.4.1 - Add more node_info entries
9 | 2.4.2 - Sanitize non alphanumeric/underscore characters from variable names
10 | 2.4.3 - Fix duplicated dependencies
11 | 2.5.1 - Cleanup function names when transpiling already transpiled code, limit floats to 4 decimal places
12 | 2.6.0 - Replace manual NODE_ATTRS_AVAILABLE with automatic func, add aliases for bl3.5.1 nodes, switch to logging library
13 | 2.6.1 - Avoid overlength lines, avoid duplicating group_inputs
14 | 2.6.2 - Add dependency input, automatically import dependencies we need
15 | 2.6.3 - Ignore reroutes
16 | 2.6.4 - Fix world/compositor transpiling
17 |
--------------------------------------------------------------------------------
/infinigen/worldgen/nodes/nodegroups/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/nodes/nodegroups/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/rendering/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/rendering/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/surfaces/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/dev_script.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Alexander Raistrick
5 |
6 |
7 | '''
8 | To use this file, do the following:
9 |
10 | cd worldgen
11 | blender dev_scene.blend
12 |
13 | Then in the blender gui:
14 | - click the 'Scripting' tab
15 | - click the folder button to open this file as a new script
16 | - append some meshes from another blend file, or run some other code to create some objects
17 | - implement a geonode / material setup using the node wrangler in the functions below
18 | - left/right click the object you want to apply a material to
19 | - click the play button to run the script
20 |
21 | '''
22 |
23 | import bpy
24 | import mathutils
25 | from numpy.random import uniform, normal
26 | from nodes.node_wrangler import Nodes, NodeWrangler
27 | from surfaces import surface
28 |
29 | def shader_dev(nw):
30 | principled_bsdf = nw.new_node(Nodes.PrincipledBSDF)
31 |
32 | material_output = nw.new_node(Nodes.MaterialOutput,
33 | input_kwargs={'Surface': principled_bsdf})
34 |
35 | def geo_dev(nw):
36 | group_input = nw.new_node(Nodes.GroupInput)
37 |
38 | group_output = nw.new_node(Nodes.GroupOutput,
39 | input_kwargs={'Geometry': group_input.outputs["Geometry"]})
40 |
41 | def apply(obj):
42 | surface.add_geomod(obj, geo_dev, apply=False)
43 | surface.add_material(obj, shader_dev, reuse=False)
44 | apply(bpy.context.active_object)
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/surfaces/scatters/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/decorative_plants.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Alexander Raistrick
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform as U
9 |
10 |
11 | from placement.factory import AssetFactory, make_asset_collection
12 | from placement.instance_scatter import scatter_instances
13 | from placement import detail
14 | from nodes import node_utils
15 |
16 | from assets.small_plants import succulent
17 |
18 | from surfaces.scatters.utils.wind import wind
19 |
20 | def apply(obj, n=4, selection=None, **kwargs):
21 |
22 | fac_class = np.random.choice([
23 | succulent.SucculentFactory
24 | ])
25 |
26 | monocots = make_asset_collection(
27 | fac_class(np.random.randint(1e5)),
28 | n=n, verbose=True, **kwargs)
29 |
30 | scatter_obj = scatter_instances(
31 | base_obj=obj, collection=monocots,
32 | vol_density=U(0.05, 2), min_spacing=0.1,
33 | normal_fac=0.5,
34 | scale=U(0.3, 1), scale_rand=U(0.5, 0.95),
35 | rotation_offset=wind(strength=10),
36 | taper_density=True,
37 | selection=selection)
38 | return scatter_obj, monocots
39 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/fern.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Beining Han
5 |
6 |
7 | import numpy as np
8 | from placement.instance_scatter import scatter_instances
9 | from placement.factory import AssetFactory, make_asset_collection
10 |
11 | from assets.small_plants.fern import FernFactory
12 |
13 | from util.random import random_general as rg
14 | from surfaces.scatters.utils.wind import wind
15 |
16 | def apply(obj, selection=None, density=('uniform', 1, 6), **kwargs):
17 |
18 |
19 | fern_col = make_asset_collection(FernFactory(np.random.randint(1e5)), n=2, verbose=True)
20 | scatter_obj = scatter_instances(
21 | base_obj=obj, collection=fern_col,
22 | scale=0.7, scale_rand=0.7, scale_rand_axi=0.3,
23 | vol_density=rg(density),
24 | normal_fac=0.3,
25 | rotation_offset=wind(strength=10),
26 | selection=selection
27 | )
28 | return scatter_obj, fern_col
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/flowerplant.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Beining Han
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform, normal
9 | from mathutils import Vector
10 |
11 | from util import blender as butil
12 | from placement.instance_scatter import scatter_instances
13 | from nodes.node_wrangler import Nodes, NodeWrangler
14 | from surfaces import surface
15 | from nodes import node_utils
16 | from placement.factory import AssetFactory, make_asset_collection
17 | from assets.grassland.flowerplant import FlowerPlantFactory
18 | from surfaces.templates import simple_greenery
19 |
20 | from surfaces.scatters.utils.wind import wind
21 |
22 | def apply(obj, selection=None, density=1.0):
23 |
24 | flowerplant_col = make_asset_collection(FlowerPlantFactory(np.random.randint(1e5)), n=12, verbose=True)
25 |
26 | avg_vol = np.mean([np.prod(list(o.dimensions)) for o in flowerplant_col.objects])
27 | density = np.clip(density / avg_vol, 0, 200)
28 | scatter_obj = scatter_instances(
29 | base_obj=obj, collection=flowerplant_col,
30 | scale=1.5, scale_rand=0.7, scale_rand_axi=0.2,
31 | density=float(density),
32 | ground_offset=0, normal_fac=0.3,
33 | rotation_offset=wind(strength=20),
34 | selection=selection, taper_scale=True
35 | )
36 |
37 | return scatter_obj, flowerplant_col
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/ground_leaves.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Alexander Raistrick
5 |
6 |
7 | from numpy.random import uniform as U
8 | from mathutils import Vector
9 |
10 | from placement.instance_scatter import scatter_instances
11 | from nodes.node_wrangler import Nodes, NodeWrangler
12 |
13 | from assets.trees.generate import random_leaf_collection
14 |
15 | def apply(obj, selection=None, density=70, season=None, **kwargs):
16 | leaf_col=random_leaf_collection(season=season)
17 | return scatter_instances(
18 | base_obj=obj,
19 | collection=leaf_col,
20 | scale=0.3, scale_rand=U(0, 0.9),
21 | density=density,
22 | ground_offset=0.05,
23 | selection=selection,
24 | taper_density=True)
25 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/ground_mushroom.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform as U
9 |
10 | from assets.mushroom import MushroomFactory
11 | from nodes.node_wrangler import NodeWrangler
12 | from placement.factory import AssetFactory, make_asset_collection
13 | from placement.instance_scatter import scatter_instances
14 |
15 | class Mushrooms:
16 |
17 | def __init__(self, n=10):
18 |
19 | self.n_species = np.random.randint(2, 3)
20 | self.factories = [MushroomFactory(np.random.randint(1e5)) for i in range(self.n_species)]
21 | self.col = make_asset_collection(
22 | self.factories, name='mushroom', n=n, verbose=True,
23 | weights=np.random.uniform(0.5, 1, len(self.factories)))
24 |
25 | def apply(self, obj, scale=0.3, density=1., selection=None):
26 |
27 | scatter_obj = scatter_instances(
28 | base_obj=obj, collection=self.col,
29 | density=density, min_spacing=scale,
30 | scale=scale, scale_rand=U(0.5, 0.9),
31 | selection=selection, taper_scale=True)
32 |
33 | return scatter_obj
34 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/ground_twigs.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Alexander Raistrick
5 |
6 |
7 | from random import random
8 | import bpy
9 |
10 | import numpy as np
11 | from numpy.random import uniform as U
12 | from mathutils import Vector
13 |
14 | from util import blender as butil
15 | from util.blender import deep_clone_obj
16 |
17 | from nodes import node_utils
18 | from placement.instance_scatter import scatter_instances
19 | from nodes.node_wrangler import Nodes, NodeWrangler
20 | from surfaces import surface
21 |
22 | from assets.trees.generate import make_twig_collection, random_species
23 | from .chopped_trees import approx_settle_transform
24 |
25 | def apply(obj, selection=None, n_leaf=0, n_twig=10, **kwargs):
26 |
27 | (_, twig_params, leaf_params), _ = random_species(season='winter')
28 | twigs = make_twig_collection(np.random.randint(1e5), twig_params, leaf_params,
29 | n_leaf=n_leaf, n_twig=n_twig, leaf_types=None, trunk_surface=surface.registry('bark'))
30 |
31 | for o in twigs.objects:
32 | approx_settle_transform(o, samples=40)
33 |
34 | scatter_obj = scatter_instances(
35 | base_obj=obj, collection=twigs,
36 | scale=U(0.15, 0.3), scale_rand=U(0, 0.3), scale_rand_axi=U(0, 0.2),
37 | density=10, ground_offset=0.05,
38 | selection=selection, taper_density=True)
39 |
40 | return scatter_obj, twigs
41 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/jellyfish.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform as U
9 |
10 | from assets.jellyfish import JellyfishFactory
11 | from nodes.node_wrangler import NodeWrangler
12 | from placement.factory import AssetFactory, make_asset_collection
13 | from placement.instance_scatter import scatter_instances
14 |
15 |
16 | def apply(obj, scale=1, density=1., n=10, selection=None):
17 | n_species = np.random.randint(2, 3)
18 | factories = list(JellyfishFactory(np.random.randint(1e5)) for i in range(n_species))
19 | jellyfish = make_asset_collection(factories, name='jellyfish',
20 | weights=np.random.uniform(0.5, 1, len(factories)), n=n,
21 | verbose=True)
22 |
23 | def ground_offset(nw: NodeWrangler):
24 | return nw.uniform(4 * scale, 8 * scale)
25 |
26 | r = np.pi / 2
27 | scatter_obj = scatter_instances(
28 | base_obj=obj, collection=jellyfish,
29 | density=density, min_spacing=scale * 4,
30 | scale=scale, scale_rand=U(0.2, 0.9),
31 | ground_offset=ground_offset, selection=selection,
32 | normal_fac=0.0,
33 | rotation_offset=lambda nw: nw.uniform(3*(-r,), 3*(r,)), reset_children=False,
34 | )
35 | return scatter_obj, jellyfish
36 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/mollusk.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 |
9 | from assets.mollusk import MolluskFactory
10 | from assets.utils.misc import CountInstance
11 | from placement.factory import AssetFactory, make_asset_collection
12 | from assets.utils.decorate import toggle_hide
13 | from util import blender as butil
14 | from nodes import node_utils
15 | from placement.instance_scatter import scatter_instances
16 | from surfaces import surface
17 |
18 |
19 | def apply(obj, scale=0.4, density=1., n=10, selection=None):
20 | with CountInstance('mollusk'):
21 | n_species = np.random.randint(4, 6)
22 | factories = list(MolluskFactory(np.random.randint(1e5)) for _ in range(n_species))
23 | mollusk = make_asset_collection(factories, name='mollusk',
24 | weights=np.random.uniform(0.5, 1, len(factories)), n=n,
25 | verbose=True)
26 |
27 | def scaling(nw):
28 | return nw.uniform([.4 * scale] * 3, [.8 * scale] * 3, data_type='FLOAT_VECTOR')
29 |
30 | scatter_obj = scatter_instances('mollusk',
31 | base_obj=obj, collection=mollusk,
32 | density=density, scaling=scaling,
33 | min_spacing=scale, normal=(0,0,1),
34 | selection=selection, taper_density=True)
35 |
36 | return scatter_obj, mollusk
37 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/monocot.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform as U
9 |
10 | from assets.monocot.generate import MonocotFactory
11 | from nodes.node_wrangler import NodeWrangler
12 | from placement.camera import ng_dist2camera
13 | from placement.instance_scatter import scatter_instances
14 | from placement.factory import AssetFactory, make_asset_collection
15 | from surfaces.scatters.utils.wind import wind
16 |
17 | def apply(obj, n=4, grass=None, selection=None, **kwargs):
18 |
19 | monocots = make_asset_collection(
20 | MonocotFactory(np.random.randint(1e5), grass=grass),
21 | n=n, verbose=True, **kwargs)
22 |
23 | scatter_obj = scatter_instances(
24 | base_obj=obj, collection=monocots,
25 | vol_density=U(0.2, 4), min_spacing=0.1,
26 | ground_offset=(0, 0, -0.05),
27 | scale=U(0.05, 0.4), scale_rand=U(0.5, 0.95),
28 | rotation_offset=wind(strength=20),
29 | normal_fac=0.3,
30 | selection=selection)
31 | return scatter_obj, monocots
32 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/pinecone.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform as U
9 |
10 | from assets.monocot.pinecone import PineconeFactory
11 | from nodes.node_wrangler import NodeWrangler
12 | from placement.factory import AssetFactory, make_asset_collection
13 | from placement.instance_scatter import scatter_instances
14 |
15 | from surfaces.scatters.chopped_trees import approx_settle_transform
16 |
17 | def apply(obj, n=5, selection=None):
18 | n_species = np.random.randint(2, 3)
19 | factories = [PineconeFactory(np.random.randint(1e5)) for i in range(n_species)]
20 | pinecones = make_asset_collection(
21 | factories, n=n, verbose=True,
22 | weights=np.random.uniform(0.5, 1, len(factories)))
23 |
24 | for o in pinecones.objects:
25 | approx_settle_transform(o, samples=30)
26 |
27 | d = np.deg2rad(90)
28 | ar = np.deg2rad(20)
29 | scatter_obj = scatter_instances(
30 | base_obj=obj, collection=pinecones,
31 | vol_density=U(0.05, 0.25), min_spacing=0.05,
32 | rotation_offset=lambda nw: nw.uniform((d-ar, -ar, -ar), (d+ar, ar, ar)),
33 | scale=U(0.05, 0.8), scale_rand=U(0.2, 0.8), scale_rand_axi=U(0, 0.1),
34 | selection=selection, taper_density=True)
35 |
36 | return scatter_obj, pinecones
37 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/rocks.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Alexander Raistrick
5 |
6 |
7 | import bpy
8 | from mathutils import Vector
9 | import numpy as np
10 | from numpy.random import uniform as U
11 |
12 | from nodes.node_wrangler import Nodes
13 | from placement.instance_scatter import scatter_instances
14 | from placement.factory import AssetFactory, make_asset_collection
15 |
16 | from surfaces import surface
17 | from util import blender as butil
18 | from assets.blender_rock import BlenderRockFactory
19 |
20 | bpy.ops.preferences.addon_enable(module='add_mesh_extra_objects')
21 |
22 | def apply(obj, n=5, detail=3, selection=None, **kwargs):
23 |
24 | fac = BlenderRockFactory(np.random.randint(1e5), detail=detail)
25 | rocks = make_asset_collection(fac, n=n)
26 |
27 | surface.registry('rock_collection').apply(list(rocks.objects))
28 |
29 | scatter_obj = scatter_instances(
30 | base_obj=obj, collection=rocks,
31 | vol_density=U(0.05, 0.4), ground_offset=0.03,
32 | scale=U(0.05, 1), scale_rand=U(0.75, 0.95), scale_rand_axi=U(0.4, 0.6),
33 | selection=selection, taper_density=True)
34 |
35 | return scatter_obj, rocks
36 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/seashells.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform as U
9 |
10 | from assets.mollusk import MolluskFactory
11 | from placement.factory import AssetFactory, make_asset_collection
12 | from placement.instance_scatter import scatter_instances
13 | from surfaces.scatters.chopped_trees import approx_settle_transform
14 |
15 | from util.random import random_general as rg
16 |
17 | def apply(obj, density=('uniform', 0.2, 1.7), n=10, selection=None):
18 | n_species = np.random.randint(4, 6)
19 | factories = list(MolluskFactory(np.random.randint(1e5)) for _ in range(n_species))
20 | mollusk = make_asset_collection(
21 | factories, name='mollusk', verbose=True,
22 | weights=np.random.uniform(0.5, 1, len(factories)), n=n)
23 |
24 | #for o in mollusk.objects:
25 | # approx_settle_transform(o, samples=30)
26 |
27 | scatter_obj = scatter_instances(
28 | base_obj=obj, collection=mollusk,
29 | vol_density=rg(density),
30 | scale=U(0.1, 0.4), scale_rand=U(0.5, 0.9), scale_rand_axi=U(0.1, 0.5),
31 | selection=selection, taper_density=True,
32 | ground_offset=lambda nw: nw.uniform(0.07, .2)
33 | )
34 |
35 | return scatter_obj, mollusk
36 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/seaweed.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform as U
9 |
10 | from assets.seaweed import SeaweedFactory
11 | from nodes.node_wrangler import NodeWrangler
12 | from placement.camera import ng_dist2camera
13 | from placement.instance_scatter import scatter_instances
14 | from placement.factory import AssetFactory, make_asset_collection
15 |
16 |
17 | def apply(obj, scale=1, density=1., n=5, selection=None, **kwargs):
18 | n_species = np.random.randint(2, 3)
19 | factories = [SeaweedFactory(np.random.randint(1e5)) for i in range(n_species)]
20 | seaweeds = make_asset_collection(factories, name='seaweed',
21 | weights=np.random.uniform(0.5, 1, len(factories)), n=n,
22 | verbose=True, **kwargs)
23 |
24 | scatter_obj = scatter_instances(
25 | base_obj=obj, collection=seaweeds,
26 | vol_density=U(2, 10), min_spacing=0.02,
27 | scale=U(0.2, 1), scale_rand=U(0.1, 0.9), scale_rand_axi=U(0, 0.2),
28 | normal_fac=0.3,
29 | selection=selection)
30 |
31 | return scatter_obj, seaweeds
32 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/snow_layer.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | import bpy
8 | import mathutils
9 |
10 | from numpy.random import uniform, normal
11 |
12 | from nodes.node_wrangler import Nodes, NodeWrangler
13 | from surfaces import surface
14 | from util import blender as butil
15 | from nodes import node_utils
16 |
17 | from infinigen_gpl.surfaces import snow
18 | from assets.utils.tag import tag_object, tag_nodegroup
19 |
20 | class Snowlayer:
21 | def __init__(self):
22 | pass
23 |
24 | def apply(self, obj, **kwargs):
25 | bpy.context.scene.snow.height = 0.1
26 | with butil.SelectObjects(obj):
27 | bpy.ops.snow.create()
28 | snow = bpy.context.active_object
29 | tag_object(snow, "snow")
30 | tag_object(snow, "boulder")
31 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/urchin.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform as U
9 |
10 | from assets.urchin import UrchinFactory
11 | from nodes.node_wrangler import NodeWrangler
12 | from placement.factory import AssetFactory, make_asset_collection
13 | from placement.camera import ng_dist2camera
14 | from placement.instance_scatter import scatter_instances
15 |
16 |
17 | def apply(obj, n=5, selection=None):
18 | n_species = np.random.randint(2, 3)
19 | factories = list(UrchinFactory(np.random.randint(1e5)) for i in range(n_species))
20 | urchin = make_asset_collection(factories, name='urchin',
21 | weights=np.random.uniform(0.5, 1, len(factories)), n=n,
22 | verbose=True)
23 |
24 | scale = U(0.1, 0.8)
25 |
26 | def ground_offset(nw: NodeWrangler):
27 | return nw.uniform(.4 * scale, .8 * scale)
28 |
29 | scatter_obj = scatter_instances(
30 | base_obj=obj, collection=urchin,
31 | vol_density=U(0.5, 2), ground_offset=ground_offset,
32 | scale=scale, scale_rand=U(0.2, 0.4),
33 | selection=selection)
34 |
35 | return scatter_obj, urchin
36 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/utils/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/surfaces/scatters/utils/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/scatters/utils/selection.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lingjie Mei
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform
9 |
10 | from nodes.node_info import Nodes
11 | from nodes.node_wrangler import NodeWrangler
12 | from util.math import FixedSeed, int_hash
13 |
14 |
15 | def scatter_lower(nw: NodeWrangler, height_range=(.5, 2), fill_range=(.0, .8), noise_scale=.4):
16 | height = uniform(*height_range)
17 | middle = height * uniform(*fill_range)
18 | lower = nw.bernoulli(nw.build_float_curve(nw.separate(nw.new_node(Nodes.InputPosition))[-1],
19 | [(0, 1), (middle, 1), (height, 0)]))
20 | compare = nw.compare('GREATER_THAN', lower,
21 | nw.new_node(Nodes.NoiseTexture, input_kwargs={'Scale': noise_scale}), )
22 | return compare
23 |
24 |
25 | def scatter_upward(nw: NodeWrangler, normal_thresh=np.pi * .75, noise_scale=.4, noise_thresh=.3):
26 | compare = nw.compare('GREATER_THAN', nw.new_node(Nodes.NoiseTexture, input_kwargs={'Scale': noise_scale}),
27 | noise_thresh)
28 | upward = nw.compare_direction('LESS_THAN', nw.new_node(Nodes.InputNormal), (0, 0, 1), normal_thresh)
29 | return nw.boolean_math('AND', compare, upward)
30 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/templates/__init__.py:
--------------------------------------------------------------------------------
1 | from . import *
2 | from infinigen_gpl.surfaces import *
3 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/templates/atmosphere_light_haze.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Alexander Raistrick, Zeyu Ma
5 |
6 |
7 | import numpy as np
8 | from numpy.random import uniform
9 | import gin
10 | from util.random import random_general as rg
11 | from nodes.node_wrangler import Nodes
12 | from nodes import color
13 | from surfaces import surface
14 |
15 | type = None
16 |
17 |
18 | @gin.configurable
19 | def shader_atmosphere(nw, enable_scatter=True, density=("uniform", 0, 0.006), anisotropy=0.5, **kwargs):
20 | nw.force_input_consistency()
21 |
22 | principled_volume = nw.new_node(Nodes.PrincipledVolume,
23 | input_kwargs={
24 | 'Color': color.color_category('fog'),
25 | 'Density': rg(density),
26 | 'Anisotropy': rg(anisotropy)
27 | })
28 |
29 | return (None, principled_volume)
30 |
31 | def apply(obj, selection=None, **kwargs):
32 | surface.add_material(obj, shader_atmosphere, selection=selection)
33 |
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/templates/basic_bsdf.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Alexander Raistrick
5 |
6 |
7 | import bpy
8 | import mathutils
9 |
10 | import numpy as np
11 | from numpy.random import uniform, normal
12 |
13 | from nodes.node_wrangler import Nodes, NodeWrangler
14 | from nodes.color import hsv2rgba
15 | from surfaces import surface
16 |
17 | def shader_basic_bsdf(nw):
18 |
19 | color = nw.new_node(Nodes.RGB)
20 | color.outputs[0].default_value = hsv2rgba(uniform(0.05, 0.95, 3))
21 |
22 | principled_bsdf = nw.new_node(Nodes.PrincipledBSDF,
23 | input_kwargs={
24 | 'Base Color': color,
25 | 'Roughness': np.clip(normal(0.6, 0.3), 0.05, 0.95),
26 | 'Metallic': uniform(0, 1) if uniform() < 0.3 else 0,
27 | 'Subsurface': 0 if uniform() < 0.8 else uniform(0, 0.2)
28 | },
29 | attrs={'subsurface_method': 'BURLEY'})
30 |
31 | material_output = nw.new_node(Nodes.MaterialOutput,
32 | input_kwargs={'Surface': principled_bsdf})
33 |
34 | return principled_bsdf
35 |
36 | def apply(obj, selection=None, **kwargs):
37 | surface.add_material(obj, shader_basic_bsdf, reuse=False)
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/templates/simple_brownish.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Beining Han
5 |
6 |
7 | from numpy.random import uniform as U, normal as N, randint
8 | from nodes.node_wrangler import Nodes, NodeWrangler
9 | from nodes import node_utils
10 | from nodes.color import color_category
11 | from surfaces import surface
12 |
13 |
14 | def shader_simple_brown(nw: NodeWrangler):
15 | # Code generated using version 2.4.3 of the node_transpiler
16 |
17 | def noise():
18 | return nw.new_node(Nodes.NoiseTexture, attrs={'noise_dimensions': '4D'},
19 | input_kwargs={'W': U(0, 100), 'Scale': N(60, 25), 'Detail': U(0, 10), 'Roughness': U(0, 1),
20 | 'Distortion': U(0, 3)})
21 |
22 | rough = nw.new_node(Nodes.MapRange, attrs={'interpolation_type': 'SMOOTHSTEP'},
23 | input_kwargs={'Value': noise(), 3: U(0.1, 0.8), 4: U(0.1, 0.8)})
24 | v = U(0.01, 0.2)
25 | base_color = (v, v * U(0, 0.15), v * U(0, 0.12), 1.)
26 | principled_bsdf = nw.new_node(Nodes.PrincipledBSDF,
27 | input_kwargs={'Base Color': base_color, 'Roughness': rough.outputs["Result"]})
28 |
29 | material_output = nw.new_node(Nodes.MaterialOutput, input_kwargs={'Surface': principled_bsdf})
30 |
31 |
32 | def apply(obj, selection=None, **kwargs):
33 | surface.add_material(obj, shader_simple_brown, selection=selection)
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/templates/simple_whitish.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Beining Han
5 |
6 |
7 | from numpy.random import uniform as U, normal as N, randint
8 | from nodes.node_wrangler import Nodes, NodeWrangler
9 | from nodes import node_utils
10 | from nodes.color import color_category
11 | from surfaces import surface
12 |
13 |
14 | def shader_simple_white(nw: NodeWrangler):
15 | # Code generated using version 2.4.3 of the node_transpiler
16 |
17 | def noise():
18 | return nw.new_node(Nodes.NoiseTexture, attrs={'noise_dimensions': '4D'},
19 | input_kwargs={'W': U(0, 100), 'Scale': N(60, 25), 'Detail': U(0, 10), 'Roughness': U(0, 1),
20 | 'Distortion': U(0, 3)})
21 |
22 | rough = nw.new_node(Nodes.MapRange, attrs={'interpolation_type': 'SMOOTHSTEP'},
23 | input_kwargs={'Value': noise(), 3: U(0.1, 0.8), 4: U(0.1, 0.8)})
24 | v = U(0.7, 1.0)
25 | base_color = (v * (1. + N(0, 0.05)), v * (1. + N(0, 0.05)), v * (1. + N(0, 0.05)), 1.)
26 | principled_bsdf = nw.new_node(Nodes.PrincipledBSDF,
27 | input_kwargs={'Base Color': base_color, 'Roughness': rough.outputs["Result"]})
28 |
29 | material_output = nw.new_node(Nodes.MaterialOutput,
30 | input_kwargs={'Surface': principled_bsdf})
31 |
32 |
33 | def apply(obj, selection=None, **kwargs):
34 | surface.add_material(obj, shader_simple_white, selection=selection)
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/templates/smoke_material.py:
--------------------------------------------------------------------------------
1 |
2 | # Copyright (c) Princeton University.
3 | # This source code is licensed under the BSD 3-clause license found in the LICENSE file in the root directory of this source tree.
4 |
5 | # Authors: Karhan Kayan
6 |
7 | import bpy
8 | import mathutils
9 | from numpy.random import uniform, normal
10 | from nodes.node_wrangler import Nodes, NodeWrangler
11 | from nodes import node_utils
12 | from nodes.color import color_category
13 | from surfaces import surface
14 | import numpy as np
15 | from util.random import random_color_neighbour
16 |
17 | def smoke_material(nw):
18 | # Code generated using version 2.3.2 of the node_transpiler
19 |
20 | principled_volume = nw.new_node(Nodes.PrincipledVolume,
21 | input_kwargs={'Color': random_color_neighbour((0.3803, 0.3803, 0.3803, 1.0)), 'Density': np.random.uniform(1.0, 5.0)})
22 |
23 | material_output = nw.new_node(Nodes.MaterialOutput,
24 | input_kwargs={'Volume': principled_volume})
25 |
26 |
27 |
28 | def apply(obj, selection=None, **kwargs):
29 | surface.add_material(obj, smoke_material, selection=selection)
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/templates/spider_plant.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Beining Han
5 |
6 | from numpy.random import uniform, normal , randint
7 | from nodes.node_wrangler import Nodes, NodeWrangler
8 | from nodes import node_utils
9 | from nodes.color import color_category, hsv2rgba
10 | from surfaces import surface
11 |
12 |
13 | def shader_spider_plant(nw: NodeWrangler):
14 | # Code generated using version 2.4.3 of the node_transpiler
15 |
16 | main_hsv_color = (uniform(0.18, 0.36), uniform(0.70, 0.90), uniform(0.2, 0.3))
17 | main_color = hsv2rgba(main_hsv_color)
18 |
19 | principled_bsdf = nw.new_node(Nodes.PrincipledBSDF,
20 | input_kwargs={'Base Color': main_color, 'Subsurface IOR': 1.01,
21 | 'Roughness': 2.0})
22 |
23 | translucent_bsdf = nw.new_node(Nodes.TranslucentBSDF,
24 | input_kwargs={'Color': main_color})
25 |
26 | mix_shader = nw.new_node(Nodes.MixShader,
27 | input_kwargs={1: principled_bsdf, 2: translucent_bsdf})
28 |
29 | material_output = nw.new_node(Nodes.MaterialOutput,
30 | input_kwargs={'Surface': mix_shader})
31 |
32 |
33 | def apply(obj, selection=None, **kwargs):
34 | surface.add_material(obj, shader_spider_plant, selection=selection)
--------------------------------------------------------------------------------
/infinigen/worldgen/surfaces/templates/tongue.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Alexander Raistrick
5 |
6 |
7 | import bpy
8 | import mathutils
9 | from numpy.random import uniform, normal, randint
10 | from nodes.node_wrangler import Nodes, NodeWrangler
11 | from nodes import node_utils
12 | from nodes.color import color_category
13 | from surfaces import surface
14 |
15 | def shader_tongue(nw: NodeWrangler):
16 | # Code generated using version 2.4.3 of the node_transpiler
17 |
18 | musgrave_texture = nw.new_node(Nodes.MusgraveTexture,
19 | input_kwargs={'Scale': 37.88})
20 |
21 | colorramp = nw.new_node(Nodes.ColorRamp,
22 | input_kwargs={'Fac': musgrave_texture})
23 | colorramp.color_ramp.elements[0].position = 0.24
24 | colorramp.color_ramp.elements[0].color = (0.0, 0.0, 0.0, 1.0)
25 | colorramp.color_ramp.elements[1].position = 1.0
26 | colorramp.color_ramp.elements[1].color = (0.0979, 0.0979, 0.0979, 1.0)
27 |
28 | principled_bsdf = nw.new_node(Nodes.PrincipledBSDF,
29 | input_kwargs={'Base Color': (0.8, 0.0605, 0.0437, 1.0), 'Subsurface': 0.0312, 'Subsurface Color': (0.8, 0.0, 0.2679, 1.0), 'Roughness': colorramp.outputs["Color"]})
30 |
31 | material_output = nw.new_node(Nodes.MaterialOutput,
32 | input_kwargs={'Surface': principled_bsdf})
33 |
34 | def apply(obj, selection=None, **kwargs):
35 | surface.add_material(obj, shader_tongue, selection=selection)
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/.gitignore:
--------------------------------------------------------------------------------
1 | *.obj
2 | set_env.sh
3 | build
4 | trash
5 | *.in
6 | *.out
7 | dev
8 | *.zip
9 | __pycache__
10 | .DS_Store
11 | draft.py
12 | draft.cpp
13 | *egg-info
14 | build
15 | dist
16 | test
17 | Python-3.10.2
18 | *_pyx.cpp
19 | *.so
20 | lib
21 | *.air
22 | *.metallib
23 | dev_install*
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | from .core import Terrain
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/assets/caves/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | from .core import caves_asset, assets_to_data
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/assets/caves/cfg.txt:
--------------------------------------------------------------------------------
1 |
2 | # Starting Symbol
3 | Q (1.0) -> [ A ] Piv180 [ A ]
4 |
5 | # Turning
6 | T (0.5) -> TurnR45
7 | T (0.5) -> TurnL45
8 |
9 | TurnR90 (1.0) -> TurnR45 TurnR45
10 | TurnL90 (1.0) -> TurnL45 TurnL45
11 | Piv180 (1.0) -> l l l l l l l l l l l l
12 |
13 | TurnU75 (1.0) -> u f u f u f u f
14 | TurnD75 (1.0) -> d f d f d f d f
15 | TurnL45 (1.0) -> l f l f l f
16 | TurnR45 (1.0) -> r f r f r f
17 |
18 | # S-Curve
19 | H (0.5) -> TurnU75 TurnD75
20 | H (0.5) -> TurnD75 TurnU75
21 |
22 | # Wildcard
23 | A (0.45) -> S
24 | A (0.45) -> P
25 | A (0.1) -> n
26 |
27 | # Split-offs
28 | S (0.8) -> [ A H A ] A
29 | S (0.1) -> [ TurnL90 A ] A
30 | S (0.1) -> [ TurnR90 A ] A
31 |
32 | # Non Split-offs
33 | P (0.5) -> T A
34 | P (0.5) -> f f f A
35 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/assets/caves/geometry_utils.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Alejandro Newell, Lahav Lipson
5 |
6 |
7 | import numpy as np
8 |
9 |
10 | def get_cos_sin(angle, convert_to_rad=False):
11 | if convert_to_rad:
12 | angle = angle * np.pi / 180
13 | return np.cos(angle), np.sin(angle)
14 |
15 |
16 | def rodrigues_rot(vec, axis, angle, convert_to_rad=False):
17 | axis = axis / np.linalg.norm(axis)
18 | cs, sn = get_cos_sin(angle, convert_to_rad)
19 | return vec * cs + sn * np.cross(axis, vec) + axis * np.dot(axis, vec) * (1 - cs)
20 |
21 |
22 | def yaw_clockwise(current_dir, angle_magnitude):
23 | axis = np.array((0, 0, 1))
24 | return rodrigues_rot(current_dir, axis, -angle_magnitude, True)
25 |
26 |
27 | def pitch_up(current_dir, angle_magnitude):
28 | axis = np.array((0, 1, 0))
29 | return rodrigues_rot(current_dir, axis, -angle_magnitude, True)
30 |
31 |
32 | def increment_step(current_dir, amount):
33 | mag = np.sqrt(np.sum(np.power(current_dir, 2)))
34 | unit_dir = current_dir / mag
35 | output = current_dir + unit_dir*amount
36 | return output if np.sum(np.power(output, 2)) > 0 else current_dir
37 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/assets/landtiles/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | from .core import assets_to_data, landtile_asset
8 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/elements/atmosphere.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | import gin
8 | import numpy as np
9 | from numpy import ascontiguousarray as AC
10 | from util.organization import Materials, Transparency, ElementNames
11 |
12 | from .core import Element
13 |
14 | @gin.configurable
15 | class Atmosphere(Element):
16 | name = ElementNames.Atmosphere
17 | def __init__(
18 | self,
19 | device,
20 | waterbody,
21 | height=130,
22 | spherical_radius=-1,
23 | hacky_offset=0,
24 | material=Materials.Atmosphere,
25 | transparency=Transparency.IndividualTransparent,
26 | ):
27 | self.device = device
28 | self.int_params = AC(np.array([], dtype=np.int32))
29 | self.float_params = AC(np.array([height, spherical_radius, hacky_offset], dtype=np.float32))
30 | if waterbody is not None:
31 | self.int_params2 = waterbody.int_params
32 | self.float_params2 = waterbody.float_params
33 |
34 | self.meta_params = [waterbody is not None]
35 | Element.__init__(self, "atmosphere", material, transparency)
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/elements/waterbody.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | import gin
8 | import numpy as np
9 | from numpy import ascontiguousarray as AC
10 | from util.organization import Materials, Transparency, ElementNames, ElementTag, Attributes
11 |
12 | from .core import Element
13 |
14 |
15 | @gin.configurable
16 | class Waterbody(Element):
17 | name = ElementNames.Liquid
18 | def __init__(
19 | self,
20 | device,
21 | landtiles,
22 | height=0,
23 | spherical_radius=-1,
24 | material=Materials.LiquidCollection,
25 | transparency=Transparency.IndividualTransparent,
26 | ):
27 | self.device = device
28 | self.height = height
29 |
30 | self.int_params = AC(np.zeros(0, dtype=np.int32))
31 | self.float_params = AC(np.array([height, spherical_radius], dtype=np.float32))
32 | self.meta_params = [landtiles is not None]
33 | if landtiles is not None:
34 | self.int_params2 = landtiles.int_params
35 | self.float_params2 = landtiles.float_params
36 | self.int_params3 = landtiles.int_params2
37 | self.float_params3 = landtiles.float_params2
38 | self.meta_params.append(landtiles.meta_params[0])
39 | self.aux_names = [Attributes.BoundarySDF]
40 | else:
41 | self.aux_names = [None]
42 |
43 | Element.__init__(self, "waterbody", material, transparency)
44 | self.tag = ElementTag.Liquid
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/marching_cubes/.gitignore:
--------------------------------------------------------------------------------
1 | *.c
2 | test.py
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/mesh_to_sdf/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Marian Kleineberg
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/mesh_to_sdf/shaders/mesh.frag:
--------------------------------------------------------------------------------
1 | # COPYRIGHT
2 |
3 | # Original files authored by Marian Kleineberg: https://github.com/marian42/mesh_to_sdf/tree/master
4 |
5 | #version 330 core
6 |
7 | in vec3 frag_position;
8 | in vec3 frag_normal;
9 |
10 | out vec4 frag_color;
11 |
12 | void main()
13 | {
14 | vec3 normal = normalize(frag_normal);
15 |
16 | frag_color = vec4(normal * 0.5 + 0.5, 1.0);
17 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/mesh_to_sdf/shaders/mesh.vert:
--------------------------------------------------------------------------------
1 | # COPYRIGHT
2 |
3 | # Original files authored by Marian Kleineberg: https://github.com/marian42/mesh_to_sdf/tree/master
4 |
5 | #version 330 core
6 |
7 | // Vertex Attributes
8 | layout(location = 0) in vec3 position;
9 | layout(location = NORMAL_LOC) in vec3 normal;
10 | layout(location = INST_M_LOC) in mat4 inst_m;
11 |
12 | // Uniforms
13 | uniform mat4 M;
14 | uniform mat4 V;
15 | uniform mat4 P;
16 |
17 | // Outputs
18 | out vec3 frag_position;
19 | out vec3 frag_normal;
20 |
21 | void main()
22 | {
23 | gl_Position = P * V * M * inst_m * vec4(position, 1);
24 | frag_position = vec3(M * inst_m * vec4(position, 1.0));
25 |
26 | mat4 N = transpose(inverse(M * inst_m));
27 | frag_normal = normalize(vec3(N * vec4(normal, 0.0)));
28 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/mesher/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | from .uniform_mesher import UniformMesher
8 | from .spherical_mesher import OpaqueSphericalMesher, TransparentSphericalMesher
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/setup.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | # Copyright: 2009-2022 the scikit-image team
4 | # License: BSD-3-Clause
5 | # adapted by Zeyu Ma to avoid precision loss for large grids to achieve local determinism,
6 | # therefore to make seamless stiched mesh
7 |
8 | from skimage._build import cython
9 |
10 | import os
11 | base_path = os.path.abspath(os.path.dirname(__file__))
12 |
13 |
14 | def configuration(parent_package='', top_path=None):
15 | from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
16 |
17 | config = Configuration('marching_cubes', parent_package, top_path)
18 |
19 | cython(['marching_cubes/_marching_cubes_lewiner_cy.pyx'], working_path=base_path)
20 |
21 | config.add_extension('_marching_cubes_lewiner_cy',
22 | sources=['marching_cubes/_marching_cubes_lewiner_cy.c'],
23 | include_dirs=[get_numpy_include_dirs()])
24 |
25 |
26 | return config
27 |
28 | if __name__ == '__main__':
29 | from numpy.distutils.core import setup
30 | setup(maintainer='scikit-image Developers',
31 | maintainer_email='scikit-image@python.org',
32 | description='Graph-based Image-processing Algorithms',
33 | url='https://github.com/scikit-image/scikit-image',
34 | license='Modified BSD',
35 | **(configuration(top_path='').todict())
36 | )
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/common/elements/atmosphere.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | DEVICE_FUNC void atmosphere(
8 | float3_nonbuiltin position,
9 | float *sdf,
10 | int has_water,
11 | int *i_params, float *f_params,
12 | int *waterbody_i_params, float *waterbody_f_params
13 | ) {
14 | /* params
15 | int:
16 |
17 | float:
18 | height, spherical_radius, hacky_offset
19 | */
20 |
21 | float height = f_params[0];
22 | float spherical_radius = f_params[1];
23 | float hacky_offset = f_params[2];
24 |
25 | float altitude;
26 | if (spherical_radius > 0) {
27 | altitude = sqrt(position.x * position.x + position.y * position.y + position.z * position.z) - spherical_radius;
28 | }
29 | else {
30 | altitude = position.z;
31 | }
32 | if (has_water == 0) {
33 | *sdf = altitude - height;
34 | }
35 | else {
36 | waterbody(position, sdf, NULL, 0, 0, waterbody_i_params, waterbody_f_params, NULL, NULL, NULL, NULL);
37 | *sdf = fmaxf(altitude - height, -*sdf + hacky_offset);
38 | }
39 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/common/elements/waterbody.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | DEVICE_FUNC void waterbody(
8 | float3_nonbuiltin position,
9 | float *sdf,
10 | float *boundary_sdf,
11 | int mark_boundary, int is_caved,
12 | int *i_params, float *f_params,
13 | int *landtiles_i_params, float *landtiles_f_params,
14 | int *caves_i_params, float *caves_f_params
15 | ) {
16 | /* params
17 |
18 | float:
19 | height, spherical_radius
20 | */
21 | float height = f_params[0];
22 | float spherical_radius = f_params[1];
23 | float altitude;
24 | if (spherical_radius > 0) {
25 | altitude = sqrt(position.x * position.x + position.y * position.y + position.z * position.z) - spherical_radius;
26 | }
27 | else {
28 | altitude = position.z;
29 | }
30 | *sdf = altitude - height;
31 | if (boundary_sdf != NULL) {
32 | if (!mark_boundary) *boundary_sdf = 0;
33 | else {
34 | landtiles(
35 | position, boundary_sdf, 0, is_caved,
36 | landtiles_i_params, landtiles_f_params,
37 | caves_i_params, caves_f_params
38 | );
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/common/utils/smooth_bool_ops.h:
--------------------------------------------------------------------------------
1 | // The MIT License
2 | // Copyright © 2018 Inigo Quilez
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 | // adopted by Zeyu Ma to compile terrain elements
5 |
6 | DEVICE_FUNC float smooth_union(float d1, float d2, float k) {
7 | float h = max(k - abs(d1 - d2), 0.0f);
8 | return min(d1, d2) - h*h*0.25/ k;
9 | }
10 |
11 | DEVICE_FUNC float smooth_subtraction(float d1, float d2, float k)
12 | {
13 | return -smooth_union(d2, -d1, k);
14 | }
15 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/elements/atmosphere.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 |
9 |
10 | extern "C" {
11 | void call(
12 | size_t size,
13 | float3_nonbuiltin *positions,
14 | float *sdfs
15 | ) {
16 | using namespace data;
17 | #pragma omp parallel for
18 | for (size_t idx = 0; idx < size; idx++) {
19 | atmosphere(
20 | positions[idx], sdfs + idx, meta_param,
21 | d_i_params, d_f_params, second_d_i_params, second_d_f_params
22 | );
23 |
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/elements/core.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | namespace data {
8 | int meta_param, second_meta_param;
9 | int *d_i_params=NULL, *second_d_i_params=NULL, *third_d_i_params=NULL;
10 | float *d_f_params=NULL, *second_d_f_params=NULL, *third_d_f_params=NULL;
11 | }
12 |
13 | extern "C" {
14 | void init(
15 | int meta_param_, int second_meta_param_,
16 | size_t i_size, int *i_params, size_t f_size, float *f_params,
17 | size_t second_i_size, int *second_i_params, size_t second_f_size, float *second_f_params,
18 | size_t third_i_size, int *third_i_params, size_t third_f_size, float *third_f_params
19 | ) {
20 | using namespace data;
21 | meta_param = meta_param_;
22 | second_meta_param = second_meta_param_;
23 | if (i_size > 0) {
24 | d_i_params = i_params;
25 | }
26 | if (f_size > 0) {
27 | d_f_params = f_params;
28 | }
29 | if (second_i_size > 0) {
30 | second_d_i_params = second_i_params;
31 | }
32 | if (second_f_size > 0) {
33 | second_d_f_params = second_f_params;
34 | }
35 | if (third_i_size > 0) {
36 | third_d_i_params = third_i_params;
37 | }
38 | if (third_f_size > 0) {
39 | third_d_f_params = third_f_params;
40 | }
41 | }
42 |
43 | void cleanup() {
44 | }
45 |
46 |
47 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/elements/ground.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 |
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float *sdfs,
16 | float *auxs
17 | ) {
18 | using namespace data;
19 | int n_auxiliaries = 1;
20 | if (auxs == NULL) n_auxiliaries = 0;
21 | #pragma omp parallel for
22 | for (size_t idx = 0; idx < size; idx++) {
23 | ground(
24 | positions[idx], sdfs + idx, auxs + n_auxiliaries * idx, meta_param,
25 | d_i_params, d_f_params, second_d_i_params, second_d_f_params
26 | );
27 | }
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/elements/header.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include
8 | #include
9 | #include
10 | using namespace std;
11 | #define DEVICE_FUNC
12 | #define CONSTANT_ARRAY const
13 | #include "../../common/utils/vectors.h"
14 | #include "../../../../infinigen_gpl/bnodes/utils/nodes_util.h"
15 | #include "../../../../infinigen_gpl/bnodes/utils/blender_noise.h"
16 | #include "../../common/utils/elements_util.h"
17 | #include "../../common/utils/FastNoiseLite.h"
18 | #include "../../common/utils/smooth_bool_ops.h"
19 | #include "../../common/elements/caves.h"
20 | #include "../../common/elements/landtiles.h"
21 | #include "../../common/elements/ground.h"
22 | #include "../../common/elements/voronoi_rocks.h"
23 | #include "../../common/elements/warped_rocks.h"
24 | #include "../../common/elements/upsidedown_mountains.h"
25 | #include "../../common/elements/mountains.h"
26 | #include "../../common/elements/waterbody.h"
27 | #include "../../common/elements/atmosphere.h"
28 | #include "core.cpp"
29 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/elements/landtiles.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 |
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float *sdfs,
16 | float *auxs
17 | ) {
18 | using namespace data;
19 | int n_auxiliaries = 3;
20 | if (auxs == NULL) n_auxiliaries = 0;
21 | #pragma omp parallel for
22 | for (size_t idx = 0; idx < size; idx++) {
23 | landtiles(
24 | positions[idx], sdfs + idx, auxs + n_auxiliaries * idx, meta_param,
25 | d_i_params, d_f_params, second_d_i_params, second_d_f_params
26 | );
27 | }
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/elements/mountains.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 |
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float *sdfs
16 | ) {
17 | using namespace data;
18 | #pragma omp parallel for
19 | for (size_t idx = 0; idx < size; idx++) {
20 | mountains(positions[idx], sdfs + idx, d_i_params, d_f_params);
21 | }
22 | }
23 |
24 |
25 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/elements/upsidedown_mountains.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 |
9 |
10 | extern "C" {
11 | void call(
12 | size_t size,
13 | float3_nonbuiltin *positions,
14 | float *sdfs,
15 | float *auxs
16 | ) {
17 | using namespace data;
18 | int n_auxiliaries = 1;
19 | if (auxs == NULL) n_auxiliaries = 0;
20 | #pragma omp parallel for
21 | for (size_t idx = 0; idx < size; idx++) {
22 | upsidedown_mountains(positions[idx], sdfs + idx, auxs + n_auxiliaries * idx, d_i_params, d_f_params);
23 | }
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/elements/voronoi_rocks.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 |
9 | extern "C" {
10 |
11 | void call(
12 | size_t size,
13 | float3_nonbuiltin *positions,
14 | float *sdfs,
15 | float *auxs
16 | ) {
17 | using namespace data;
18 | int n_auxiliaries = 2;
19 | if (auxs == NULL) n_auxiliaries = 0;
20 | #pragma omp parallel for
21 | for (size_t idx = 0; idx < size; idx++) {
22 | voronoi_rocks(
23 | positions[idx], sdfs + idx, auxs + n_auxiliaries * idx, meta_param, second_meta_param,
24 | d_i_params, d_f_params, second_d_i_params, second_d_f_params, third_d_i_params, third_d_f_params
25 | );
26 | }
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/elements/warped_rocks.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 |
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float *sdfs,
16 | float *auxs
17 | ) {
18 | using namespace data;
19 | int n_auxiliaries = 1;
20 | if (auxs == NULL) n_auxiliaries = 0;
21 | #pragma omp parallel for
22 | for (size_t idx = 0; idx < size; idx++) {
23 | warped_rocks(
24 | positions[idx], sdfs + idx, auxs + n_auxiliaries * idx, meta_param,
25 | d_i_params, d_f_params, second_d_i_params, second_d_f_params
26 | );
27 | }
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/elements/waterbody.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 |
9 | extern "C" {
10 | void call(
11 | size_t size,
12 | float3_nonbuiltin *positions,
13 | float *sdfs,
14 | float *auxs
15 | ) {
16 | using namespace data;
17 | int n_auxiliaries = 1;
18 | if (auxs == NULL) n_auxiliaries = 0;
19 | #pragma omp parallel for
20 | for (size_t idx = 0; idx < size; idx++) {
21 | waterbody(
22 | positions[idx], sdfs + idx, auxs + n_auxiliaries * idx, meta_param, second_meta_param,
23 | d_i_params, d_f_params, second_d_i_params, second_d_f_params, third_d_i_params, third_d_f_params
24 | );
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/soil_machine/soil/README.md:
--------------------------------------------------------------------------------
1 | # SoilMachine
2 |
3 | ## .soil files
4 |
5 | This represents a really simple file format that lets you pre-define a set of soils which are loaded into the simulation at runtime. The goal is to be able to play with parameters and soil-cascades without needing to recompile.
6 |
7 | ## definition
8 |
9 | todo (read the .default file)
10 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/soil_machine/soil/default.soil:
--------------------------------------------------------------------------------
1 | # SoilMachine Soil File
2 |
3 | #============
4 | # World
5 | #============
6 |
7 | WORLD {
8 |
9 | #SEED 0
10 |
11 | SCALE 80
12 | SIZEX 256
13 | SIZEY 256
14 |
15 |
16 | }
17 |
18 | #============
19 | # Rock
20 | #============
21 |
22 | SOIL Rock {
23 |
24 | TRANSPORTS Rock
25 | ERODES Rock
26 | ABRADES Rock
27 | CASCADES Rock
28 |
29 | DENSITY 0.95
30 | COLOR 444444
31 |
32 | Ka 0.5
33 | Kd 0.8
34 | Ks 0.2
35 | Kk 8.0
36 |
37 | POROSITY 0.0
38 | SOLUBILITY 1.0
39 | EQUILIBRIUM 0.1
40 | FRICTION 0.15
41 |
42 | EROSIONRATE 0.0
43 |
44 | MAXDIFF 0.01
45 | SETTLING 0.1
46 |
47 | SUSPENSION 0.0
48 | ABRASION 0.0
49 |
50 | }
51 |
52 | LAYER Rock {
53 |
54 | MIN 0.0
55 | BIAS 0.5
56 | SCALE 0.8
57 |
58 | OCTAVES 8.0
59 | LACUNARITY 2.0
60 | GAIN 0.5
61 | FREQUENCY 1.0
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/soil_machine/soil/rocksand.soil:
--------------------------------------------------------------------------------
1 | # SoilMachine Soil File
2 |
3 | #============
4 | # World
5 | #============
6 |
7 | WORLD {
8 |
9 | #SEED 0
10 |
11 | SCALE 80
12 | SIZEX 256
13 | SIZEY 256
14 |
15 | NWATER 250
16 | NWIND 100
17 |
18 | }
19 |
20 | #============
21 | # Rock
22 | #============
23 |
24 | SOIL Rock {
25 |
26 | TRANSPORTS Rock
27 | ERODES Rock
28 | ABRADES Rock
29 | CASCADES Rock
30 |
31 | DENSITY 0.95
32 | COLOR 444444
33 |
34 | POROSITY 0.0
35 | SOLUBILITY 1.0
36 | EQUILIBRIUM 0.1
37 | FRICTION 0.15
38 |
39 | EROSIONRATE 0.0
40 |
41 | MAXDIFF 0.01
42 | SETTLING 0.1
43 |
44 | SUSPENSION 0.0
45 | ABRASION 0.0
46 |
47 | }
48 |
49 | LAYER Rock {
50 |
51 | MIN 0.0
52 | BIAS 0.5
53 | SCALE 0.8
54 |
55 | OCTAVES 8.0
56 | LACUNARITY 2.0
57 | GAIN 0.5
58 | FREQUENCY 1.0
59 |
60 | }
61 |
62 |
63 | #==============
64 | # RED SAND
65 | #==============
66 |
67 | SOIL Red Sand {
68 |
69 | TRANSPORTS Red Sand
70 | ERODES Red Sand
71 | ABRADES Red Sand
72 | CASCADES Red Sand
73 |
74 | DENSITY 0.4
75 | COLOR E0A26D
76 |
77 | POROSITY 0.8
78 | SOLUBILITY 1.0
79 | EQUILIBRIUM 0.1
80 | FRICTION 0.1
81 |
82 | EROSIONRATE 0.0
83 |
84 | MAXDIFF 0.005
85 | SETTLING 0.05
86 |
87 | SUSPENSION 0.01
88 | ABRASION 0.0
89 |
90 | Ka 0.5
91 | Kd 0.8
92 | Ks 0.5
93 | Kk 8.0
94 |
95 | }
96 |
97 | LAYER Red Sand {
98 |
99 | MIN 0.0
100 | BIAS 0.0
101 | SCALE 0.4
102 |
103 | OCTAVES 6.0
104 | LACUNARITY 2.0
105 | GAIN 0.4
106 | FREQUENCY 2.0
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/soil_machine/soil/sand.soil:
--------------------------------------------------------------------------------
1 | # SoilMachine Soil File
2 |
3 | #============
4 | # World
5 | #============
6 |
7 | WORLD {
8 |
9 | #SEED 0
10 |
11 | SCALE 80
12 | SIZEX 256
13 | SIZEY 256
14 |
15 | NWATER 50
16 | NWIND 250
17 |
18 | }
19 |
20 | #==============
21 | # RED SAND
22 | #==============
23 |
24 | SOIL Red Sand {
25 |
26 | TRANSPORTS Red Sand
27 | ERODES Red Sand
28 | ABRADES Red Sand
29 | CASCADES Red Sand
30 |
31 | DENSITY 0.4
32 | COLOR E0A26D
33 |
34 | POROSITY 0.8
35 | SOLUBILITY 1.0
36 | EQUILIBRIUM 0.1
37 | FRICTION 0.1
38 |
39 | EROSIONRATE 0.0
40 |
41 | MAXDIFF 0.005
42 | SETTLING 0.05
43 |
44 | SUSPENSION 0.01
45 | ABRASION 0.0
46 |
47 | }
48 |
49 | LAYER Red Sand {
50 |
51 | MIN 0.0
52 | BIAS 0.5
53 | SCALE 0.4
54 |
55 | OCTAVES 6.0
56 | LACUNARITY 2.0
57 | GAIN 0.4
58 | FREQUENCY 2.0
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/chunkyrock.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/chunkyrock.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | size_t n_f3_params, float3_nonbuiltin *f3_params,
18 | size_t n_f4_params, float4_nonbuiltin *f4_params,
19 | float3_nonbuiltin *offsets
20 | ) {
21 | #pragma omp parallel for
22 | for (size_t idx = 0; idx < size; idx++) {
23 | geo_rocks(
24 | positions[idx], normals[idx], f_params, f3_params, f4_params,
25 | offsets + idx
26 | );
27 | }
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/cobble_stone.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/cobble_stone.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | size_t n_f4_params, float4_nonbuiltin *f4_params,
18 | float3_nonbuiltin *offsets
19 | ) {
20 | #pragma omp parallel for
21 | for (size_t idx = 0; idx < size; idx++) {
22 | geo_cobblestone(
23 | positions[idx], normals[idx], f_params, f4_params,
24 | offsets + idx
25 | );
26 | }
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/cracked_ground.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/cracked_ground.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | float3_nonbuiltin *offsets
18 | ) {
19 | #pragma omp parallel for
20 | for (size_t idx = 0; idx < size; idx++) {
21 | geo_cracked_ground(
22 | positions[idx], normals[idx], f_params,
23 | offsets + idx
24 | );
25 | }
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/dirt.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/dirt.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | size_t n_f3_params, float3_nonbuiltin *f3_params,
18 | float3_nonbuiltin *offsets
19 | ) {
20 | #pragma omp parallel for
21 | for (size_t idx = 0; idx < size; idx++) {
22 | geo_dirt(
23 | positions[idx], normals[idx], f_params, f3_params,
24 | offsets + idx
25 | );
26 | }
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/header.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include
8 | #include
9 | #include
10 | using namespace std;
11 | #define DEVICE_FUNC
12 | #define CONSTANT_ARRAY const
13 | #define POINTER_OR_REFERENCE_ARG
14 | #include "../../common/utils/vectors.h"
15 | #include "../../../../infinigen_gpl/bnodes/utils/nodes_util.h"
16 | #include "../../../../infinigen_gpl/bnodes/utils/blender_noise.h"
17 | #include "../../../../infinigen_gpl/bnodes/nodes/node_shader_tex_noise.h"
18 | #include "../../../../infinigen_gpl/bnodes/nodes/node_shader_tex_voronoi.h"
19 | #include "../../../../infinigen_gpl/bnodes/nodes/node_shader_mix_rgb.h"
20 | #include "../../../../infinigen_gpl/bnodes/nodes/node_float_curve.h"
21 | #include "../../../../infinigen_gpl/bnodes/nodes/node_shader_map_range.h"
22 | #include "../../../../infinigen_gpl/bnodes/nodes/node_shader_sepcomb_xyz.h"
23 | #include "../../../../infinigen_gpl/bnodes/nodes/node_shader_tex_wave.h"
24 | #include "../../../../infinigen_gpl/bnodes/nodes/node_shader_vector_math.h"
25 | #include "../../../../infinigen_gpl/bnodes/nodes/node_texture_math.h"
26 | #include "../../../../infinigen_gpl/bnodes/nodes/node_texture_valToRgb.h"
27 | #include "../../../../infinigen_gpl/bnodes/nodes/node_shader_tex_musgrave.h"
28 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/ice.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/ice.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | float3_nonbuiltin *offsets
18 | ) {
19 | #pragma omp parallel for
20 | for (size_t idx = 0; idx < size; idx++) {
21 | geo_ice(
22 | positions[idx], normals[idx], f_params,
23 | offsets + idx
24 | );
25 | }
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/mountain.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/mountain.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | size_t n_f3_params, float3_nonbuiltin *f3_params,
18 | float3_nonbuiltin *offsets
19 | ) {
20 | #pragma omp parallel for
21 | for (size_t idx = 0; idx < size; idx++) {
22 | geo_MOUNTAIN(
23 | positions[idx], normals[idx], f_params, f3_params,
24 | offsets + idx
25 | );
26 | }
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/mud.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/mud.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | float3_nonbuiltin *offsets
18 | ) {
19 | #pragma omp parallel for
20 | for (size_t idx = 0; idx < size; idx++) {
21 | geo_mud(
22 | positions[idx], normals[idx], f_params,
23 | offsets + idx
24 | );
25 | }
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/sand.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/sand.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | size_t n_f3_params, float3_nonbuiltin *f3_params,
18 | float3_nonbuiltin *offsets
19 | ) {
20 | #pragma omp parallel for
21 | for (size_t idx = 0; idx < size; idx++) {
22 | geo_SAND(
23 | positions[idx], normals[idx], f_params, f3_params,
24 | offsets + idx
25 | );
26 | }
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/sandstone.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/sandstone.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | size_t n_f3_params, float3_nonbuiltin *f3_params,
18 | float3_nonbuiltin *offsets
19 | ) {
20 | #pragma omp parallel for
21 | for (size_t idx = 0; idx < size; idx++) {
22 | geometry_sandstone(
23 | positions[idx], normals[idx], f_params, f3_params,
24 | offsets + idx
25 | );
26 | }
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/snow.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/snow.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | float3_nonbuiltin *offsets
17 | ) {
18 | #pragma omp parallel for
19 | for (size_t idx = 0; idx < size; idx++) {
20 | geo_snowtexture(
21 | positions[idx], normals[idx],
22 | offsets + idx
23 | );
24 | }
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/soil.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/soil.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | size_t n_f4_params, float4_nonbuiltin *f4_params,
18 | float3_nonbuiltin *offsets
19 | ) {
20 | #pragma omp parallel for
21 | for (size_t idx = 0; idx < size; idx++) {
22 | geometry_soil(
23 | positions[idx], normals[idx], f_params, f4_params,
24 | offsets + idx
25 | );
26 | }
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/surfaces/stone.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/stone.h"
9 |
10 | extern "C" {
11 |
12 | void call(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | size_t n_f_params, float *f_params,
17 | size_t n_f3_params, float3_nonbuiltin *f3_params,
18 | size_t n_f4_params, float4_nonbuiltin *f4_params,
19 | float3_nonbuiltin *offsets
20 | ) {
21 | #pragma omp parallel for
22 | for (size_t idx = 0; idx < size; idx++) {
23 | geo_stone(
24 | positions[idx], normals[idx], f_params, f3_params, f4_params,
25 | offsets + idx
26 | );
27 | }
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cpu/utils/FastNoiseLite.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include
8 | using namespace std;
9 | #define DEVICE_FUNC
10 | #define CONSTANT_ARRAY const
11 | #include "../../common/utils/vectors.h"
12 | #include "../../common/utils/FastNoiseLite.h"
13 |
14 |
15 | extern "C" {
16 |
17 | void perlin_call(
18 | size_t size,
19 | float3_nonbuiltin *positions,
20 | float *values,
21 | int seed, int octaves, float freq
22 | ) {
23 | for (size_t idx = 0; idx < size; idx++) {
24 | values[idx] = Perlin(positions[idx].x, positions[idx].y, positions[idx].z, seed, octaves, freq);
25 | }
26 | }
27 |
28 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cuda/elements/atmosphere.cu:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 |
9 |
10 | __global__ void atmosphere_kernel(
11 | size_t size,
12 | float3_nonbuiltin *position,
13 | float *sdfs,
14 | int has_water,
15 | int *i_params, float *f_params,
16 | int *waterbody_i_params, float *waterbody_f_params
17 | ) {
18 | size_t idx = blockIdx.x * blockDim.x + threadIdx.x;
19 | if (idx < size) {
20 | atmosphere(position[idx], sdfs + idx, has_water, i_params, f_params, waterbody_i_params, waterbody_f_params);
21 | }
22 | }
23 |
24 |
25 |
26 | extern "C" {
27 | void call(
28 | size_t size,
29 | float3_nonbuiltin *positions,
30 | float *sdfs
31 | ) {
32 | using namespace data;
33 | float3_nonbuiltin *d_positions;
34 | cudaMalloc((void **)&d_positions, size * sizeof(float3_nonbuiltin));
35 | cudaMemcpy(d_positions, positions, size * sizeof(float3_nonbuiltin), cudaMemcpyHostToDevice);
36 | float *d_sdfs;
37 | cudaMalloc((void **)&d_sdfs, size * sizeof(float));
38 |
39 | atmosphere_kernel<<>>(
40 | size, d_positions, d_sdfs, meta_param,
41 | d_i_params, d_f_params, second_d_i_params, second_d_f_params
42 | );
43 |
44 | cudaMemcpy(sdfs, d_sdfs, size * sizeof(float), cudaMemcpyDeviceToHost);
45 | cudaFree(d_positions);
46 | cudaFree(d_sdfs);
47 | }
48 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cuda/elements/header.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 | using namespace std;
12 | #define DEVICE_FUNC __device__
13 | #define CONSTANT_ARRAY __device__ __constant__
14 | #include "../../common/utils/vectors.h"
15 | #include "../../../../infinigen_gpl/bnodes/utils/nodes_util.h"
16 | #include "../../../../infinigen_gpl/bnodes/utils/blender_noise.h"
17 | #include "../../common/utils/elements_util.h"
18 | #include "../../common/utils/FastNoiseLite.h"
19 | #include "../../common/utils/smooth_bool_ops.h"
20 | #include "../../common/elements/caves.h"
21 | #include "../../common/elements/landtiles.h"
22 | #include "../../common/elements/ground.h"
23 | #include "../../common/elements/voronoi_rocks.h"
24 | #include "../../common/elements/warped_rocks.h"
25 | #include "../../common/elements/upsidedown_mountains.h"
26 | #include "../../common/elements/mountains.h"
27 | #include "../../common/elements/waterbody.h"
28 | #include "../../common/elements/atmosphere.h"
29 | #include "core.cu"
30 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cuda/elements/mountains.cu:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 |
9 |
10 | __global__ void mountains_kernel(
11 | size_t size,
12 | float3_nonbuiltin *position,
13 | float *sdfs,
14 | int *i_params,
15 | float *f_params
16 | ) {
17 | size_t idx = blockIdx.x * blockDim.x + threadIdx.x;
18 | if (idx < size) {
19 | mountains(position[idx], sdfs + idx, i_params, f_params);
20 | }
21 | }
22 |
23 |
24 |
25 | extern "C" {
26 |
27 | void call(
28 | size_t size,
29 | float3_nonbuiltin *positions,
30 | float *sdfs
31 | ) {
32 | using namespace data;
33 | float3_nonbuiltin *d_positions;
34 | cudaMalloc((void **)&d_positions, size * sizeof(float3_nonbuiltin));
35 | cudaMemcpy(d_positions, positions, size * sizeof(float3_nonbuiltin), cudaMemcpyHostToDevice);
36 | float *d_sdfs;
37 | cudaMalloc((void **)&d_sdfs, size * sizeof(float));
38 | mountains_kernel<<>>(size, d_positions, d_sdfs, d_i_params, d_f_params);
39 | cudaMemcpy(sdfs, d_sdfs, size * sizeof(float), cudaMemcpyDeviceToHost);
40 | cudaFree(d_positions);
41 | cudaFree(d_sdfs);
42 | }
43 |
44 |
45 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cuda/surfaces/mud.cu:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/mud.h"
9 |
10 | __global__ void mud_kernel(
11 | size_t size,
12 | float3_nonbuiltin *positions,
13 | float3_nonbuiltin *normals,
14 | float *f_params,
15 | float3_nonbuiltin *offsets
16 | ) {
17 | size_t idx = blockIdx.x * blockDim.x + threadIdx.x;
18 | if (idx < size) {
19 | geo_mud(
20 | positions[idx], normals[idx], f_params,
21 | offsets + idx
22 | );
23 | }
24 | }
25 |
26 |
27 | extern "C" {
28 |
29 | void call(
30 | size_t size,
31 | float3_nonbuiltin *positions,
32 | float3_nonbuiltin *normals,
33 | size_t n_f_params, float *f_params,
34 | float3_nonbuiltin *offsets
35 | ) {
36 | FLOAT3_VAR(d_positions, size);
37 | FLOAT3_VAR(d_normals, size);
38 | FLOAT3_VAR(d_offsets, size);
39 | FLOAT3_DfH(d_positions, positions, size);
40 | FLOAT3_DfH(d_normals, normals, size);
41 | FLOAT_VAR(d_f_params, n_f_params);
42 | FLOAT_DfH(d_f_params, f_params, n_f_params);
43 | mud_kernel<<>>(
44 | size, d_positions, d_normals, d_f_params, d_offsets
45 | );
46 | FLOAT3_HfD(offsets, d_offsets, size);
47 | cudaFree(d_positions);
48 | cudaFree(d_normals);
49 | cudaFree(d_offsets);
50 | cudaFree(d_f_params);
51 | }
52 |
53 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/source/cuda/surfaces/snow.cu:
--------------------------------------------------------------------------------
1 | // Copyright (c) Princeton University.
2 | // This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | // Authors: Zeyu Ma
5 |
6 |
7 | #include "header.h"
8 | #include "../../common/surfaces/snow.h"
9 |
10 |
11 |
12 | __global__ void snow_kernel(
13 | size_t size,
14 | float3_nonbuiltin *positions,
15 | float3_nonbuiltin *normals,
16 | float3_nonbuiltin *offsets
17 | ) {
18 | size_t idx = blockIdx.x * blockDim.x + threadIdx.x;
19 | if (idx < size) {
20 | geo_snowtexture(
21 | positions[idx], normals[idx],
22 | offsets + idx
23 | );
24 | }
25 | }
26 |
27 |
28 | extern "C" {
29 |
30 | void call(
31 | size_t size,
32 | float3_nonbuiltin *positions,
33 | float3_nonbuiltin *normals,
34 | float3_nonbuiltin *offsets
35 | ) {
36 | FLOAT3_VAR(d_positions, size);
37 | FLOAT3_VAR(d_normals, size);
38 | FLOAT3_VAR(d_offsets, size);
39 | FLOAT3_DfH(d_positions, positions, size);
40 | FLOAT3_DfH(d_normals, normals, size);
41 | snow_kernel<<>>(
42 | size, d_positions, d_normals, d_offsets
43 | );
44 | FLOAT3_HfD(offsets, d_offsets, size);
45 | cudaFree(d_positions);
46 | cudaFree(d_normals);
47 | cudaFree(d_offsets);
48 | }
49 |
50 | }
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/utils/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | from .mesh import Mesh, write_attributes, Vars, move_modifier
8 | from .ctype_util import ASINT, ASDOUBLE, ASFLOAT, register_func, load_cdll
9 | from .logging import Timer
10 | from .camera import get_caminfo
11 | from .image_processing import (
12 | boundary_smooth, smooth, read, sharpen, grid_distance, get_normal
13 | )
14 | from .random import perlin_noise, chance, drive_param, random_int, random_int_large
15 |
16 | from .kernelizer_util import (
17 | ATTRTYPE_DIMS, ATTRTYPE_FIELDS, ATTRTYPE_NP, NODE_ATTRS_AVAILABLE,
18 | AttributeType, FieldsType, Nodes, SocketType, KernelDataType,
19 | usable_name, SOCKETTYPE_KERNEL, sanitize, special_sanitize,
20 | special_sanitize_float_curve, NODE_FUNCTIONS, concat_string, var_list,
21 | value_string, collecting_vars, get_imp_var_name, special_sanitize_constant,
22 | KERNELDATATYPE_NPTYPE, KERNELDATATYPE_DIMS
23 | )
24 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/utils/ctype_util.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | import sys
8 | from ctypes import CDLL, POINTER, c_double, c_float, c_int32, RTLD_LOCAL
9 | from pathlib import Path
10 |
11 |
12 | # note: size of x should not exceed maximum
13 | def ASINT(x):
14 | return x.ctypes.data_as(POINTER(c_int32))
15 | def ASDOUBLE(x):
16 | return x.ctypes.data_as(POINTER(c_double))
17 | def ASFLOAT(x):
18 | return x.ctypes.data_as(POINTER(c_float))
19 |
20 | def register_func(me, dll, name, argtypes=[], restype=None, caller_name=None):
21 | if caller_name is None: caller_name = name
22 | setattr(me, caller_name, getattr(dll, name))
23 | func = getattr(me, caller_name)
24 | func.argtypes = argtypes
25 | func.restype = restype
26 |
27 | def load_cdll(path):
28 | return CDLL(Path(sys.path[-1]) / path, mode=RTLD_LOCAL)
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/utils/logging.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | import psutil
8 | import os
9 | import gin
10 | from util.logging import Timer as oTimer
11 |
12 |
13 | def report_memory():
14 | process = psutil.Process(os.getpid())
15 | print(f"memory usage: {process.memory_info().rss}")
16 |
17 |
18 | @gin.configurable("TerrainTimer")
19 | class Timer(oTimer):
20 | def __init__(self, desc, verbose):
21 | super().__init__(desc)
22 | self.verbose = verbose
23 |
24 | def __enter__(self):
25 | if self.verbose:
26 | super().__enter__()
27 |
28 | def __exit__(self, exc_type, exc_val, traceback):
29 | if self.verbose:
30 | super().__exit__(exc_type, exc_val, traceback)
31 | report_memory()
32 |
--------------------------------------------------------------------------------
/infinigen/worldgen/terrain/utils/random.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Zeyu Ma
5 |
6 |
7 | from ctypes import POINTER, c_float, c_int32, c_size_t
8 |
9 | import bpy
10 | import random
11 | import numpy as np
12 | from numpy import ascontiguousarray as AC
13 |
14 | from .ctype_util import ASFLOAT, load_cdll
15 |
16 | def random_int():
17 | return np.random.randint(np.iinfo(np.int32).min, np.iinfo(np.int32).max)
18 |
19 | def random_int_large():
20 | return random.getrandbits(128)
21 |
22 |
23 | def chance(x):
24 | return np.random.uniform() < x
25 |
26 |
27 | def perlin_noise(
28 | positions,
29 | device,
30 | freq,
31 | octaves,
32 | seed
33 | ):
34 | dll = load_cdll(f"terrain/lib/{device}/utils/FastNoiseLite.so")
35 | func = dll.perlin_call
36 | func.argtypes = [c_size_t, POINTER(c_float), POINTER(c_float), c_int32, c_int32, c_float]
37 | func.restype = None
38 | values = np.zeros(len(positions), dtype=np.float32)
39 | func(
40 | len(positions),
41 | ASFLOAT(AC(positions.astype(np.float32))),
42 | ASFLOAT(values),
43 | seed, octaves, freq,
44 | )
45 | del dll
46 | return values
47 |
48 |
49 | def drive_param(parameter, scale=1, offset=0, index=None, name="default_value"):
50 | driver = parameter.driver_add(name)
51 | if index is not None: driver = driver[index]
52 | driver.driver.expression = f'frame*{scale}+{offset}'
53 | bpy.context.view_layer.update()
54 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/blendscript_import_infinigen.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | '''
4 | Copy this file into blender's scripting window and run it whenever you open a new blender instance.
5 |
6 | It will configure the sys.path and load gin. This is necessary before any other procgen files can be imported/used within blender.
7 |
8 | Once this is done, you can do things like `from assets.creatures.genomes.carnivore import CarnivoreFactory` then `CarnivoreFactory(0).spawn_asset(0)` directly in the blender commandline
9 | '''
10 |
11 | import bpy
12 | from pathlib import Path
13 | import sys, os
14 |
15 | pwd = os.getcwd()
16 | if not pwd.endswith('worldgen'):
17 | raise ValueError(f'Current working directory is {pwd}, please cd infinigen/worldgen and run ../blender/blender ...')
18 | sys.path.append(pwd)
19 |
20 | import generate # so gin can find all its targets
21 | import gin
22 | gin.clear_config()
23 | gin.enter_interactive_mode()
24 |
25 | gin.parse_config_files_and_bindings(['config/base.gin'], [])
26 | from surfaces.surface import registry
27 | registry.initialize_from_gin()
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/dev/palette/.gitignore:
--------------------------------------------------------------------------------
1 | images
2 | css
3 | json
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/dev/palette/demo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/tools/dev/palette/demo1.png
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/dev/palette/demo2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/tools/dev/palette/demo2.png
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/dev/palette/demo3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/tools/dev/palette/demo3.png
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/dev/palette/demo4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/tools/dev/palette/demo4.png
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/export/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/infinigen/worldgen/tools/export/__init__.py
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/export/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | OS=$(uname -s)
4 | ARCH=$(uname -m)
5 |
6 |
7 | if [ "${OS}" = "Linux" ]; then
8 | BLENDER_DIR='blender_3.6'
9 | BLENDER_WGET_LINK='https://builder.blender.org/download/daily/archive/blender-3.6.0-beta+v36.962331c256b0-linux.x86_64-release.tar.xz'
10 | BLENDER_WGET_FILE='blender.tar.xz'
11 | BLENDER_UNTAR_DIR='blender-3.6.0-beta+v36.962331c256b0-linux.x86_64-release'
12 |
13 | elif [ "${OS}" = "Darwin" ]; then
14 | BLENDER_VOLM='/Volumes/Blender'
15 | BLENDER_DIR='./Blender.app'
16 | BLENDER_WGET_FILE='blender.dmg'
17 | if [ "${ARCH}" = "arm64" ]; then
18 | BLENDER_WGET_LINK='https://builder.blender.org/download/daily/archive/blender-3.6.0-beta+v36.83ef3bc9232b-darwin.arm64-release.dmg'
19 | else
20 | BLENDER_WGET_LINK='https://builder.blender.org/download/daily/archive/blender-3.6.0-beta+v36.83ef3bc9232b-darwin.x86_64-release.dmg'
21 | fi
22 |
23 | else
24 | echo "Unsupported OS"
25 | exit -1
26 | fi
27 |
28 | if [ ! -d "${BLENDER_DIR}" ]; then
29 | # Download Blender
30 | wget -q -O "${BLENDER_WGET_FILE}" "${BLENDER_WGET_LINK}"
31 |
32 | # Unzip Blender
33 | if [ "${OS}" = "Darwin" ]; then
34 | hdiutil attach "${BLENDER_WGET_FILE}"
35 | cp -r "${BLENDER_VOLM}/Blender.app" "${BLENDER_DIR}"
36 | hdiutil detach "${BLENDER_VOLM}"
37 | else
38 | tar -xf "${BLENDER_WGET_FILE}"
39 | mv "${BLENDER_UNTAR_DIR}" "${BLENDER_DIR}"
40 | fi
41 |
42 | rm "${BLENDER_WGET_FILE}"
43 | fi
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/install/compile_flip_fluids.sh:
--------------------------------------------------------------------------------
1 | OS=$(uname -s)
2 |
3 | if [ "${OS}" = "Linux" ]; then
4 | BLENDER_DIR='blender'
5 | BLENDER_ADDONS="${BLENDER_DIR}/3.3/scripts/addons"
6 | BLENDER_EXE="${BLENDER_DIR}/blender"
7 | elif [ "${OS}" = "Darwin" ]; then
8 | BLENDER_DIR='./Blender.app'
9 | BLENDER_ADDONS="${BLENDER_DIR}/Contents/Resources/3.3/scripts/addons"
10 | BLENDER_EXE="${BLENDER_DIR}/Contents/MacOS/Blender"
11 | else
12 | echo "Unsupported OS"
13 | exit -1
14 | fi
15 |
16 | FLIP_FLUIDS="https://github.com/rlguy/Blender-FLIP-Fluids"
17 | FLIP_FLUIDS_FOLDER="Blender-FLIP-Fluids"
18 | FLIP_FLUIDS_ADDON_FOLDER="${FLIP_FLUIDS_FOLDER}/build/bl_flip_fluids/flip_fluids_addon"
19 |
20 | if [ ! -d "${FLIP_FLUIDS_ADDON_FOLDER}" ]; then
21 | git clone "${FLIP_FLUIDS}"
22 | cd "${FLIP_FLUIDS_FOLDER}"
23 | python build.py
24 | cd -
25 | cp -r "${FLIP_FLUIDS_ADDON_FOLDER}" "${BLENDER_ADDONS}"
26 | "${BLENDER_EXE}" --background -noaudio -P ./worldgen/fluid/flip_init.py
27 | fi
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/install/compile_opengl.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Compile process_mesh (i.e. OpenGL-based ground truth)
3 | cd ./process_mesh
4 | cmake -S . -Bbuild -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_BUILD_TYPE=Release
5 | cmake --build build --target all
6 | ./build/process_mesh -in x -out x --height 100 --width 10 --frame 0
7 | if [ $? -eq 174 ]; then
8 | echo "OpenGL/EGL ground truth is working."
9 | else
10 | echo "WARNING: OpenGL/EGL is not supported on this machine. If you are running from a cluster head-node, this is likely not an issue."
11 | fi
12 | cd -
13 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/.gitignore:
--------------------------------------------------------------------------------
1 | smb_login.gin
2 | debug*
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/asset_demo.gin:
--------------------------------------------------------------------------------
1 | get_cmd.driver_script="asset_demo.py"
2 | main.wandb_project="asset_demo"
3 | LocalScheduleHandler.jobs_per_gpu=3
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/base.gin:
--------------------------------------------------------------------------------
1 | sample_scene_spec.config_distribution = [
2 | ("forest", 4),
3 | ("river", 4),
4 | ("desert", 3),
5 | ("coast", 3),
6 | ("kelp_forest", 2),
7 | ("coral_reef", 2),
8 | ("cave", 2),
9 | ("mountain", 2),
10 | ("canyon", 2),
11 | ("plain", 2),
12 | ("cliff", 2),
13 | ("arctic", 1),
14 | ("snowy_mountain", 1),
15 | ]
16 | sample_scene_spec.config_sample_mode = 'random'
17 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/compute_platform/local_128GB.gin:
--------------------------------------------------------------------------------
1 | include 'tools/pipeline_configs/compute_platform/local_256GB.gin'
2 |
3 | manage_datagen_jobs.num_concurrent=8
4 |
5 |
6 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/compute_platform/local_16GB.gin:
--------------------------------------------------------------------------------
1 | include 'tools/pipeline_configs/compute_platform/local_256GB.gin'
2 |
3 | manage_datagen_jobs.num_concurrent=1
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/compute_platform/local_256GB.gin:
--------------------------------------------------------------------------------
1 |
2 | manage_datagen_jobs.num_concurrent = 16
3 |
4 |
5 | get_cmd.process_niceness = 20 # let UI processes etc take precedence, to make the smooth and UI usable
6 | local_submit_cmd.use_scheduler = True
7 | LocalScheduleHandler.jobs_per_gpu = 1
8 |
9 | get_cmd.blender_thread_limit = 8
10 |
11 | # All will run locally, LocalScheduleHandler doesnt actually enforce cpu/ram constraints currently
12 | queue_coarse.submit_cmd = @local_submit_cmd
13 | queue_fine_terrain.submit_cmd = @local_submit_cmd
14 | queue_populate.submit_cmd = @local_submit_cmd
15 | queue_render.submit_cmd = @local_submit_cmd
16 |
17 | queue_combined.mem_gb = 12
18 | renderbackup/queue_combined.mem_gb = 24
19 | queue_combined.cpus = 2
20 | queue_combined.hours = 48
21 | queue_combined.submit_cmd = @local_submit_cmd
22 |
23 | # Rendering
24 | queue_render.cpus = 4
25 | queue_render.submit_cmd = @local_submit_cmd
26 | queue_render.hours = 24
27 | queue_render.render_type = "full"
28 | queue_render.gpus = 1
29 |
30 | # Upload
31 | queue_upload.submit_cmd = @local_submit_cmd
32 | queue_upload.mem_gb = 6
33 | queue_upload.cpus = 2
34 | queue_upload.hours = 24
35 | queue_upload.method = 'smbclient'
36 | queue_upload.dir_prefix_len = 2
37 |
38 | # Ground Truth
39 | queue_mesh_save.submit_cmd = @local_submit_cmd
40 | queue_opengl.submit_cmd = @local_submit_cmd
41 | ground_truth/queue_render.render_type = "flat"
42 | ground_truth/queue_render.gpus = 0
43 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/compute_platform/local_64GB.gin:
--------------------------------------------------------------------------------
1 | include 'tools/pipeline_configs/compute_platform/local_256GB.gin'
2 |
3 | manage_datagen_jobs.num_concurrent=3
4 |
5 |
6 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/compute_platform/slurm_1h.gin:
--------------------------------------------------------------------------------
1 | include 'tools/pipeline_configs/compute_platform/slurm.gin'
2 |
3 | queue_combined.hours = 1
4 | queue_coarse.hours = 1
5 | queue_fine_terrain.hours = 1
6 | queue_populate.hours = 1
7 | queue_render.hours = 1
8 | queue_upload.hours = 1
9 | queue_mesh_save.hours = 1
10 | queue_opengl.hours = 1
11 |
12 | queue_coarse.cpus = 8
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/compute_platform/slurm_high_memory.gin:
--------------------------------------------------------------------------------
1 | include 'tools/pipeline_configs/compute_platform/slurm.gin'
2 |
3 | # Combined (only used when `stereo_combined.gin` or similar is included)
4 | queue_combined.mem_gb = 48
5 | queue_combined.cpus = 4
6 | queue_coarse.mem_gb = 48
7 | queue_coarse.cpus = 4
8 | queue_fine_terrain.mem_gb = 48
9 | queue_fine_terrain.cpus = 4
10 | queue_populate.mem_gb = 48
11 | queue_populate.cpus = 4
12 | queue_populate.hours = 24
13 | renderbackup/queue_populate.mem_gb = 48
14 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/cuda_terrain.gin:
--------------------------------------------------------------------------------
1 | queue_fine_terrain.gpus = 1
2 | queue_combined.gpus = 1
3 | queue_fine_terrain.exclude_gpus = ['gtx_1080', 'k80', 'rtx_2080']
4 | queue_combined.exclude_gpus = ['gtx_1080', 'k80', 'rtx_2080']
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/data_schema/monocular.gin:
--------------------------------------------------------------------------------
1 | iterate_scene_tasks.frame_range=[1,48]
2 | iterate_scene_tasks.render_frame_range=[48,48]
3 | iterate_scene_tasks.cam_id_ranges = [1,1]
4 |
5 | iterate_scene_tasks.global_tasks = [
6 | {'name': 'coarse', 'func': @queue_coarse},
7 | {'name': "populate", 'func': @queue_populate},
8 | {'name': 'backuppopulate', 'func': @renderbackup/queue_populate, 'condition': 'prev_failed'}
9 | ]
10 |
11 | iterate_scene_tasks.view_dependent_tasks = [
12 | {'name': "fineterrain", 'func': @queue_fine_terrain},
13 | ]
14 | iterate_scene_tasks.camera_dependent_tasks = [
15 | {'name': 'shortrender', 'func': @rendershort/queue_render},
16 | {'name': 'backuprender', 'func': @renderbackup/queue_render, 'condition': 'prev_failed'},
17 | ]
18 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/data_schema/monocular_flow.gin:
--------------------------------------------------------------------------------
1 | include 'tools/pipeline_configs/data_schema/monocular.gin'
2 | iterate_scene_tasks.frame_range=(1, 2)
3 |
4 |
5 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/data_schema/monocular_video.gin:
--------------------------------------------------------------------------------
1 | iterate_scene_tasks.frame_range = [1, 192]
2 | iterate_scene_tasks.view_block_size = 16
3 | iterate_scene_tasks.cam_id_ranges = [1, 1]
4 |
5 | iterate_scene_tasks.global_tasks = [
6 | {'name': 'coarse', 'func': @queue_coarse},
7 | {'name': "populate", 'func': @queue_populate},
8 | {'name': 'backuppopulate', 'func': @renderbackup/queue_populate, 'condition': 'prev_failed'}
9 | ]
10 | iterate_scene_tasks.view_dependent_tasks = [
11 | {'name': "fineterrain", 'func': @queue_fine_terrain},
12 | ]
13 | iterate_scene_tasks.camera_dependent_tasks = [
14 | {'name': 'shortrender', 'func': @rendershort/queue_render},
15 | {'name': 'backuprender', 'func': @renderbackup/queue_render, 'condition': 'prev_failed'},
16 | ]
17 |
18 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/data_schema/stereo.gin:
--------------------------------------------------------------------------------
1 | iterate_scene_tasks.frame_range=(1, 1)
2 | iterate_scene_tasks.cam_id_ranges = [1, 2]
3 |
4 | iterate_scene_tasks.global_tasks = [
5 | {'name': 'combined', 'func': @queue_combined}
6 | ]
7 | iterate_scene_tasks.view_dependent_tasks = []
8 | iterate_scene_tasks.camera_dependent_tasks = [
9 | {'name': 'rendershort', 'func': @rendershort/queue_render},
10 | {'name': 'renderbackup', 'func': @renderbackup/queue_render, 'condition': 'prev_failed'}
11 | ]
12 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/data_schema/stereo_1h_jobs.gin:
--------------------------------------------------------------------------------
1 |
2 | iterate_scene_tasks.frame_range=(1, 1)
3 | iterate_scene_tasks.cam_id_ranges =(1, 2)
4 |
5 | iterate_scene_tasks.global_tasks = [
6 | {'name': "coarse", 'func': @queue_coarse},
7 | {'name': "fine", 'func': @queue_populate},
8 | {'name': "fineterrain", 'func': @queue_fine_terrain},
9 | ]
10 | iterate_scene_tasks.view_dependent_tasks = []
11 | iterate_scene_tasks.camera_dependent_tasks = [
12 | {'name': 'rendershort', 'func': @rendershort/queue_render},
13 | {'name': 'renderbackup', 'func': @renderbackup/queue_render, 'condition': 'prev_failed'}
14 | ]
15 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/data_schema/stereo_video.gin:
--------------------------------------------------------------------------------
1 | include 'tools/pipeline_configs/data_schema/monocular_video.gin'
2 | iterate_scene_tasks.cam_id_ranges = [1, 2]
3 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/gt_options/blender_gt.gin:
--------------------------------------------------------------------------------
1 | iterate_scene_tasks.camera_dependent_tasks = [
2 | {'name': 'rendershort', 'func': @rendershort/queue_render},
3 | {'name': 'renderbackup', 'func': @renderbackup/queue_render, 'condition': 'prev_failed'},
4 | {'name': 'blendergt', 'func': @ground_truth/queue_render}
5 | ]
6 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/gt_options/gt_test.gin:
--------------------------------------------------------------------------------
1 | iterate_scene_tasks.camera_dependent_tasks = [
2 | {'name': 'rendershort', 'func': @rendershort/queue_render},
3 | {'name': 'renderbackup', 'func': @renderbackup/queue_render, 'condition': 'prev_failed'},
4 | {'name': 'savemesh', 'func': @queue_mesh_save},
5 | {'name': 'opengl', 'func': @queue_opengl},
6 | {'name': 'blendergt', 'func': @ground_truth/queue_render},
7 | ]
8 |
9 | queue_opengl.gt_testing = True
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/gt_options/opengl_gt.gin:
--------------------------------------------------------------------------------
1 | iterate_scene_tasks.camera_dependent_tasks = [
2 | {'name': 'rendershort', 'func': @rendershort/queue_render},
3 | {'name': 'renderbackup', 'func': @renderbackup/queue_render, 'condition': 'prev_failed'},
4 | {'name': 'savemesh', 'func': @queue_mesh_save},
5 | {'name': 'opengl', 'func': @queue_opengl}
6 | ]
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/gt_options/opengl_gt_noshortrender.gin:
--------------------------------------------------------------------------------
1 | include 'tools/pipeline_configs/opengl_gt.gin' # incase someone adds other settings to it
2 |
3 | iterate_scene_tasks.camera_dependent_tasks = [
4 | {'name': 'renderbackup', 'func': @renderbackup/queue_render}, # still call it "backup" since it is reusing the compute_platform's backup config. we are just skipping straight to the backup
5 | {'name': 'savemesh', 'func': @queue_mesh_save},
6 | {'name': 'opengl', 'func': @queue_opengl}
7 | ]
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/pipeline_configs/opengl_gt_noshortrender.gin:
--------------------------------------------------------------------------------
1 | include 'tools/pipeline_configs/opengl_gt.gin' # incase someone adds other settings to it
2 |
3 | iterate_scene_tasks.camera_dependent_tasks = [
4 | {'name': 'renderbackup', 'func': @renderbackup/queue_render}, # still call it "backup" since it is reusing the compute_platform's backup config. we are just skipping straight to the backup
5 | {'name': 'savemesh', 'func': @queue_mesh_save},
6 | {'name': 'opengl', 'func': @queue_opengl}
7 | ]
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/scripts/render_river_video.sh:
--------------------------------------------------------------------------------
1 | # TEMP. REMOVE BEFORE MERGE.
2 |
3 | HOSTFIRST=$(hostname | tr "." "\n" | head -n 1)
4 | JOBNAME=$(date '+%m_%d_%H_%M').$HOSTFIRST.$1
5 | if [ "$2" = "dev" ]; then
6 | python -m tools.manage_datagen_jobs --output_folder $3/$JOBNAME --num_scenes 20 \
7 | --pipeline_config $1 monocular_video_river enable_gpu opengl_gt --wandb_mode online --cleanup none --warmup_sec 12000 --config trailer_river dev reuse_terrain_assets simulated_river
8 | else
9 | python -m tools.manage_datagen_jobs --output_folder $3/$JOBNAME --num_scenes 50 \
10 | --pipeline_config $1 monocular_video_river enable_gpu opengl_gt --wandb_mode online --cleanup big_files --warmup_sec 12000 --config trailer_river reuse_terrain_assets simulated_river high_quality_terrain
11 | fi
12 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/scripts/render_video_1080p.sh:
--------------------------------------------------------------------------------
1 | HOSTFIRST=$(hostname | tr "." "\n" | head -n 1)
2 | JOBNAME=$(date '+%m_%d_%H_%M').$HOSTFIRST.$1
3 |
4 | python -m tools.manage_datagen_jobs --output_folder outputs/$JOBNAME \
5 | --num_scenes 100 --pipeline_config $@ stereo_video cuda_terrain opengl_gt_noshortrender \
6 | --wandb_mode online --cleanup big_files --upload \
7 | --warmup_sec 40000 \
8 | --config high_quality_terrain
9 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/scripts/render_video_720p.sh:
--------------------------------------------------------------------------------
1 | HOSTFIRST=$(hostname | tr "." "\n" | head -n 1)
2 | JOBNAME=$(date '+%m_%d_%H_%M').$HOSTFIRST.$1
3 |
4 | python -m tools.manage_datagen_jobs --output_folder outputs/$JOBNAME \
5 | --num_scenes 100 --pipeline_config $@ stereo_video cuda_terrain opengl_gt \
6 | --wandb_mode online --cleanup big_files --upload --warmup_sec 6000 \
7 | --config high_quality_terrain \
8 | --overrides compose_scene.generate_resolution=[1280,720]
9 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/scripts/render_video_fire.sh:
--------------------------------------------------------------------------------
1 | # TEMP. REMOVE BEFORE MERGE.
2 |
3 | HOSTFIRST=$(hostname | tr "." "\n" | head -n 1)
4 | JOBNAME=$(date '+%m_%d_%H_%M').$HOSTFIRST.$1
5 | python -m tools.manage_datagen_jobs --output_folder $3/$JOBNAME --num_scenes $2 \
6 | --pipeline_config $1 monocular_video enable_gpu opengl_gt --wandb_mode online --cleanup none --warmup_sec 10000 --config trailer high_quality_terrain reuse_terrain_assets use_on_the_fly_fire
7 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/scripts/render_video_stereo.sh:
--------------------------------------------------------------------------------
1 | HOSTFIRST=$(hostname | tr "." "\n" | head -n 1)
2 | JOBNAME=$(date '+%m_%d_%H_%M').$HOSTFIRST.$1
3 |
4 | python -m tools.manage_datagen_jobs --blender_path ../blender/blender --output_folder outputs/$JOBNAME \
5 | --num_scenes 1000 --pipeline_config $@ stereo cuda_terrain opengl_gt \
6 | --wandb_mode online --cleanup big_files --upload --warmup_sec 40000 \
7 | --override compose_scene.generate_resolution=[1280,720] \
8 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/testing/conftest.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | def pytest_addoption(parser):
4 | parser.addoption( "--dir",action="store")
5 | parser.addoption( "--num",action="store")
6 | parser.addoption( "--days",action="store")
7 |
8 | @pytest.fixture()
9 | def dir(request):
10 | return request.config.getoption("--dir")
11 |
12 | @pytest.fixture()
13 | def num(request):
14 | return request.config.getoption("--num")
15 |
16 | @pytest.fixture()
17 | def days(request):
18 | return request.config.getoption("--days")
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/testing/run_tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cwd=$(pwd)
3 | cd ../..
4 | python -m tools.manage_datagen_jobs --output_folder "$1" \
5 | --num_scenes "$2" --pipeline_configs slurm monocular cuda_terrain gt_test \
6 | --pipeline_overrides LocalScheduleHandler.use_gpu=True
7 |
8 | cd -
9 | cp test_infinigen.py "$1/test_infinigen.py"
10 | cp conftest.py "$1/conftest.py"
11 |
12 | cd "$1" && mkdir -p test_results && pytest -v -s --dir "$1" --num "$2" --days "$3" >| "test_results/logs.log"
13 | cd "$1" && rm -rf test_infinigen.py conftest.py __pycache__ .pytest_cache
14 |
15 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/util/cancel_jobs.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lahav Lipson
5 |
6 |
7 | import subprocess
8 | import argparse
9 | import re
10 | import os
11 | from tqdm import tqdm
12 |
13 | if __name__ == '__main__':
14 | parser = argparse.ArgumentParser()
15 | parser.add_argument('-w', "--with_substring", required=True)
16 | parser.add_argument('-wo', "--without_substring", default=None)
17 | parser.add_argument("--not_running", action="store_true")
18 | args = parser.parse_args()
19 | job_cmd = f'/usr/bin/squeue --user={os.environ["USER"]} -o %.24i%.40j%.14R -h'
20 | squeue_output = subprocess.check_output(job_cmd.split()).decode()
21 | matches = re.findall("([0-9]+) *([^ ]+) *([^ ]+) *\n", squeue_output)
22 | for job_id, job_name, job_status in tqdm(matches):
23 | should_cancel = ((args.with_substring in job_name) and
24 | ((args.without_substring is None) or args.without_substring not in job_name) and
25 | ((not args.not_running) or 'node' not in job_status))
26 | if should_cancel:
27 | subprocess.check_output(["/usr/bin/scancel", job_id])
28 |
--------------------------------------------------------------------------------
/infinigen/worldgen/tools/util/google_drive_client.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Princeton University.
2 | # This source code is licensed under the BSD 3-Clause license found in the LICENSE file in the root directory of this source tree.
3 |
4 | # Authors: Lahav Lipson
5 |
6 |
7 | from pathlib import Path
8 | import subprocess
9 | import os
10 | import shutil
11 |
12 | def listdir(remote_path):
13 | stdout = subprocess.check_output(f"{shutil.which('rclone')} lsf infinigen_renders:{remote_path}/".split(), text=True)
14 | return sorted((Path(remote_path) / l) for l in stdout.splitlines())
15 |
16 | def download(remote_path, local_folder):
17 | assert os.path.exists(local_folder) and os.path.isdir(local_folder)
18 | dest_path = os.path.join(local_folder, os.path.basename(remote_path))
19 | print(f"Downloading to {dest_path}")
20 | with Path('/dev/null').open('w') as devnull:
21 | subprocess.run(f'{shutil.which("rclone")} copy infinigen_renders:{remote_path} {local_folder}/',
22 | shell=True, check=True, stderr=devnull, stdout=devnull)
23 | return dest_path
--------------------------------------------------------------------------------
/llava_hf/scripts/eval_sllm_p10.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | EXP_NAME="llava-llama3-8b-sllm-p10"
4 | ROOT_DIR="/path/to/workspace/VLMaterial"
5 | WORK_DIR="${ROOT_DIR}/llava_hf"
6 | DATA_DIR="${ROOT_DIR}/material_dataset_filtered"
7 | SPLIT_DIR="${DATA_DIR}/dataset_splits"
8 | export CUDA_DEVICE_ORDER="PCI_BUS_ID"
9 |
10 | python ${WORK_DIR}/inference.py \
11 | --model_path ${WORK_DIR}/checkpoints/${EXP_NAME}/checkpoint-epoch5 \
12 | --model_base llava-hf/llama3-llava-next-8b-hf \
13 | --test_data_path ${SPLIT_DIR}/llava_noaug_test.json \
14 | --image_folder ${DATA_DIR} \
15 | --output_dir ${WORK_DIR}/results/${EXP_NAME}/eval-epoch5 \
16 | --num_processes 8 \
17 | --display_id 0 \
18 | --device_id 0 1 2 3 4 5 6 7 \
19 | --temperature 0.6 \
20 | --top_k 50 \
21 | --top_p 0.9 \
22 | --mode gen
23 |
--------------------------------------------------------------------------------
/llava_hf/scripts/peft_sllm_p10.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | EXP_NAME="llava-llama3-8b-sllm-p10"
4 | ROOT_DIR="/path/to/workspace/VLMaterial"
5 | WORK_DIR="${ROOT_DIR}/llava_hf"
6 | DATA_DIR="${ROOT_DIR}/material_dataset_filtered"
7 | SPLIT_DIR="${DATA_DIR}/dataset_splits"
8 | DEVICE_IDS="0,1,2,3,4,5,6,7"
9 |
10 | deepspeed --include localhost:${DEVICE_IDS} --master_port=29501 ${WORK_DIR}/train.py \
11 | --model_name_or_path llava-hf/llama3-llava-next-8b-hf \
12 | --max_length 5120 \
13 | --lora_r 8 \
14 | --lora_alpha 32 \
15 | --deepspeed ${WORK_DIR}/scripts/zero3.json \
16 | --train_data_path ${SPLIT_DIR}/llava_noaug_train.json \
17 | --val_data_path ${SPLIT_DIR}/llava_noaug_val.json \
18 | --image_folder ${DATA_DIR} \
19 | --group_by_length True \
20 | --bf16 True \
21 | --tf32 True \
22 | --output_dir ${WORK_DIR}/checkpoints/${EXP_NAME} \
23 | --num_train_epochs 5 \
24 | --per_device_train_batch_size 4 \
25 | --per_device_eval_batch_size 4 \
26 | --gradient_accumulation_steps 1 \
27 | --eval_strategy "epoch" \
28 | --save_strategy "epoch" \
29 | --learning_rate 1e-4 \
30 | --weight_decay 0. \
31 | --warmup_ratio 0.03 \
32 | --lr_scheduler_type "cosine" \
33 | --logging_steps 10 \
34 | --gradient_checkpointing True \
35 | --dataloader_num_workers 4 \
36 | --report_to tensorboard
37 |
--------------------------------------------------------------------------------
/llava_hf/scripts/render_sllm_p10.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | EXP_NAME="llava-llama3-8b-sllm-p10"
4 | ROOT_DIR="/path/to/workspace/VLMaterial"
5 | WORK_DIR="${ROOT_DIR}/llava_hf"
6 | DATA_DIR="${ROOT_DIR}/material_dataset_filtered"
7 | SPLIT_DIR="${DATA_DIR}/dataset_splits"
8 | export CUDA_DEVICE_ORDER="PCI_BUS_ID"
9 |
10 | python ${WORK_DIR}/inference.py \
11 | --model_path ${WORK_DIR}/checkpoints/${EXP_NAME}/checkpoint-epoch5 \
12 | --model_base llava-hf/llama3-llava-next-8b-hf \
13 | --test_data_path ${SPLIT_DIR}/llava_noaug_test.json \
14 | --image_folder ${DATA_DIR} \
15 | --output_dir ${WORK_DIR}/results/${EXP_NAME}/eval-epoch5 \
16 | --num_processes 8 \
17 | --display_id 0 \
18 | --device_id 0 1 2 3 4 5 6 7 \
19 | --mode render
20 |
--------------------------------------------------------------------------------
/llava_hf/scripts/zero3.json:
--------------------------------------------------------------------------------
1 | {
2 | "fp16": {
3 | "enabled": "auto",
4 | "loss_scale": 0,
5 | "loss_scale_window": 1000,
6 | "initial_scale_power": 16,
7 | "hysteresis": 2,
8 | "min_loss_scale": 1
9 | },
10 | "bf16": {
11 | "enabled": "auto"
12 | },
13 | "train_micro_batch_size_per_gpu": "auto",
14 | "train_batch_size": "auto",
15 | "gradient_accumulation_steps": "auto",
16 | "zero_optimization": {
17 | "stage": 3,
18 | "overlap_comm": true,
19 | "contiguous_gradients": true,
20 | "sub_group_size": 1e9,
21 | "reduce_bucket_size": "auto",
22 | "stage3_prefetch_bucket_size": "auto",
23 | "stage3_param_persistence_threshold": "auto",
24 | "stage3_max_live_parameters": 1e9,
25 | "stage3_max_reuse_distance": 1e9,
26 | "stage3_gather_16bit_weights_on_model_save": true
27 | }
28 | }
--------------------------------------------------------------------------------
/misc/teaser.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mit-gfx/VLMaterial/5193dadfdd3d2e9e08f8ad8d970bc7538b2ee3f0/misc/teaser.jpg
--------------------------------------------------------------------------------