diff --git a/infinigen/terrain/elements/landtiles.py b/infinigen/terrain/elements/landtiles.py index a06c78f0e..15847ab6b 100644 --- a/infinigen/terrain/elements/landtiles.py +++ b/infinigen/terrain/elements/landtiles.py @@ -34,6 +34,24 @@ def none_to_0(x): return 0 return x +@gin.configurable +def get_land_process(land_processes, land_process_probs=None, snowfall_enabled=True): + if not isinstance(land_processes, list): + land_processes = [land_processes] + land_process_probs = [1] + if not snowfall_enabled: + land_processes_ = [] + land_process_probs_ = [] + for land_process, prob in zip(land_processes, land_process_probs): + if land_process != Process.Snowfall: + land_processes_.append(land_process) + land_process_probs_.append(prob) + else: + land_processes_ = land_processes + land_process_probs_ = land_process_probs + if land_processes_ == []: + return None + return rg(("choice", land_processes_, land_process_probs_)) @gin.configurable class LandTiles(Element): @@ -53,7 +71,8 @@ def __init__( attribute_distance_range=1e9, island_probability=0, tile_heights=[-0.1], - land_process=("choice", [Process.Erosion, None], [0.65, 0.35]), + land_processes=[Process.Erosion, None], + land_process_probs=[0.65, 0.35], height_modification_start=None, height_modification_end=None, attribute_modification_start_height=None, @@ -83,7 +102,7 @@ def __init__( ) self.smooth = smooth self.aux_names = [] - land_process = rg(land_process) + land_process = get_land_process(land_processes, land_process_probs) sharpen = 0 mask_random_freq = 0 if land_process == Process.Snowfall: @@ -252,7 +271,7 @@ def __init__( tile_density=tile_density, attribute_probability=0.5, attribute_distance_range=150, - land_process=Process.Eruption, + land_processes=Process.Eruption, height_modification_start=-0.5, height_modification_end=-1.5, attribute_modification_start_height=None, @@ -282,7 +301,7 @@ def __init__( tiles=[LandTile.Mesa], tile_density=tile_density, tile_heights=[-12.15], - land_process=Process.IceErosion, + land_processes=Process.IceErosion, transparency=Transparency.CollectiveTransparent, height_modification_start=None, height_modification_end=None, diff --git a/infinigen_examples/configs_nature/disable_assets/no_landlab.gin b/infinigen_examples/configs_nature/disable_assets/no_landlab.gin new file mode 100644 index 000000000..a576135a3 --- /dev/null +++ b/infinigen_examples/configs_nature/disable_assets/no_landlab.gin @@ -0,0 +1,5 @@ +scene.upsidedown_mountains_chance = 0 +ant_landscape_asset.snowfall = 0 +multi_mountains_asset.snowfall = 0 +coast_asset.snowfall = 0 +get_land_process.snowfall_enabled = 0 diff --git a/infinigen_examples/configs_nature/extras/use_on_the_fly_fire.gin b/infinigen_examples/configs_nature/extras/use_on_the_fly_fire.gin index c2959782e..c0edea192 100644 --- a/infinigen_examples/configs_nature/extras/use_on_the_fly_fire.gin +++ b/infinigen_examples/configs_nature/extras/use_on_the_fly_fire.gin @@ -8,7 +8,7 @@ populate_scene.cactus_fire_on_the_fly_chance = 0.1 compose_nature.glowing_rocks_chance = 0.0 compose_nature.cached_fire = False -LandTiles.land_process = None +LandTiles.land_processes = None #scene.voronoi_rocks_chance = 1 #animate_cameras.follow_poi_chance=0 diff --git a/infinigen_examples/configs_nature/scene_types/arctic.gin b/infinigen_examples/configs_nature/scene_types/arctic.gin index f0c337735..cd53b74b9 100644 --- a/infinigen_examples/configs_nature/scene_types/arctic.gin +++ b/infinigen_examples/configs_nature/scene_types/arctic.gin @@ -18,7 +18,7 @@ LandTiles.transparency = "CollectiveTransparent" VoronoiRocks.transparency = "CollectiveTransparent" LandTiles.randomness = 1 -LandTiles.land_process = "ice_erosion" +LandTiles.land_processes = "ice_erosion" LandTiles.tiles = ["Mesa"] LandTiles.tile_heights = [-2.75] LandTiles.tile_density = 0.4 diff --git a/infinigen_examples/configs_nature/scene_types/snowy_mountain.gin b/infinigen_examples/configs_nature/scene_types/snowy_mountain.gin index b9ea8d81f..5e3431e85 100644 --- a/infinigen_examples/configs_nature/scene_types/snowy_mountain.gin +++ b/infinigen_examples/configs_nature/scene_types/snowy_mountain.gin @@ -11,7 +11,7 @@ compose_nature.snow_particles_chance = 0.5 shader_atmosphere.density = 0 nishita_lighting.sun_elevation = ("spherical_sample", 10, 30) -LandTiles.land_process = "snowfall" +LandTiles.land_processes = "snowfall" scene.waterbody_chance = 0 scene.caves_chance = 0 scene.ground_chance = 0 diff --git a/infinigen_examples/configs_nature/scene_types_fluidsim/simulated_river.gin b/infinigen_examples/configs_nature/scene_types_fluidsim/simulated_river.gin index 12dc326e2..75b945e93 100644 --- a/infinigen_examples/configs_nature/scene_types_fluidsim/simulated_river.gin +++ b/infinigen_examples/configs_nature/scene_types_fluidsim/simulated_river.gin @@ -21,7 +21,7 @@ camera_pose_proposal.roll = 180 camera_pose_proposal.yaw = -178 boulder.create_placeholder.boulder_scale = 1 -LandTiles.land_process = None +LandTiles.land_processes = None render.hide_water = True compute_base_views.min_candidates_ratio = 1 diff --git a/infinigen_examples/configs_nature/scene_types_fluidsim/tilted_river.gin b/infinigen_examples/configs_nature/scene_types_fluidsim/tilted_river.gin index cfa621615..42bdaf7ee 100644 --- a/infinigen_examples/configs_nature/scene_types_fluidsim/tilted_river.gin +++ b/infinigen_examples/configs_nature/scene_types_fluidsim/tilted_river.gin @@ -23,7 +23,7 @@ camera_pose_proposal.pitch = -110 compose_nature.tilted_river_enabled = True boulder.create_placeholder.boulder_scale = 3 -LandTiles.land_process = None +LandTiles.land_processes = None render.hide_water = True compute_base_views.min_candidates_ratio = 1