diff --git a/.gitignore b/.gitignore index 5148b1ace..d17c38493 100644 --- a/.gitignore +++ b/.gitignore @@ -42,7 +42,8 @@ Blender-FLIP-Fluids *.blend1 *.out profiles_*.npz -*outputs +outputs +outputs_scratch snippets resources times.txt diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1d06bcf50..480f5c4b8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -36,3 +36,6 @@ v1.2.6 - Fix bug where manage_jobs.py would ignore CUDA_VISIBLE_DEVICES that didnt start at 0 - Add NotImplementedError for dynamic hair. +v1.3.1 +- Fix configuration bug causing massive render slowdown +- Create noisier video trajectories optimized for training diff --git a/infinigen/__init__.py b/infinigen/__init__.py index 2a1f5fd08..599b7d93a 100644 --- a/infinigen/__init__.py +++ b/infinigen/__init__.py @@ -1,3 +1,3 @@ import logging -__version__ = "1.2.6" +__version__ = "1.3.1" diff --git a/infinigen/assets/creatures/reptile.py b/infinigen/assets/creatures/reptile.py index 56361c35e..4ade92c57 100644 --- a/infinigen/assets/creatures/reptile.py +++ b/infinigen/assets/creatures/reptile.py @@ -395,7 +395,7 @@ def chameleon_postprocessing(body_parts, extras, params): def purge_empty_materials(obj): with butil.SelectObjects(obj): for i, m in enumerate(obj.material_slots): - if m.name != '': + if m.material is not None: continue bpy.context.object.active_material_index = i bpy.ops.object.material_slot_remove() diff --git a/infinigen/core/execute_tasks.py b/infinigen/core/execute_tasks.py index f294ba4ad..cfe98723f 100644 --- a/infinigen/core/execute_tasks.py +++ b/infinigen/core/execute_tasks.py @@ -283,6 +283,7 @@ def execute_tasks( resample_idx=None, output_blend_name="scene.blend", generate_resolution=(1280,720), + fps=24, reset_assets=True, focal_length=None, dryrun=False, @@ -315,6 +316,7 @@ def execute_tasks( bpy.context.scene.frame_start = int(frame_range[0]) bpy.context.scene.frame_end = int(frame_range[1]) bpy.context.scene.frame_set(int(frame_range[0])) + bpy.context.scene.render.fps = fps bpy.context.scene.render.resolution_x = generate_resolution[0] bpy.context.scene.render.resolution_y = generate_resolution[1] bpy.context.view_layer.update() diff --git a/infinigen/core/init.py b/infinigen/core/init.py index d97ce94c6..80c632452 100644 --- a/infinigen/core/init.py +++ b/infinigen/core/init.py @@ -29,6 +29,19 @@ logger = logging.getLogger(__name__) +CYCLES_GPUTYPES_PREFERENCE = [ + + # key must be a valid cycles device_type + # ordering indicate preference - earlier device types will be used over later if both are available + # - e.g most OPTIX gpus will also show up as a CUDA gpu, but we will prefer to use OPTIX due to this list's ordering + + 'OPTIX', + 'CUDA', + 'HIP', # untested + 'ONEAPI', # untested + 'CPU', +] + def parse_args_blender(parser): if '--' in sys.argv: # Running using a blender commandline python. @@ -193,15 +206,100 @@ def import_addons(names): except Exception: logger.warning(f'Could not load addon "{name}"') -def configure_blender(): - bpy.context.preferences.system.scrollback = 0 - bpy.context.preferences.edit.undo_steps = 0 +@gin.configurable +def configure_render_cycles( + + # supplied by gin.config + min_samples, + num_samples, + time_limit, + adaptive_threshold, + exposure, + denoise +): bpy.context.scene.render.engine = 'CYCLES' - bpy.context.scene.cycles.device = 'GPU' + # For now, denoiser is always turned on, but the _used_ + if denoise: + try: + bpy.context.scene.cycles.use_denoising = True + bpy.context.scene.cycles.denoiser = 'OPTIX' + except Exception as e: + logger.warning(f"Cannot use OPTIX denoiser {e}") + + bpy.context.scene.cycles.samples = num_samples # i.e. infinity + bpy.context.scene.cycles.adaptive_min_samples = min_samples + bpy.context.scene.cycles.adaptive_threshold = adaptive_threshold # i.e. noise threshold + bpy.context.scene.cycles.time_limit = time_limit + bpy.context.scene.cycles.film_exposure = exposure bpy.context.scene.cycles.volume_step_rate = 0.1 bpy.context.scene.cycles.volume_preview_step_rate = 0.1 bpy.context.scene.cycles.volume_max_steps = 32 + bpy.context.scene.cycles.volume_bounces = 4 + +@gin.configurable +def configure_cycles_devices( + use_gpu=True +): + + if use_gpu is False: + logger.info(f'Render will use CPU-only due to {use_gpu=}') + bpy.context.scene.cycles.device = 'CPU' + return + + assert bpy.context.scene.render.engine == 'CYCLES' + bpy.context.scene.cycles.device = 'GPU' + prefs = bpy.context.preferences.addons['cycles'].preferences + + # Necessary to "remind" cycles that the devices exist? Not sure. Without this no devices are found. + for dt in prefs.get_device_types(bpy.context): + prefs.get_devices_for_type(dt[0]) + + assert len(prefs.devices) != 0, prefs.devices + + types = list(d.type for d in prefs.devices) + + types = sorted(types, key=CYCLES_GPUTYPES_PREFERENCE.index) + logger.info(f'Available devices have {types=}') + use_device_type = types[0] + + if use_device_type == 'CPU': + logger.warning(f'Render will use CPU-only, only found {types=}') + bpy.context.scene.cycles.device = 'CPU' + return + + bpy.context.preferences.addons['cycles'].preferences.compute_device_type = use_device_type + use_devices = [d for d in prefs.devices if d.type == use_device_type] + + + logger.info(f'Cycles will use {use_device_type=}, {len(use_devices)=}') + + for d in prefs.devices: + d.use = False + for d in use_devices: + d.use = True + + return use_devices + +@gin.configurable +def configure_blender( + render_engine='CYCLES', + motion_blur=False, + motion_blur_shutter=0.5, +): + bpy.context.preferences.system.scrollback = 0 + bpy.context.preferences.edit.undo_steps = 0 + + if render_engine == 'CYCLES': + configure_render_cycles() + configure_cycles_devices() + else: + raise ValueError(f'Unrecognized {render_engine=}') + + bpy.context.scene.render.use_motion_blur = motion_blur + if motion_blur: + bpy.context.scene.cycles.motion_blur_position = 'START' + bpy.context.scene.render.motion_blur_shutter = motion_blur_shutter import_addons(['ant_landscape', 'real_snow']) diff --git a/infinigen/core/placement/animation_policy.py b/infinigen/core/placement/animation_policy.py index 1a8fead77..3a6e4e883 100644 --- a/infinigen/core/placement/animation_policy.py +++ b/infinigen/core/placement/animation_policy.py @@ -170,15 +170,17 @@ class AnimPolicyRandomWalkLookaround: def __init__( self, speed=('uniform', 1, 2.5), - yaw_range=(-20, 20), - step_range=(10, 15), + step_speed_mult=('uniform', 0.5, 2), + yaw_sampler=('uniform',-20, 20), + step_range=('clip_gaussian', 3, 5, 0.5, 10), rot_vars=(5, 0, 5), motion_dir_zoff=('clip_gaussian', 0, 90, 0, 180) ): self.speed = random_general(speed) - self.yaw_range = yaw_range + self.step_speed_mult = step_speed_mult + self.yaw_sampler = yaw_sampler self.step_range = step_range self.rot_vars = rot_vars @@ -195,15 +197,16 @@ def __call__(self, obj, frame_curr, bvh, retry_pct): orig_motion_dir_euler = copy(self.motion_dir_euler) def sampler(): self.motion_dir_euler = copy(orig_motion_dir_euler) - self.motion_dir_euler[2] += np.deg2rad(U(*self.yaw_range)) - step = U(*self.step_range) + self.motion_dir_euler[2] += np.deg2rad(random_general(self.yaw_sampler)) + step = random_general(self.step_range) off = Euler(self.motion_dir_euler, 'XYZ').to_matrix() @ Vector((0, 0, -step)) off.z = 0 return off pos = walk_same_altitude(obj.location, sampler, bvh) - time = np.linalg.norm(pos - obj.location) / self.speed + step_speed = self.speed * random_general(self.step_speed_mult) + time = np.linalg.norm(pos - obj.location) / step_speed rot = np.array(obj.rotation_euler) + np.deg2rad(N(0, self.rot_vars, 3)) return Vector(pos), Vector(rot), time, 'BEZIER' diff --git a/infinigen/core/placement/camera.py b/infinigen/core/placement/camera.py index 7e3bb00f9..5e28d34ab 100644 --- a/infinigen/core/placement/camera.py +++ b/infinigen/core/placement/camera.py @@ -498,8 +498,8 @@ def animate_cameras( terrain_tags_ratio=scene_preprocessed['terrain_tags_ratio'] if strict_selection else {}, ) - for cam_rig in cam_rigs: + if policy_registry is None: if U() < follow_poi_chance and pois is not None and len(pois): policy = animation_policy.AnimPolicyFollowObject( @@ -511,7 +511,9 @@ def animate_cameras( policy = animation_policy.AnimPolicyRandomWalkLookaround() else: policy = policy_registry() + logger.info(f'Animating {cam_rig=} using {policy=}') + animation_policy.animate_trajectory( cam_rig, scene_preprocessed['terrain_bvh'], diff --git a/infinigen/core/rendering/render.py b/infinigen/core/rendering/render.py index 6416463ff..c8c13baaf 100644 --- a/infinigen/core/rendering/render.py +++ b/infinigen/core/rendering/render.py @@ -18,7 +18,7 @@ import numpy as np from imageio import imread, imwrite -from infinigen.infinigen_gpl.extras.enable_gpu import enable_gpu +from infinigen.core import init from infinigen.core.nodes.node_wrangler import Nodes, NodeWrangler from infinigen.core.placement import camera as cam_util from infinigen.core.rendering.post_render import (colorize_depth, colorize_flow, @@ -119,10 +119,26 @@ def compositor_postprocessing(nw, source, show=True, autoexpose=False, autoexpos if show: nw.new_node(Nodes.Composite, input_kwargs={'Image': source}) - return source.outputs[0] + return ( + source.outputs[0] + if hasattr(source, 'outputs') + else source + ) @gin.configurable -def configure_compositor_output(nw, frames_folder, image_denoised, image_noisy, passes_to_save, saving_ground_truth, use_denoised=False): +def configure_compositor_output( + nw, + frames_folder, + image_denoised, + image_noisy, + passes_to_save, + saving_ground_truth, + use_denoised=False +): + + if use_denoised and image_noisy is None: + raise ValueError(f'{use_denoised=} yet {image_noisy=}, denoiser was not actually enabled') + file_output_node = nw.new_node(Nodes.OutputFile, attrs={ "base_path": str(frames_folder), "format.file_format": 'OPEN_EXR' if saving_ground_truth else 'PNG', @@ -250,25 +266,40 @@ def postprocess_blendergt_outputs(frames_folder, output_stem): np.save(flow_dst_path.with_name(f"InstanceSegmentation{output_stem}.npy"), uniq_inst_array) imwrite(uniq_inst_path.with_name(f"InstanceSegmentation{output_stem}.png"), colorize_int_array(uniq_inst_array)) uniq_inst_path.unlink() + +def configure_compositor(frames_folder, passes_to_save, flat_shading): + compositor_node_tree = bpy.context.scene.node_tree + nw = NodeWrangler(compositor_node_tree) + + render_layers = nw.new_node(Nodes.RenderLayers) + final_image_denoised = compositor_postprocessing(nw, source=render_layers.outputs["Image"]) + + final_image_noisy = ( + compositor_postprocessing(nw, source=render_layers.outputs["Noisy Image"], show=False) + if bpy.context.scene.cycles.use_denoising else None + ) + + return configure_compositor_output( + nw, + frames_folder, + image_denoised=final_image_denoised, + image_noisy=final_image_noisy, + passes_to_save=passes_to_save, + saving_ground_truth=flat_shading + ) @gin.configurable def render_image( camera_id, - min_samples, - num_samples, - time_limit, frames_folder, - adaptive_threshold, - exposure, passes_to_save, - flat_shading, - use_dof=False, - dof_aperture_fstop=2.8, - motion_blur=False, - motion_blur_shutter=0.5, + flat_shading=False, render_resolution_override=None, excludes=[], + use_dof=False, + dof_aperture_fstop=2.8, ): + tic = time.time() camera_rig_id, subcam_id = camera_id @@ -276,30 +307,12 @@ def render_image( for exclude in excludes: bpy.data.objects[exclude].hide_render = True - with Timer("Enable GPU"): - devices = enable_gpu() - - with Timer("Render/Cycles settings"): - if motion_blur: bpy.context.scene.cycles.motion_blur_position = 'START' - - bpy.context.scene.cycles.samples = num_samples # i.e. infinity - bpy.context.scene.cycles.adaptive_min_samples = min_samples - bpy.context.scene.cycles.adaptive_threshold = adaptive_threshold # i.e. noise threshold - bpy.context.scene.cycles.time_limit = time_limit - - bpy.context.scene.cycles.film_exposure = exposure - bpy.context.scene.render.use_motion_blur = motion_blur - bpy.context.scene.render.motion_blur_shutter = motion_blur_shutter - - bpy.context.scene.cycles.use_denoising = True - try: - bpy.context.scene.cycles.denoiser = 'OPTIX' - except Exception as e: - warnings.warn(f"Cannot use OPTIX denoiser {e}") - tmp_dir = frames_folder.parent.resolve() / "tmp" - tmp_dir.mkdir(exist_ok=True) - bpy.context.scene.render.filepath = f"{tmp_dir}{os.sep}" + bpy.context.scene.cycles.device = 'GPU' + init.configure_cycles_devices() + tmp_dir = frames_folder.parent.resolve() / "tmp" + tmp_dir.mkdir(exist_ok=True) + bpy.context.scene.render.filepath = f"{tmp_dir}{os.sep}" if flat_shading: with Timer("Set object indices"): @@ -313,39 +326,23 @@ def render_image( global_flat_shading() - with Timer("Compositing Setup"): - if not bpy.context.scene.use_nodes: - bpy.context.scene.use_nodes = True - compositor_node_tree = bpy.context.scene.node_tree - nw = NodeWrangler(compositor_node_tree) - - render_layers = nw.new_node(Nodes.RenderLayers) - final_image_denoised = compositor_postprocessing(nw, source=render_layers.outputs["Image"]) - final_image_noisy = compositor_postprocessing(nw, source=render_layers.outputs["Noisy Image"], show=False) - - compositor_nodes = configure_compositor_output( - nw, - frames_folder, - image_denoised=final_image_denoised, - image_noisy=final_image_noisy, - passes_to_save=passes_to_save, - saving_ground_truth=flat_shading - ) + if not bpy.context.scene.use_nodes: + bpy.context.scene.use_nodes = True + file_slot_nodes = configure_compositor(frames_folder, passes_to_save, flat_shading) indices = dict(cam_rig=camera_rig_id, resample=0, subcam=subcam_id) ## Update output names fileslot_suffix = get_suffix({'frame': "####", **indices}) - for file_slot in compositor_nodes: + for file_slot in file_slot_nodes: file_slot.path = f"{file_slot.path}{fileslot_suffix}" - with Timer("get_camera"): - camera = cam_util.get_camera(camera_rig_id, subcam_id) - if use_dof == 'IF_TARGET_SET': - use_dof = camera.data.dof.focus_object is not None - if use_dof is not None: - camera.data.dof.use_dof = use_dof - camera.data.dof.aperture_fstop = dof_aperture_fstop + camera = cam_util.get_camera(camera_rig_id, subcam_id) + if use_dof == 'IF_TARGET_SET': + use_dof = camera.data.dof.focus_object is not None + if use_dof is not None: + camera.data.dof.use_dof = use_dof + camera.data.dof.aperture_fstop = dof_aperture_fstop if render_resolution_override is not None: bpy.context.scene.render.resolution_x = render_resolution_override[0] diff --git a/infinigen/datagen/configs/base.gin b/infinigen/datagen/configs/base.gin index 73c59a9bc..8b05f57ea 100644 --- a/infinigen/datagen/configs/base.gin +++ b/infinigen/datagen/configs/base.gin @@ -1,14 +1,14 @@ sample_scene_spec.config_distribution = [ ("forest", 4), - ("river", 4), - ("desert", 3), - ("coral_reef", 3), - ("cave", 2), - ("mountain", 2), - ("canyon", 2), - ("plain", 2), - ("cliff", 2), - ("coast", 2), + ("river", 8), + ("desert", 6), + ("coral_reef", 6), + ("cave", 4), + ("mountain", 4), + ("canyon", 4), + ("plain", 4), + ("cliff", 4), + ("coast", 4), ("arctic", 1), ("snowy_mountain", 1), ] \ No newline at end of file diff --git a/infinigen/datagen/configs/compute_platform/slurm.gin b/infinigen/datagen/configs/compute_platform/slurm.gin index 60f00401d..c12d23ff1 100644 --- a/infinigen/datagen/configs/compute_platform/slurm.gin +++ b/infinigen/datagen/configs/compute_platform/slurm.gin @@ -74,6 +74,6 @@ queue_opengl.hours = 24 queue_opengl.gpus = 1 ground_truth/queue_render.mem_gb = 48 -ground_truth/queue_render.hours = 24 +ground_truth/queue_render.hours = 48 ground_truth/queue_render.gpus = 0 ground_truth/queue_render.render_type = "flat" diff --git a/infinigen/datagen/configs/compute_platform/slurm_1h.gin b/infinigen/datagen/configs/compute_platform/slurm_1h.gin index 5a2189bf2..2081ed89f 100644 --- a/infinigen/datagen/configs/compute_platform/slurm_1h.gin +++ b/infinigen/datagen/configs/compute_platform/slurm_1h.gin @@ -7,8 +7,9 @@ queue_coarse.hours = 1 queue_fine_terrain.hours = 1 queue_populate.hours = 1 queue_render.hours = 1 -queue_upload.hours = 1 queue_mesh_save.hours = 1 queue_opengl.hours = 1 -queue_coarse.cpus = 8 \ No newline at end of file +queue_coarse.cpus = 8 + +queue_upload.hours = 24 \ No newline at end of file diff --git a/infinigen/datagen/configs/data_schema/monocular_video.gin b/infinigen/datagen/configs/data_schema/monocular_video.gin index 05733762c..e99d8b9a6 100644 --- a/infinigen/datagen/configs/data_schema/monocular_video.gin +++ b/infinigen/datagen/configs/data_schema/monocular_video.gin @@ -1,4 +1,4 @@ -iterate_scene_tasks.frame_range = [1, 192] +iterate_scene_tasks.frame_range = [1, 48] iterate_scene_tasks.view_block_size = 192 iterate_scene_tasks.cam_block_size = 8 iterate_scene_tasks.cam_id_ranges = [1, 1] diff --git a/infinigen/datagen/configs/gt_options/opengl_gt_noshortrender.gin b/infinigen/datagen/configs/gt_options/opengl_gt_noshortrender.gin index 56416831c..8ce7aee7c 100644 --- a/infinigen/datagen/configs/gt_options/opengl_gt_noshortrender.gin +++ b/infinigen/datagen/configs/gt_options/opengl_gt_noshortrender.gin @@ -1,4 +1,4 @@ -include 'opengl_gt.gin' # incase someone adds other settings to it +include 'gt_options/opengl_gt.gin' # incase someone adds other settings to it iterate_scene_tasks.camera_dependent_tasks = [ {'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 diff --git a/infinigen/datagen/configs/opengl_gt_noshortrender.gin b/infinigen/datagen/configs/opengl_gt_noshortrender.gin index 56416831c..5b07d93e1 100644 --- a/infinigen/datagen/configs/opengl_gt_noshortrender.gin +++ b/infinigen/datagen/configs/opengl_gt_noshortrender.gin @@ -1,7 +1,7 @@ -include 'opengl_gt.gin' # incase someone adds other settings to it +include 'gt_options/opengl_gt.gin' # incase someone adds other settings to it iterate_scene_tasks.camera_dependent_tasks = [ {'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 {'name': 'savemesh', 'func': @queue_mesh_save}, {'name': 'opengl', 'func': @queue_opengl} -] \ No newline at end of file +] diff --git a/infinigen/datagen/manage_jobs.py b/infinigen/datagen/manage_jobs.py index fb3f8b807..e5a6db3e5 100644 --- a/infinigen/datagen/manage_jobs.py +++ b/infinigen/datagen/manage_jobs.py @@ -201,9 +201,11 @@ def init_scene(seed_folder): } if 'configs' in existing_db.columns: - mask = existing_db["seed"].astype(str) == seed_folder.name + mask = (existing_db["seed"].astype(str) == seed_folder.name) + if not mask.any(): + raise ValueError(f"Couldnt find configs for {seed_folder.name}") configs = existing_db.loc[mask, "configs"].iloc[0] - scene_dict['configs']: list(configs) + scene_dict['configs'] = list(configs) finish_key = 'FINISH_' for finish_file_name in (seed_folder/'logs').glob(finish_key + '*'): @@ -282,7 +284,14 @@ def init_db(args): if args.use_existing: scenes = init_db_from_existing(args.output_folder) elif args.specific_seed is not None: - scenes = [{"seed": s, "all_done": SceneState.NotDone} for s in args.specific_seed] + scenes = [ + { + "seed": s, + "configs": args.configs, + "all_done": SceneState.NotDone + } + for s in args.specific_seed + ] else: scenes = [sample_scene_spec(args, i) for i in range(args.num_scenes)] diff --git a/infinigen_examples/configs/asset_demo.gin b/infinigen_examples/configs/asset_demo.gin index fbb5c08fb..87ac99931 100644 --- a/infinigen_examples/configs/asset_demo.gin +++ b/infinigen_examples/configs/asset_demo.gin @@ -1,9 +1,9 @@ compose_scene.inview_distance = 30 -full/render_image.min_samples = 50 -full/render_image.num_samples = 300 +full/configure_render_cycles.min_samples = 50 +full/configure_render_cycles.num_samples = 300 -render_image.motion_blur = False -render_image.use_dof = True +configure_blender.motion_blur = False +configure_blender.use_dof = True full/render_image.passes_to_save = [] \ No newline at end of file diff --git a/infinigen_examples/configs/base.gin b/infinigen_examples/configs/base.gin index 74b0242e7..65700cc3e 100644 --- a/infinigen_examples/configs/base.gin +++ b/infinigen_examples/configs/base.gin @@ -116,15 +116,21 @@ scatter_res_distance.dist = 4 random_color_mapping.hue_stddev = 0.05 # Note: 1.0 is the whole color spectrum render.render_image_func = @full/render_image -render_image.time_limit = 0 - -full/render_image.min_samples = 100 -full/render_image.num_samples = 8192 -render_image.adaptive_threshold = 0.005 -full/render_image.flat_shading = False +configure_render_cycles.time_limit = 0 + +configure_render_cycles.min_samples = 0 +configure_render_cycles.num_samples = 8192 +configure_render_cycles.adaptive_threshold = 0.01 +configure_render_cycles.denoise = False +configure_render_cycles.exposure = 1 +configure_blender.motion_blur_shutter = 0.15 +render_image.use_dof = False +render_image.dof_aperture_fstop = 3 +compositor_postprocessing.distort = False +compositor_postprocessing.color_correct = False -flat/render_image.min_samples = 1 -flat/render_image.num_samples = 1 +flat/configure_render_cycles.min_samples = 1 +flat/configure_render_cycles.num_samples = 16 flat/render_image.flat_shading = True full/render_image.passes_to_save = [ ['diffuse_direct', 'DiffDir'], @@ -148,17 +154,8 @@ flat/render_image.passes_to_save = [ ['object_index', 'IndexOB'] ] -render_image.exposure = 1 - -render_image.use_dof = False -render_image.dof_aperture_fstop = 3 -render_image.motion_blur = False -render_image.motion_blur_shutter = 0.15 - -compositor_postprocessing.distort = False -compositor_postprocessing.color_correct=True - execute_tasks.generate_resolution = (1280, 720) +execute_tasks.fps = 24 get_sensor_coords.H = 720 get_sensor_coords.W = 1280 diff --git a/infinigen_examples/configs/extras/experimental.gin b/infinigen_examples/configs/extras/experimental.gin index d9d5fed72..cba3d47fd 100644 --- a/infinigen_examples/configs/extras/experimental.gin +++ b/infinigen_examples/configs/extras/experimental.gin @@ -1,6 +1,6 @@ # things that are not quite fully working correctly, but you can use if you please -render_image.motion_blur = True # not fully supported in ground truth +configure_blender.motion_blur = True # not fully supported in ground truth compose_scene.rain_particles_chance = 0.1 # doesnt look good when not using motion blur # compose_scene.marine_snow_particles_chance = 0.1 # TODO only put this in underwater scenes diff --git a/infinigen_examples/configs/extras/overhead.gin b/infinigen_examples/configs/extras/overhead.gin new file mode 100644 index 000000000..028b8295a --- /dev/null +++ b/infinigen_examples/configs/extras/overhead.gin @@ -0,0 +1,10 @@ +animate_cameras.follow_poi_chance=0.0 +camera.camera_pose_proposal.altitude = ("clip_gaussian", 30, 20, 17, 70) +camera.camera_pose_proposal.pitch = ("clip_gaussian", 0, 30, 0, 15) + +placement.populate_all.dist_cull = 70 +compose_scene.inview_distance = 70 +compose_scene.near_distance = 40 +compose_scene.center_distance = 40 + +compose_scene.animate_cameras_enabled = False \ No newline at end of file diff --git a/infinigen_examples/configs/extras/stereo_training.gin b/infinigen_examples/configs/extras/stereo_training.gin index cdefa2775..1d5d989ba 100644 --- a/infinigen_examples/configs/extras/stereo_training.gin +++ b/infinigen_examples/configs/extras/stereo_training.gin @@ -1,6 +1,6 @@ # eliminate blurs / distortion that cause blurs or bad alignment of the depth map compositor_postprocessing.distort = False -render_image.motion_blur = False +configure_blender.motion_blur = False render_image.use_dof = False # remove volume scatters, as the corrupt blender's depth map diff --git a/infinigen_examples/configs/extras/use_cached_fire.gin b/infinigen_examples/configs/extras/use_cached_fire.gin index aa4975c0d..0c1750088 100644 --- a/infinigen_examples/configs/extras/use_cached_fire.gin +++ b/infinigen_examples/configs/extras/use_cached_fire.gin @@ -10,7 +10,7 @@ compose_scene.cached_fire_boulders_chance = 0.3 compose_scene.cached_fire_cactus_chance = 0.4 -render_image.exposure = 0.4 +configure_render_cycles.exposure = 0.4 compose_scene.cached_fire = True populate_scene.cached_fire = True diff --git a/infinigen_examples/configs/extras/use_on_the_fly_fire.gin b/infinigen_examples/configs/extras/use_on_the_fly_fire.gin index c1af08d7a..625c1150b 100644 --- a/infinigen_examples/configs/extras/use_on_the_fly_fire.gin +++ b/infinigen_examples/configs/extras/use_on_the_fly_fire.gin @@ -7,15 +7,12 @@ populate_scene.boulders_fire_on_the_fly_chance = 0.1 populate_scene.cactus_fire_on_the_fly_chance = 0.1 compose_scene.glowing_rocks_chance = 0.0 - - - -render_image.exposure = 0.4 compose_scene.cached_fire = False LandTiles.land_process = None #scene.voronoi_rocks_chance = 1 #animate_cameras.follow_poi_chance=0 +configure_render_cycles.exposure = 0.4 set_obj_on_fire.resolution = 430 set_obj_on_fire.dissolve_speed = 25 diff --git a/infinigen_examples/configs/noisy_video.gin b/infinigen_examples/configs/noisy_video.gin new file mode 100644 index 000000000..851dffaa6 --- /dev/null +++ b/infinigen_examples/configs/noisy_video.gin @@ -0,0 +1,5 @@ +export.spherical = False # use OcMesher +AnimPolicyRandomWalkLookaround.speed = ("uniform", 3, 10) +AnimPolicyRandomWalkLookaround.yaw_sampler = ("uniform", -50, 50) +AnimPolicyRandomWalkLookaround.step_range = ('clip_gaussian', 1, 3, 0.6, 5) +execute_tasks.fps = 16 diff --git a/infinigen_examples/configs/performance/dev.gin b/infinigen_examples/configs/performance/dev.gin index 5e4862a85..ad0fed64b 100644 --- a/infinigen_examples/configs/performance/dev.gin +++ b/infinigen_examples/configs/performance/dev.gin @@ -1,7 +1,7 @@ execute_tasks.generate_resolution = (960, 540) -full/render_image.min_samples = 32 -full/render_image.num_samples = 512 +full/configure_render_cycles.min_samples = 32 +full/configure_render_cycles.num_samples = 512 OpaqueSphericalMesher.pixels_per_cube = 4 TransparentSphericalMesher.pixels_per_cube = 4 diff --git a/infinigen_examples/configs/performance/high_quality_terrain.gin b/infinigen_examples/configs/performance/high_quality_terrain.gin index 068eae244..881bd9318 100644 --- a/infinigen_examples/configs/performance/high_quality_terrain.gin +++ b/infinigen_examples/configs/performance/high_quality_terrain.gin @@ -1,4 +1,4 @@ -OcMesher.pixels_per_cube = 3 +OcMesher.pixels_per_cube = 4 OpaqueSphericalMesher.pixels_per_cube = 0.92 TransparentSphericalMesher.pixels_per_cube = 1.38 diff --git a/infinigen_examples/configs/performance/simple.gin b/infinigen_examples/configs/performance/simple.gin index 6ec06efc6..9d3c44c86 100644 --- a/infinigen_examples/configs/performance/simple.gin +++ b/infinigen_examples/configs/performance/simple.gin @@ -2,4 +2,4 @@ include 'performance/dev.gin' include 'disable_assets/no_creatures.gin' include 'performance/fast_terrain_assets.gin' run_erosion.n_iters = [1,1] -full/render_image.num_samples = 100 \ No newline at end of file +full/configure_render_cycles.num_samples = 100 \ No newline at end of file diff --git a/infinigen_examples/configs/scene_types/cave.gin b/infinigen_examples/configs/scene_types/cave.gin index 4f879a609..c80f07289 100644 --- a/infinigen_examples/configs/scene_types/cave.gin +++ b/infinigen_examples/configs/scene_types/cave.gin @@ -34,7 +34,7 @@ compose_scene.flying_creature_registry = [ ] atmosphere_light_haze.shader_atmosphere.enable_scatter = False -render_image.exposure = 1.3 +configure_render_cycles.exposure = 1.3 # scene composition config @@ -51,8 +51,6 @@ Caves.scale_increase = 1 scene.waterbody_chance = 0.8 Waterbody.height = -5 -full/render_image.min_samples = 500 - # camera selection config Terrain.populated_bounds = (-25, 25, -25, 25, -25, 0) keep_cam_pose_proposal.terrain_coverage_range = (1, 1) diff --git a/infinigen_examples/configs/scene_types/under_water.gin b/infinigen_examples/configs/scene_types/under_water.gin index 8fb604944..0ec73b52a 100644 --- a/infinigen_examples/configs/scene_types/under_water.gin +++ b/infinigen_examples/configs/scene_types/under_water.gin @@ -72,9 +72,6 @@ Atmosphere.hacky_offset = 0.1 WarpedRocks.slope_shift = -23 scene.waterbody_chance = 1 -full/render_image.min_samples = 100 -render_image.adaptive_threshold = 0.01 - Terrain.under_water = 1 compose_scene.turbulence_chance = 0.7 diff --git a/infinigen_examples/configs/trailer_video.gin b/infinigen_examples/configs/trailer_video.gin new file mode 100644 index 000000000..86f8a555f --- /dev/null +++ b/infinigen_examples/configs/trailer_video.gin @@ -0,0 +1,8 @@ +export.spherical = False # use OcMesher +AnimPolicyRandomWalkLookaround.speed=('uniform', 1, 2.5), +AnimPolicyRandomWalkLookaround.step_speed_mult=('uniform', 0.5, 2), +AnimPolicyRandomWalkLookaround.yaw_sampler=('uniform',-20, 20), +AnimPolicyRandomWalkLookaround.step_range=('clip_gaussian', 3, 5, 0.5, 10), +AnimPolicyRandomWalkLookaround.rot_vars=(5, 0, 5), +AnimPolicyRandomWalkLookaround.motion_dir_zoff=('clip_gaussian', 0, 90, 0, 180) +execute_tasks.fps = 16 \ No newline at end of file diff --git a/infinigen_examples/configs/video.gin b/infinigen_examples/configs/video.gin deleted file mode 100644 index e412998c5..000000000 --- a/infinigen_examples/configs/video.gin +++ /dev/null @@ -1 +0,0 @@ -export.spherical = False # use OcMesher \ No newline at end of file diff --git a/infinigen_examples/generate_individual_assets.py b/infinigen_examples/generate_individual_assets.py index 7442933f9..270a5d705 100644 --- a/infinigen_examples/generate_individual_assets.py +++ b/infinigen_examples/generate_individual_assets.py @@ -275,6 +275,8 @@ def main(args): init.apply_gin_configs('infinigen_examples/configs') surface.registry.initialize_from_gin() + init.configure_blender() + extras = '[%(filename)s:%(lineno)d] ' if args.loglevel == logging.DEBUG else '' logging.basicConfig( format=f'[%(asctime)s.%(msecs)03d] [%(name)s] [%(levelname)s] {extras}| %(message)s', @@ -345,7 +347,6 @@ def make_args(): parser.add_argument('-l', '--lighting', default=0, type=int, help="Lighting seed") parser.add_argument('-o', '--cam_zoff', '--z_offset', type=float, default=.0, help="Additional offset on Z axis for camera look-at positions") - parser.add_argument('-g', '--gpu', action='store_true', help="Whether to use gpu in rendering") parser.add_argument('-s', '--save_blend', action='store_true', help="Whether to save .blend file") parser.add_argument('-e', '--elevation', default=60, type=float, help="Elevation of the sun") parser.add_argument('--cam_dist', default=0, type=float, diff --git a/scripts/launch/render_stereo_1h.sh b/scripts/launch/render_stereo_1h.sh deleted file mode 100644 index 7384160eb..000000000 --- a/scripts/launch/render_stereo_1h.sh +++ /dev/null @@ -1,7 +0,0 @@ -HOSTFIRST=$(hostname | tr "." "\n" | head -n 1) -JOBNAME=$(date '+%m_%d_%H_%M').$HOSTFIRST.$1 - -python -m infinigen.datagen.manage_jobs --output_folder outputs/$JOBNAME \ - --num_scenes 10000 --pipeline_config stereo $@ cuda_terrain opengl_gt upload \ - --wandb_mode online --cleanup except_crashed --warmup_sec 10000 \ - --configs high_quality_terrain diff --git a/scripts/launch/render_video_1080p.sh b/scripts/launch/render_video_1080p.sh deleted file mode 100644 index 532611b7d..000000000 --- a/scripts/launch/render_video_1080p.sh +++ /dev/null @@ -1,8 +0,0 @@ -HOSTFIRST=$(hostname | tr "." "\n" | head -n 1) -JOBNAME=$(date '+%m_%d_%H_%M').$HOSTFIRST.$1 - -python -m infinigen.datagen.manage_jobs --output_folder outputs/$JOBNAME \ - --num_scenes 100 --pipeline_config $@ stereo_video cuda_terrain opengl_gt_noshortrender upload \ - --wandb_mode online --cleanup big_files \ - --warmup_sec 40000 \ - --config high_quality_terrain diff --git a/scripts/launch/render_video_720p.sh b/scripts/launch/render_video_720p.sh deleted file mode 100644 index 9e75769f1..000000000 --- a/scripts/launch/render_video_720p.sh +++ /dev/null @@ -1,8 +0,0 @@ -HOSTFIRST=$(hostname | tr "." "\n" | head -n 1) -JOBNAME=$(date '+%m_%d_%H_%M').$HOSTFIRST.$1 - -python -m infinigen.datagen.manage_jobs --output_folder outputs/$JOBNAME \ - --num_scenes 1000 --pipeline_config $@ stereo_video cuda_terrain opengl_gt upload \ - --wandb_mode online --cleanup except_crashed --warmup_sec 25000 \ - --config high_quality_terrain \ - --overrides compose_scene.generate_resolution=[1280,720] diff --git a/scripts/launch/render_video_stereo.sh b/scripts/launch/render_video_stereo.sh deleted file mode 100644 index 24f2a4a98..000000000 --- a/scripts/launch/render_video_stereo.sh +++ /dev/null @@ -1,7 +0,0 @@ -HOSTFIRST=$(hostname | tr "." "\n" | head -n 1) -JOBNAME=$(date '+%m_%d_%H_%M').$HOSTFIRST.$1 - -python -m infinigen.datagen.manage_jobs --output_folder outputs/$JOBNAME \ - --num_scenes 1000 --pipeline_config stereo_video $@ cuda_terrain opengl_gt upload \ - --wandb_mode online --cleanup except_crashed --warmup_sec 10000 \ - --configs high_quality_terrain video