Exporters (.exporters)#
Exporter Utilities (.exporters.util)#
blender_render#
- class infinigen2.exporters.util.blender_render.DisplacementMode(value)[source]#
Bases:
Enum- NONE = 'NONE'#
- BUMP = 'BUMP'#
- DISPLACEMENT = 'DISPLACEMENT'#
- DISPLACEMENT_AND_BUMP = 'BOTH'#
- REALIZE_MESH = 'REALIZE_MESH'#
- class infinigen2.exporters.util.blender_render.ViewLayerPass(pass_name: str, socket_name: str, result_suffix: str)[source]#
Bases:
object
- infinigen2.exporters.util.blender_render.configure_compositor_viewlayer_output(
- ...,
- Parameters:
render_passes (list[RenderPass])
frames_folder (Path)
camera_name (str)
view_layer (ViewLayer)
aov_mapping (dict[ExportType, str] | None) -- (default:
None)autorender_pass_type (ExportType | None) -- (default:
None)
- infinigen2.exporters.util.blender_render.override_shading_for_gt(objects)[source]#
- Parameters:
objects (list[pf.MeshObject])
- infinigen2.exporters.util.blender_render.postprocess_renderpass_frame(...) Path[source]#
- Parameters:
render_pass (RenderPass)
from_path (Path)
to_path (Path)
camera (CameraObject | None) -- (default:
None)
- infinigen2.exporters.util.blender_render.postprocess_renderpass_paths(...) list[Path][source]#
- Parameters:
from_template (Path)
to_template (Path)
pass_config (RenderPass)
camera (CameraObject)
frame_start (int)
frame_end (int)
eevee_aov#
- infinigen2.exporters.util.eevee_aov.configure_materials_for_aovs(aov_mapping)[source]#
Add AOV output nodes to all materials for object and material indices.
- Parameters:
aov_mapping (Dict[ExportType, str])
- infinigen2.exporters.util.eevee_aov.setup_eevee_aovs(
- view_layer,
- render_passes,
Setup AOVs in the view layer for the requested render passes.
Returns mapping from ExportType to AOV name that was created.
- Parameters:
view_layer (ViewLayer)
render_passes (List[RenderPass])
export_utils#
flow_vis#
- infinigen2.exporters.util.flow_vis.flow_to_color(flow_uv, clip_flow=None, convert_to_bgr=False)[source]#
Expects a two dimensional flow image of shape.
- Parameters:
- Returns:
Flow visualization image of shape [H,W,3]
- Return type:
np.ndarray
- infinigen2.exporters.util.flow_vis.flow_uv_to_colors(u, v, convert_to_bgr=False)[source]#
Applies the flow color wheel to (possibly clipped) flow components u and v.
According to the C++ source code of Daniel Scharstein According to the Matlab source code of Deqing Sun
- Parameters:
u (np.ndarray) -- Input horizontal flow of shape [H,W]
v (np.ndarray) -- Input vertical flow of shape [H,W]
convert_to_bgr (bool, optional) -- Convert output image to BGR. Defaults to False.
- Returns:
Flow visualization image of shape [H,W,3]
- Return type:
np.ndarray
- infinigen2.exporters.util.flow_vis.make_colorwheel()[source]#
- Generates a color wheel for optical flow visualization as presented in:
Baker et al. “A Database and Evaluation Methodology for Optical Flow” (ICCV, 2007) URL: http://vision.middlebury.edu/flow/flowEval-iccv07.pdf
Code follows the original C++ source code of Daniel Scharstein. Code follows the the Matlab source code of Deqing Sun.
- Returns:
Color wheel
- Return type:
np.ndarray
format#
- class infinigen2.exporters.util.format.Compression(value)[source]#
Bases:
Enum- NONE = 'none'#
- TARBALL = 'tarball'#
- VIDEO = 'video'#
- class infinigen2.exporters.util.format.ExportType(value)[source]#
Bases:
Enum- CAMERA = 'camera'#
- IMAGE = 'rgb'#
- IMAGE_DENOISED = 'rgb-denoised'#
- IMAGE_HDR = 'rgb-hdr'#
- IMAGE_DENOISED_HDR = 'rgb-denoised-hdr'#
- BLENDER_FILE = 'scene'#
- CAM_IMU_TUM_TRAJ = 'cam-trajectory-imu-tum'#
- OBJ_IMU_TUM_TRAJ = 'obj-trajectory-imu-tum'#
- MESH = 'mesh'#
- OBJECTS_FILE = 'objects'#
- OPTICAL_FLOW = 'optical-flow'#
- DEPTH_CHANGE = 'depth-change'#
- FLOW_3D = 'flow-3d'#
- FLOW_MASK_MATCHED = 'flow-mask-matched'#
- FLOW_MASK_CYCLECONSISTENCY = 'flow-mask-cycle-consistency'#
- INV_FLOW = 'inv-flow-3d'#
- POINT_TRAJECTORIES = 'point-trajectories-3d'#
- INV_POINT_TRAJECTORIES = 'inv-point-trajectories-3d'#
- DEPTH = 'depth'#
- SURFACE_NORMAL = 'surface-normal'#
- SURFACE_NORMAL_WORLD = 'surface-normal-world'#
- OCCLUSION_BOUNDARIES = 'occlusion'#
- OBJECT_INDEX = 'semantic-segmentation'#
- INSTANCE_SEGMENTATION = 'instance-segmentation'#
- MATERIAL_INDEX = 'material-segmentation'#
- OBJECT_INDEX_TABLE = 'object-index-table'#
- MATERIAL_INDEX_TABLE = 'material-index-table'#
- ATTRIBUTE_MASK = 'attribute-mask'#
- VISUALIZATIONS = 'visualizations'#
- DIFFUSE_COLOR = 'diffuse-color'#
- AMBIENT_OCCLUSION = 'ambient-occlusion'#
- DIFFUSE_DIRECT = 'diffuse-direct'#
- DIFFUSE_INDIRECT = 'diffuse-indirect'#
- GLOSSY_DIRECT = 'glossy-direct'#
- GLOSSY_INDIRECT = 'glossy-indirect'#
- TRANSMISSION_DIRECT = 'transmission-direct'#
- TRANSMISSION_INDIRECT = 'transmission-indirect'#
- VOLUME_DIRECT = 'volume-direct'#
- EMISSION = 'emission'#
- ENVIRONMENT = 'environment'#
- class infinigen2.exporters.util.format.RenderPass(
- type: ExportType,
- path: Path,
- data_type: dtype,
Bases:
object- Parameters:
type (ExportType)
path (Path)
data_type (dtype)
- infinigen2.exporters.util.format.ensure_path_placeholders(render_pass) RenderPass[source]#
Add %f and %c placeholders to path if missing.
- Parameters:
render_pass (RenderPass)
Module contents#
imu#
render_cycles#
- class infinigen2.exporters.render_cycles.DenoiseMode(value)[source]#
Bases:
Enum- NONE = 'none'#
- BEST = 'best'#
- OPTIX = 'OPTIX'#
- OPENIMAGEDENOISE = 'OPENIMAGEDENOISE'#
- infinigen2.exporters.render_cycles.configure_cycles_devices(device_type='BEST_AVAILABLE')[source]#
- Parameters:
device_type (str) -- (default:
'BEST_AVAILABLE')
- infinigen2.exporters.render_cycles.configure_cycles_performance(...)[source]#
- Parameters:
max_samples (int)
min_samples (int)
samples_adaptive_threshold (float)
film_exposure (float)
volume_step_rate (float)
volume_preview_step_rate (float)
volume_max_steps (int)
volume_bounces (int)
max_bounces (int)
diffuse_bounces (int)
glossy_bounces (int)
sample_clamp_indirect (float)
sample_clamp_direct (float)
transmission_bounces (int)
- infinigen2.exporters.render_cycles.render_cycles(
- ...,
- Parameters:
objects (list[pf.MeshObject])
camera (CameraObject)
output_folder (Path)
render_passes (list[RenderPass])
frame_start (int) -- (default:
1)frame_end (int) -- (default:
1)frame_rate (int) -- (default:
24)device_type (str) -- (default:
'BEST_AVAILABLE')view_layer (ViewLayer) -- (default:
None)depth_of_field_fstop (float | None) -- (default:
None)motion_blur_shutter (float | None) -- (default:
None)displacement_mode (DisplacementMode) -- (default:
<DisplacementMode.DISPLACEMENT_AND_BUMP: 'BOTH'>)render_skip_existing (bool) -- (default:
False)min_samples (int) -- (default:
32)max_samples (int) -- (default:
256)samples_adaptive_threshold (float) -- (default:
0.01)film_exposure (float) -- (default:
1.0)volume_step_rate (float) -- (default:
0.1)volume_preview_step_rate (float) -- (default:
0.1)volume_max_steps (int) -- (default:
32)volume_bounces (int) -- (default:
4)max_bounces (int) -- (default:
4)diffuse_bounces (int) -- (default:
4)glossy_bounces (int) -- (default:
4)sample_clamp_indirect (float) -- (default:
10.0)sample_clamp_direct (float) -- (default:
10.0)transmission_bounces (int) -- (default:
2)denoise_mode (DenoiseMode) -- (default:
<DenoiseMode.BEST: 'best'>)
- infinigen2.exporters.render_cycles.render_cycles_ground_truth(
- ...,
- Parameters:
objects (list[pf.MeshObject])
camera (CameraObject)
output_folder (Path)
render_passes (list[RenderPass])
frame_start (int) -- (default:
1)frame_end (int) -- (default:
1)frame_rate (int) -- (default:
24)device_type (str) -- (default:
'BEST_AVAILABLE')view_layer (ViewLayer) -- (default:
None)depth_of_field_fstop (float | None) -- (default:
None)motion_blur_shutter (float | None) -- (default:
None)displacement_mode (DisplacementMode) -- (default:
<DisplacementMode.DISPLACEMENT_AND_BUMP: 'BOTH'>)render_skip_existing (bool) -- (default:
False)min_samples (int) -- (default:
32)max_samples (int) -- (default:
256)samples_adaptive_threshold (float) -- (default:
0.01)film_exposure (float) -- (default:
1.0)volume_step_rate (float) -- (default:
0.1)volume_preview_step_rate (float) -- (default:
0.1)volume_max_steps (int) -- (default:
32)volume_bounces (int) -- (default:
4)max_bounces (int) -- (default:
4)diffuse_bounces (int) -- (default:
4)glossy_bounces (int) -- (default:
4)sample_clamp_indirect (float) -- (default:
10.0)sample_clamp_direct (float) -- (default:
10.0)transmission_bounces (int) -- (default:
2)denoise_mode (DenoiseMode) -- (default:
<DenoiseMode.BEST: 'best'>)
render_eevee#
- class infinigen2.exporters.render_eevee.RenderEeveeParams(
- taa_render_samples: int = 64,
- use_taa_reprojection: bool = True,
- film_exposure: float = 1.0,
- taa_samples: int = 16,
- use_gtao: bool = False,
- gtao_distance: float = 0.2,
- gtao_quality: float = 0.25,
- use_shadows: bool = True,
- shadow_pool_size: int = '512',
- shadow_ray_count: int = 1,
- shadow_resolution_scale: float = 1.0,
- shadow_step_count: int = 6,
- use_raytracing: bool = False,
- ray_tracing_method: str = 'SCREEN',
- use_fast_gi: bool = False,
- fast_gi_method: str = 'GLOBAL_ILLUMINATION',
- fast_gi_ray_count: int = 2,
- fast_gi_resolution: str = '2',
- fast_gi_step_count: int = 8,
- fast_gi_quality: float = 0.25,
- fast_gi_bias: float = 0.05,
- fast_gi_distance: float = 0.0,
- fast_gi_thickness_far: float = 0.785,
- fast_gi_thickness_near: float = 0.25,
- use_overscan: bool = False,
- overscan_size: float = 3.0,
- use_volume_custom_range: bool = False,
- volumetric_start: float = 0.1,
- volumetric_end: float = 100.0,
- volumetric_samples: int = 64,
- volumetric_shadow_samples: int = 16,
- volumetric_tile_size: str = '8',
- volumetric_sample_rand: float = 0.8,
- volumetric_light_clamp: float = 0.0,
- volumetric_ray_depth: int = 16,
- use_volumetric_shadows: bool = False,
Bases:
object- Parameters:
taa_render_samples (int)
use_taa_reprojection (bool)
film_exposure (float)
taa_samples (int)
use_gtao (bool)
gtao_distance (float)
gtao_quality (float)
use_shadows (bool)
shadow_pool_size (int)
shadow_ray_count (int)
shadow_resolution_scale (float)
shadow_step_count (int)
use_raytracing (bool)
ray_tracing_method (str)
use_fast_gi (bool)
fast_gi_method (str)
fast_gi_ray_count (int)
fast_gi_resolution (str)
fast_gi_step_count (int)
fast_gi_quality (float)
fast_gi_bias (float)
fast_gi_distance (float)
fast_gi_thickness_far (float)
fast_gi_thickness_near (float)
use_overscan (bool)
overscan_size (float)
use_volume_custom_range (bool)
volumetric_start (float)
volumetric_end (float)
volumetric_samples (int)
volumetric_shadow_samples (int)
volumetric_tile_size (str)
volumetric_sample_rand (float)
volumetric_light_clamp (float)
volumetric_ray_depth (int)
use_volumetric_shadows (bool)
- infinigen2.exporters.render_eevee.configure_eevee_params(params)[source]#
- Parameters:
params (RenderEeveeParams)
- infinigen2.exporters.render_eevee.render_eevee(
- ...,
Render using Eevee with multiple passes
- Parameters:
objects (list[pf.MeshObject])
camera (CameraObject)
output_folder (Path)
render_passes (list[RenderPass])
frame_start (int)
frame_end (int)
frame_rate (int) -- (default:
24)view_layer (ViewLayer) -- (default:
None)depth_of_field_fstop (float | None) -- (default:
None)motion_blur_shutter (float | None) -- (default:
None)displacement_mode (DisplacementMode) -- (default:
<DisplacementMode.DISPLACEMENT_AND_BUMP: 'BOTH'>)allow_gt_types (bool) -- (default:
False)parameters (Unpack[RenderEeveeParams])
- infinigen2.exporters.render_eevee.render_eevee_ground_truth(
- ...,
- Parameters:
objects (list[pf.MeshObject])
camera (CameraObject)
output_folder (Path)
render_passes (list[RenderPass])
frame_start (int)
frame_end (int)
frame_rate (int) -- (default:
24)view_layer (ViewLayer) -- (default:
None)depth_of_field_fstop (float | None) -- (default:
None)motion_blur_shutter (float | None) -- (default:
None)displacement_mode (DisplacementMode) -- (default:
<DisplacementMode.DISPLACEMENT_AND_BUMP: 'BOTH'>)parameters (Unpack[RenderEeveeParams])
render_error_check#
- exception infinigen2.exporters.render_error_check.CyclesShaderError[source]#
Bases:
RuntimeError
- exception infinigen2.exporters.render_error_check.DisplacementCoordError[source]#
Bases:
ValueError
- exception infinigen2.exporters.render_error_check.ShaderTooComplexError[source]#
Bases:
RuntimeError
- exception infinigen2.exporters.render_error_check.UVCoordError[source]#
Bases:
ValueError
- class infinigen2.exporters.render_error_check.UVLayerInfo(active_render, names, degenerate)[source]#
Bases:
NamedTuple
- infinigen2.exporters.render_error_check.assert_displacement_coords_safe(
- objects=None,
- displacement_mode=DisplacementMode.DISPLACEMENT_AND_BUMP,
Geometric displacement (DISPLACEMENT/BOTH) silently flattens when driven by named-attribute nodes; fail loudly listing the offending materials.
- Parameters:
objects (list[pf.MeshObject] | None) -- (default:
None)displacement_mode (DisplacementMode) -- (default:
<DisplacementMode.DISPLACEMENT_AND_BUMP: 'BOTH'>)
- infinigen2.exporters.render_error_check.assert_shader_complexity_ok(objects=None)[source]#
- Parameters:
objects (list[pf.MeshObject] | None) -- (default:
None)
- infinigen2.exporters.render_error_check.assert_uv_coords_satisfied(objects=None)[source]#
Materials that sample UV coordinates absent or degenerate on the mesh render flat (the wall_art-class bug); fail loudly.
- Parameters:
objects (list[pf.MeshObject] | None) -- (default:
None)
- infinigen2.exporters.render_error_check.check_material_uv_coords(obj, material=None, mat_index=None) list[str][source]#
Diagnose whether material’s UV sampling is satisfied by obj’s realized UV layers. Pass EITHER a material or a mat_index into obj.data.materials; defaults to obj.active_material. Returns a list of issue messages (empty == ok); never raises — callers decide whether to escalate.
- Parameters:
obj (Object)
material (pf.Material | None) -- (default:
None)mat_index (int | None) -- (default:
None)
- infinigen2.exporters.render_error_check.count_material_nodes(material) int[source]#
Flattened node count for one material, as Cycles compiles it (every group instance inlined). The caller applies SHADER_NODE_COUNT_FAIL and raises ShaderTooComplexError as it sees fit.
- Parameters:
material (pf.Material)
- infinigen2.exporters.render_error_check.detect_cycles_errors(replay=True) Iterator[None][source]#
- Parameters:
replay (bool) -- (default:
True)
- infinigen2.exporters.render_error_check.render_validity_check(
- objects,
- displacement_mode=DisplacementMode.DISPLACEMENT_AND_BUMP,
Run every render_cycles validity check (displacement coords, shader complexity, UV coords) WITHOUT rendering, so scenes/refactors can be error-checked cheaply. Raises on the first failure.
- Parameters:
objects (list[pf.MeshObject])
displacement_mode (DisplacementMode) -- (default:
<DisplacementMode.DISPLACEMENT_AND_BUMP: 'BOTH'>)
- infinigen2.exporters.render_error_check.unsafe_displacement_materials(materials=None) dict[str, str][source]#
Map material name -> offending named-attribute node bl_idname for every material whose Displacement output is driven by one. Defaults to all in-use scene materials. No raise; the caller escalates.
- Parameters:
materials (list[pf.Material] | None) -- (default:
None)
render_workbench#
- infinigen2.exporters.render_workbench.render_workbench(
- ...,
- Parameters:
objects (list[pf.MeshObject])
camera (CameraObject)
output_folder (Path)
render_passes (list[RenderPass])
frame_start (int) -- (default:
1)frame_end (int) -- (default:
1)frame_rate (int) -- (default:
24)displacement_mode (DisplacementMode) -- (default:
<DisplacementMode.DISPLACEMENT_AND_BUMP: 'BOTH'>)render_skip_existing (bool) -- (default:
False)lighting (str) -- (default:
'MATCAP')color_type (str) -- (default:
'RANDOM')studio_light (str) -- (default:
'studio.sl')matcap_light (str) -- (default:
'basic_1.exr')samples (int) -- (default:
16)
visualize_gt#
- infinigen2.exporters.visualize_gt.load_data(input_path) ndarray[source]#
Load data from either OpenEXR or NPY file.
- Parameters:
input_path (Path)
- infinigen2.exporters.visualize_gt.load_single_channel(input_path) ndarray[source]#
Load single channel data from either OpenEXR or NPY file.
- Parameters:
input_path (Path)
- infinigen2.exporters.visualize_gt.mask_to_transparency_checkerboard(img, mask, checker_size=16) ndarray[source]#
- infinigen2.exporters.visualize_gt.visualize_any_frametype(export_type, frames, output_folder) list[Path][source]#
Visualize a sequence of frames with consistent normalization.
- Parameters:
export_type (ExportType) -- Type of data to visualize
output_path -- Directory to save visualizations
output_folder (Path)
- Returns:
List of output paths for the visualizations
- infinigen2.exporters.visualize_gt.visualize_gt(
- exports,
- output_folder,
- Parameters:
exports (dict[ExportType, list[Path]] | list[dict[ExportType, list[Path]]])
output_folder (Path)