blenderproc.python.renderer.RendererUtility module

blenderproc.python.renderer.RendererUtility._disable_all_denoiser()[source]

Disables all denoiser.

At the moment this includes the cycles and the intel denoiser.

blenderproc.python.renderer.RendererUtility._render_init()[source]

Initializes the renderer.

This enables the cycles renderer and sets some options to speedup rendering.

blenderproc.python.renderer.RendererUtility.enable_depth_output(activate_antialiasing, output_dir=None, file_prefix='depth_', output_key='depth', antialiasing_distance_max=None, convert_to_distance=False)[source]

Enables writing depth images.

Depth images will be written in the form of .exr files during the next rendering.

Parameters:
  • activate_antialiasing (bool) – If this is True the final image will be antialiased
  • output_dir (Optional[str]) – The directory to write files to, if this is None the temporary directory is used.
  • file_prefix (str) – The prefix to use for writing the files.
  • output_key (str) – The key to use for registering the depth output.
  • antialiasing_distance_max (Optional[float]) – Max distance in which the distance is measured. Only if activate_antialiasing is True.
  • convert_to_distance (bool) – If this is true, while loading a postprocessing step is executed to convert this depth image to a distance image
blenderproc.python.renderer.RendererUtility.enable_diffuse_color_output(output_dir=None, file_prefix='diffuse_', output_key='diffuse')[source]

Enables writing diffuse color (albedo) images.

Diffuse color images will be written in the form of .png files during the next rendering.

Parameters:
  • output_dir (Optional[str]) – The directory to write files to, if this is None the temporary directory is used.
  • file_prefix (str) – The prefix to use for writing the files.
  • output_key (str) – The key to use for registering the diffuse color output.
blenderproc.python.renderer.RendererUtility.enable_distance_output(activate_antialiasing, output_dir=None, file_prefix='distance_', output_key='distance', antialiasing_distance_max=None, convert_to_depth=False)[source]

Enables writing distance images.

Parameters:
  • activate_antialiasing (bool) – If this is True the final image will be antialiased
  • output_dir (Optional[str]) – The directory to write files to, if this is None the temporary directory is used.
  • file_prefix (str) – The prefix to use for writing the files.
  • output_key (str) – The key to use for registering the distance output.
  • antialiasing_distance_max (Optional[float]) – Max distance in which the distance is measured. Resolution decreases antiproportionally. Only if activate_antialiasing is True.
  • convert_to_depth (bool) – If this is true, while loading a postprocessing step is executed to convert this distance image to a depth image
blenderproc.python.renderer.RendererUtility.enable_motion_blur(motion_blur_length=0.5, rolling_shutter_type='NONE', rolling_shutter_length=0.1)[source]

Enables motion blur and sets rolling shutter.

Parameters:
  • motion_blur_length (float) – Time taken in frames between shutter open and close.
  • rolling_shutter_type (str) – Type of rolling shutter effect. If “NONE”, rolling shutter is disabled.
  • rolling_shutter_length (float) – Scanline “exposure” time for the rolling shutter effect.
blenderproc.python.renderer.RendererUtility.enable_normals_output(output_dir=None, file_prefix='normals_', output_key='normals')[source]

Enables writing normal images.

Normal images will be written in the form of .exr files during the next rendering.

Parameters:
  • output_dir (Optional[str]) – The directory to write files to, if this is None the temporary directory is used.
  • file_prefix (str) – The prefix to use for writing the files.
  • output_key (str) – The key to use for registering the normal output.
blenderproc.python.renderer.RendererUtility.map_file_format_to_file_ending(file_format)[source]

Returns the files endings for a given blender output format.

Parameters:file_format (str) – The blender file format.
Return type:str
Returns:The file ending.
blenderproc.python.renderer.RendererUtility.render(output_dir=None, file_prefix='rgb_', output_key='colors', load_keys=None, return_data=True, keys_with_alpha_channel=None)[source]

Render all frames.

This will go through all frames from scene.frame_start to scene.frame_end and render each of them.

Parameters:
  • output_dir (Optional[str]) – The directory to write files to, if this is None the temporary directory is used. The temporary directory is usually in the shared memory (only true for linux).
  • file_prefix (str) – The prefix to use for writing the images.
  • output_key (Optional[str]) – The key to use for registering the output.
  • load_keys (Optional[Set[str]]) – Set of output keys to load when available
  • return_data (bool) – Whether to load and return generated data. Backwards compatibility to config-based pipeline.
  • keys_with_alpha_channel (Optional[Set[str]]) – A set containing all keys whose alpha channels should be loaded.
Return type:

Dict[str, Union[ndarray, List[ndarray]]]

Returns:

dict of lists of raw renderer output. Keys can be ‘distance’, ‘colors’, ‘normals’

blenderproc.python.renderer.RendererUtility.set_cpu_threads(num_threads)[source]

Sets the number of CPU cores to use simultaneously while rendering.

Parameters:num_threads (int) – The number of threads to use. If 0 is given the number is automatically detected based on the cpu cores.
blenderproc.python.renderer.RendererUtility.set_denoiser(denoiser)[source]

Enables the specified denoiser.

Automatically disables all previously activated denoiser.

Parameters:denoiser (Optional[str]) – The name of the denoiser which should be enabled. Options are “INTEL”, “OPTIX” and None. If None is given, then no denoiser will be active.
blenderproc.python.renderer.RendererUtility.set_light_bounces(diffuse_bounces=None, glossy_bounces=None, ao_bounces_render=None, max_bounces=None, transmission_bounces=None, transparent_max_bounces=None, volume_bounces=None)[source]

Sets the number of light bounces that should be used by the raytracing renderer. Default values are defined in DefaultConfig.py

Parameters:
  • diffuse_bounces (Optional[int]) – Maximum number of diffuse reflection bounces, bounded by total maximum.
  • glossy_bounces (Optional[int]) – Maximum number of glossy reflection bounces, bounded by total maximum.
  • ao_bounces_render (Optional[int]) – Approximate indirect light with background tinted ambient occlusion at the specified bounce, 0 disables this feature.
  • max_bounces (Optional[int]) – Total maximum number of bounces.
  • transmission_bounces (Optional[int]) – Maximum number of transmission bounces, bounded by total maximum.
  • transparent_max_bounces (Optional[int]) – Maximum number of transparent bounces.
  • volume_bounces (Optional[int]) – Maximum number of volumetric scattering events.
blenderproc.python.renderer.RendererUtility.set_max_amount_of_samples(samples)[source]

Sets the maximum number of samples to render for each pixel. This maximum amount is usually not reached if the noise threshold is low enough. If the noise threshold was set to 0, then only the maximum number of samples is used (We do not recommend this).

Parameters:samples (int) – The maximum number of samples per pixel
blenderproc.python.renderer.RendererUtility.set_noise_threshold(noise_threshold)[source]

Configures the adaptive sampling, the noise threshold is typically between 0.1 and 0.001. Adaptive sampling automatically decreases the number of samples per pixel based on estimated level of noise.

We do not recommend setting the noise threshold value to zero and therefore turning off the adaptive sampling.

For more information see the official documentation: https://docs.blender.org/manual/en/latest/render/cycles/render_settings/sampling.html#adaptive-sampling

Parameters:noise_threshold (float) – Noise level to stop sampling at. If 0 is given, adaptive sampling is disabled and only the max amount of samples is used.
blenderproc.python.renderer.RendererUtility.set_output_format(file_format=None, color_depth=None, enable_transparency=None, jpg_quality=None)[source]

Sets the output format to use for rendering. Default values defined in DefaultConfig.py.

Parameters:
  • file_format (Optional[str]) – The file format to use, e.q. “PNG”, “JPEG” or “OPEN_EXR”.
  • color_depth (Optional[int]) – The color depth.
  • enable_transparency (Optional[bool]) – If true, the output will contain a alpha channel and the background will be set transparent.
  • jpg_quality (Optional[int]) – The quality to use, if file format is set to “JPEG”.
blenderproc.python.renderer.RendererUtility.set_simplify_subdivision_render(simplify_subdivision_render)[source]

Sets global maximum subdivision level during rendering to speedup rendering.

Parameters:simplify_subdivision_render (int) – The maximum subdivision level. If 0 is given, simplification of scene is disabled.
blenderproc.python.renderer.RendererUtility.set_world_background(color, strength=1)[source]

Sets the color of blenders world background

Parameters:
  • color (List[float]) – A three dimensional list specifying the new color in floats.
  • strength (float) – The strength of the emitted background light.
blenderproc.python.renderer.RendererUtility.toggle_stereo(enable)[source]

Enables/Disables stereoscopy.

Parameters:enable (bool) – True, if stereoscopy should be enabled.