ddg.visualization.blender.render module
- class ddg.visualization.blender.render.ImageFormatExtension(value)[source]
Bases:
EnumAn enumeration.
- BMP = '.bmp'
- PNG = '.png'
- IRIS = '.sgi'
- JPEG = '.jpg'
- JPEG2000 = '.jp2'
- TARGA = '.tga'
- TARGA_RAW = '.tga'
- DPX = '.dpx'
- CINEON = '.cin'
- OPEN_EXR = '.exr'
- OPEN_EXR_MULTILAYER = '.exr'
- HDR = '.hdr'
- TIFF = '.tiff'
- WEBP = '.webp'
- ddg.visualization.blender.render.set_world_background(color=(1, 1, 1, 1), strength=0.2, world=None)[source]
Set the world background color and emission.
- Parameters:
- colorSequence of 4 floats between 0 and 1 (default=(1, 1, 1, 1))
Color the background will have.
- strengthfloat (default=0.2)
Emission strength of the background.
- worldbpy.types.World (default=None)
World to modify. If None, use world of the current scene.
- ddg.visualization.blender.render.set_film_transparency(scene=None, transparent=True)[source]
Set the transparency of the render’s film.
- Parameters:
- scenebpy.types.Scene (default=None)
Scene to apply the render setup to. If None, use the current scene.
- transparentbool (default=True)
If True make the film transparent, else use opaque world background.
- ddg.visualization.blender.render.setup_eevee_renderer(scene=None, samples=64, shadows_px='128')[source]
Set render settings for the Eevee engine.
- Parameters:
- scenebpy.types.Scene (default=None)
Scene to which to apply the render settings. If None use the current scene.
- samplesint (default=64)
Number of samples.
- shadows_pxenum in [“64”, “128”, “256”, “512”, “1024”, “2048”, “4096”],
(default=”128”) Number of pixels to use for rendering of shadows.
- ddg.visualization.blender.render.setup_cycles_renderer(scene=None, device='CPU', noise_threshold=0.01, min_samples=0, max_samples=512, time_limit=5, denoise=False, persistent_data=True)[source]
Set render settings for the Cycles engine with adaptive sampling.
- Parameters:
- scenebpy.types.Scene (default=None)
Scene to which to apply the render settings. If None, use the current scene.
- devicestr (default=”CPU”)
Cycles render device, either “CPU” or “GPU”.
- noise_thresholdfloat (default=0.01)
The error threshold used in adaptive sampling.
- min_samplesint (default=0)
Minimum number of samples.
- max_samplesint (default=512)
Minimum number of samples.
- time_limitfloat (default=5)
Maximum time of a render. Zero means no time limit.
- denoisebool (default=False)
Whether or not to denoise the output after render.
- persistent_databool (default=True)
Whether or not to keep render data for faster re-renders and animation renders.
- ddg.visualization.blender.render.set_render_stamp_note(note, scene=None, font_size=26, font_color=(0, 0, 0, 1), bg_color=(0, 0, 0, 0))[source]
Set a custom string to display in the render stamp.
- Parameters:
- notestr
The string to display in render stamp.
- scenebpy.types.Scenes (default=None)
The scene to setup render stamp. If None use the current scene.
- font_sizeint (default=26)
The font size of displayed string.
- font_colorIterable of four floats (default=(0.,0.,0.,1.))
RGBA values of displayed string.
- bg_colorIterable of four floats (default=(0.,0.,0.,0.))
RGBA values of background of displayed string.
Notes
In order to display a stamp note
scene.render.use_stampmust be set toTrue. Blender then automatically adds other render stamps, such as render time, date and file name. You can disable those manually, for example by settingscene.render.use_stamp_filename = False. For more settings, seebpy.types.RenderSettings.
- ddg.visualization.blender.render.set_render_output_images(output_path, time=True, scene=None, file_format='PNG', alpha=True, quality=100)[source]
Set the rendering output for an image sequence.
Unless time=False, each time this function is called a new timestamp is set, and the output images will be saved under {output_path}/{timestamp}/ in order to isolate renders between sessions.
- Parameters:
- output_pathstr
The directory path to which to save to ouput.
- timebool (default=True)
Whether or not to create a timestamp subdirectory and save the rendered images under it.
- scenebpy.types.Scenes (default=None)
The scene to which to apply the settings. If None use the current scene.
- file_formatstr (default=”PNG”)
The file format of the images. In upper letters. For example ‘PNG’ or ‘JPEG2000’
- alphabool (default=True)
Whether to use alpha in the output image.
- qualityint (default=100)
Quality of the output image in percent.
See also
- ddg.visualization.blender.render.render_frame(frame, full_path=None, camera=None)[source]
Render a frame to full_path.
- Parameters:
- frameint
Frame to use for the render.
- full_pathstr (default=None)
Full output path with file name and extension. If None use the current scene
scene.render.filepathandscene.render.image_settings.file_format.- camerabpy.types.Camera (default=None)
Camera to use for the render. If None use the current scene camera.
See also
- ddg.visualization.blender.render.render_animation(output_directory=None, start=None, end=None, camera=None)[source]
Render all frames between start and end to path.
- Parameters:
- output_directorystr (default=None)
Directory of the render output. If None use current scene
scene.render.filepathandscene.render.image_settings.file_format.- startint (default=None)
Start frame. If None use current scene start frame.
- endint (default=None)
End frame. If None use current scene end frame.
- camerabpy.types.Camera (default=None)
Camera to use for the render. If None, use the current scene camera.
See also