NVISII
- nvisii.clear_all()
Removes any allocated components but keeps nvisii initialized. Call this if you would like to clear the current scene.
- nvisii.clear_dome_light_texture()
Disconnects the dome light texture, reverting back to any existing constant dome light color
- nvisii.configure_denoiser(use_albedo_guide=True, use_normal_guide=True, use_kernel_prediction=True)
Controls what guides and modes are used to denoise the image. :type use_albedo_guide: boolean, optional :param use_albedo_guide: If True, uses albedo to guide the denoiser. Useful for scenes with
textures or large uniformly colored sections. Can cause issues when denoising motion blur.
- Parameters
use_normal_guide (boolean, optional) – If True, uses surface normals to guide the denoiser. Useful for scenes where geometrically complex objects do not have distinct albedo (eg walls, uniformly colored objects, etc)
use_kernel_prediction (boolean, optional) – If True, uses the OptiX kernel prediction model for denoising, which avoids intensity shifts and false color prediction by instead predicting a normalized kernel.
- nvisii.deinitialize()
Closes the interactive window, and shuts down any running backend systems. Call this function at the end of your script.
- nvisii.disable_denoiser()
Disables the Optix denoiser.
- nvisii.disable_dome_light_sampling()
If disabled, objects will not be lit by the dome light.
Instead, the dome light will only effect the background color.
- nvisii.disable_updates()
If disabled, the interactive window image will only show scene changes on call to render, render_to_png, and render_data. Bulk component edits will be much faster when disabled, as all component edits can be done without the renderer locking them for upload to the GPU.
- nvisii.enable_denoiser()
Enables the Optix denoiser.
- nvisii.enable_dome_light_sampling()
If enabled, objects will be lit by the dome light.
- nvisii.enable_updates()
If enabled, the interactive window image will change asynchronously as scene components are altered. However, bulk component edits will slow down, as each component edit will individually cause the renderer to temporarily lock components while being uploaded to the GPU.
- nvisii.get_cursor_pos()
If in interactive mode, returns the position of the cursor relative to the window.
- nvisii.get_scene_aabb_center()
- Return type
- Returns
the center of the aligned bounding box for the axis aligned bounding box containing all scene geometry
- nvisii.get_scene_max_aabb_corner()
- Return type
- Returns
the maximum axis aligned bounding box position for the axis aligned bounding box containing all scene geometry
- nvisii.get_scene_min_aabb_corner()
- Return type
- Returns
the minimum axis aligned bounding box position for the axis aligned bounding box containing all scene geometry
- nvisii.get_window_size()
If in interactive mode, returns size of the window
- nvisii.import_scene(*args, **kwargs)
Imports a file containing scene data.
Supported file formats include: AMF 3DS AC ASE ASSBIN B3D BVH COLLADA DXF CSM HMP IRRMESH IRR LWO LWS M3D MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X X3D GLTF 3MF MMD
First, any materials described by the file are used to generate Material components. Next, any textures required by those materials will be loaded. After that, all shapes will be separated by material. For each separated shape, an entity is created to attach a transform, mesh, and material component together. These shapes are then translated so that the transform component is centered at the centroid of the shape. Finally, any specified position, scale, and/or rotation are applied to the generated transforms.
- Parameters
filepath – The path for the file to load
position (
vec3
, optional) – A change in position to apply to all entities generated by this functionscale (
vec3
, optional) – A change in scale to apply to all entities generated by this functionrotation (
quat
, optional) – A change in rotation to apply to all entities generated by this functionargs (std::vector< std::string,std::allocator< std::string > >, optional) – A list of optional arguments that can effect the importer. Possible options include: “verbose” - print out information related to loading the scene. Useful for debugging!
- nvisii.initialize(headless=False, window_on_top=False, lazy_updates=False, verbose=False, max_entities=10000, max_cameras=10, max_transforms=10000, max_meshes=10000, max_materials=10000, max_lights=100, max_textures=1000, max_volumes=1000)
Initializes various backend systems required to render scene data.
- Parameters
headless (boolean, optional) – If true, avoids using any OpenGL resources, to enable use on systems without displays.
window_on_top (boolean, optional) – Keeps the window opened during an interactive session on top of any other windows. (assuming headless is False)
lazy_updates (boolean, optional) – If True, nvisii will only upload components to the GPU on call to render/render_to_png/render_data for better scene editing performance. (assuming headless is False. Always on when headless is True)
verbose (boolean, optional) – If false, nvisii will avoid outputing any unneccessary text
max_entities (int, optional) – The max number of creatable Entity components.
max_cameras (int, optional) – The max number of creatable Camera components.
max_transforms (int, optional) – The max number of creatable Transform components.
max_meshes (int, optional) – The max number of creatable Mesh components.
max_materials (int, optional) – The max number of creatable Material components.
max_lights (int, optional) – The max number of creatable Light components.
max_textures (int, optional) – The max number of creatable Texture components.
- nvisii.is_button_held(button)
If in interactive mode, returns True if the specified button is held down. :param The: button to check. Not case sensitive. Possible options include:
SPACE, APOSTROPHE, COMMA, MINUS, PERIOD, SLASH, SEMICOLON, EQUAL, UP, DOWN, LEFT, RIGHT 0-9, A->Z, [, ], , `, ESCAPE, ENTER, TAB, BACKSPACE, INSERT, DELETE, PAGE_UP, PAGE_DOWN, HOME, CAPS_LOCK, SCROLL_LOCK, NUM_LOCK, PRINT_SCREEN, PAUSE, F1 -> F25, KP_0 -> KP_9, KP_DECIMAL, KP_DIVIDE, KP_MULTIPLY, KP_SUBTRACT, KP_ADD, KP_ENTER, KP_EQUAL, LEFT_SHIFT, LEFT_CONTROL, LEFT_ALT, LEFT_SUPER, RIGHT_SHIFT, RIGHT_CONTROL, RIGHT_ALT, RIGHT_SUPER, MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT
- nvisii.is_button_pressed(button)
If in interactive mode, returns True if the specified button is pressed but not held. :param The: button to check. Not case sensitive. Possible options include:
SPACE, APOSTROPHE, COMMA, MINUS, PERIOD, SLASH, SEMICOLON, EQUAL, UP, DOWN, LEFT, RIGHT 0-9, A->Z, [, ], , `, ESCAPE, ENTER, TAB, BACKSPACE, INSERT, DELETE, PAGE_UP, PAGE_DOWN, HOME, CAPS_LOCK, SCROLL_LOCK, NUM_LOCK, PRINT_SCREEN, PAUSE, F1 -> F25, KP_0 -> KP_9, KP_DECIMAL, KP_DIVIDE, KP_MULTIPLY, KP_SUBTRACT, KP_ADD, KP_ENTER, KP_EQUAL, LEFT_SHIFT, LEFT_CONTROL, LEFT_ALT, LEFT_SUPER, RIGHT_SHIFT, RIGHT_CONTROL, RIGHT_ALT, RIGHT_SUPER, MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT
- nvisii.register_callback(callback)
Registers a callback which is called on the render thread before each rendered frame. This mechanism is useful for implementing camera controls and other routines dependent on cursor and button clicks. To disable the callback, pass nullptr/None here.
- nvisii.render(width, height, samples_per_pixel, seed=0)
Renders the current scene, returning the resulting framebuffer back to the user directly.
- Parameters
width (int) – The width of the image to render
height (int) – The height of the image to render
samples_per_pixel (int) – The number of rays to trace and accumulate per pixel.
seed (int, optional) – A seed used to initialize the random number generator.
- nvisii.render_data(width, height, start_frame, frame_count, bounce, options, seed=0)
Renders out metadata used to render the current scene, returning the resulting framebuffer back to the user directly.
- Parameters
width (int) – The width of the image to render
height (int) – The height of the image to render
start_frame (int) – The start seed to feed into the random number generator
frame_count (int) – The number of frames to accumulate the resulting framebuffers by. For ID data, this should be set to 0.
bounce (int) – The number of bounces required to reach the vertex whose metadata result should come from. A value of 0 would save data for objects directly visible to the camera, a value of 1 would save reflections/refractions, etc.
options (string) – Indicates the data to return. Current possible values include “none” for rendering out raw path traced data, “depth” to render the distance between the previous path vertex to the current one, “ray_direction” to render the direction that the ray was traced in world space, “position” for rendering out the world space position of the path vertex, “normal” for rendering out the world space normal of the path vertex, “tangent” for rendering out the world space tangent of the path vertex, “entity_id” for rendering out the entity ID whose surface the path vertex hit, “base_color” for rendering out the surface base color, “texture_coordinates” for rendering out the texture coordinates of the hit surface, “screen_space_normal” for rendering out the normals of the hit surface in screen space, “diffuse_motion_vectors” for rendering out screen space motion vectors for moving objects, “denoise_normal” for rendering out the normal buffer supplied to the Optix denoiser, “denoise_albedo” for rendering out the albedo supplied to the Optix denoiser, “heatmap” for rendering out the time it takes to render out each pixel, “device_id” for determining which GPU was used to render what pixel.
seed (int, optional) – A seed used to initialize the random number generator.
- nvisii.render_data_to_file(width, height, start_frame, frame_count, bounce, options, file_path, seed=0)
Renders out metadata used to render the current scene, returning the resulting framebuffer back to the user directly.
- Parameters
width (int) – The width of the image to render
height (int) – The height of the image to render
start_frame (int) – The start seed to feed into the random number generator
frame_count (int) – The number of frames to accumulate the resulting framebuffers by. For ID data, this should be set to 0.
bounce (int) – The number of bounces required to reach the vertex whose metadata result should come from. A value of 0 would save data for objects directly visible to the camera, a value of 1 would save reflections/refractions, etc.
options (string) – Indicates the data to return. Current possible values include “none” for rendering out raw path traced data, “depth” to render the distance between the previous path vertex to the current one, “ray_direction” to render the direction that the ray was traced in world space, “position” for rendering out the world space position of the path vertex, “normal” for rendering out the world space normal of the path vertex, “entity_id” for rendering out the entity ID whose surface the path vertex hit, “base_color” for rendering out the surface base color, “texture_coordinates” for rendering out the texture coordinates of the hit surface, “screen_space_normal” for rendering out the normals of the hit surface in screen space, “diffuse_motion_vectors” for rendering out screen space motion vectors for moving objects, “denoise_normal” for rendering out the normal buffer supplied to the Optix denoiser, “denoise_albedo” for rendering out the albedo supplied to the Optix denoiser, “heatmap” for rendering out the time it takes to render out each pixel, “device_id” for determining which GPU was used to render what pixel.
file_path (string) – The path to use to save the file, including the extension. Supported extensions are EXR, HDR, and PNG
seed (int, optional) – A seed used to initialize the random number generator.
- nvisii.render_to_hdr(width, height, samples_per_pixel, image_path, seed=0)
Deprecated. Please use renderToFile.
- nvisii.render_to_png(width, height, samples_per_pixel, image_path, seed=0)
Deprecated. Please use renderToFile.
- nvisii.resize_window(width, height)
If using interactive mode, resizes the window to the specified dimensions.
- Parameters
width (int) – The width to resize the window to
height (int) – The height to resize the window to
- nvisii.sample_pixel_area(*args, **kwargs)
Sets the region of the pixel where rays should sample. By default, rays sample the entire pixel area between [0,1]. Rays can instead sample a specific location of the pixel, like the pixel center, by specifying a specific location within the pixel area, eg [.5, .5]. This allows for enabling or disabling antialiasing, possibly at the cost of noise in intermediate data buffers.
- nvisii.sample_time_interval(*args, **kwargs)
Sets the interval of time that rays should sample. By default, rays sample the entire time interval befween the current frame and the next, [0,1]. Rays can instead sample a specific point in time, like the end-of-frame time, by specifying a specific location within the time interval, eg [1.0, 1.0] or [0.0, 0.0]. This allows for enabling or disabling motion blur, while still preserving motion vectors.
- Parameters
time_sample_interval (
vec2
, optional) – The interval to sample rays within along in time. A value of [0,1] will result in motion blur across the entire frame.
- nvisii.set_camera_entity(camera_entity)
Tells the renderer which camera entity to use for rendering. The transform component of this camera entity places the camera into the world, and the camera component of this camera entity describes the perspective to use, the field of view, the depth of field, and other “analog” camera properties.
- Parameters
camera_entity (
Entity
) – The entity containing a camera and transform component, to use for rendering.
- nvisii.set_cursor_mode(mode)
If in interactive mode, sets the mode of the cursor. :type mode: string :param mode: Can be one of the following:
NORMAL - makes the cursor visible and beaving normally HIDDEN makes the cursor invisible when it is over the content area of the window, but does not restrict the cursor from leaving. DISABLED - hides and grabs the cursor, providing virtual and unlimited cursor movement. This is useful for implementing for example 3D camera controls.
- nvisii.set_direct_lighting_clamp(clamp)
Clamps the direct light intensity during progressive image refinement. This reduces fireflies from direct lighting, but also removes energy, and biases the resulting image.
- Parameters
clamp (float) – The maximum intensity that direct lighting can contribute per frame. A value of 0 disables direct light clamping.
- nvisii.set_dome_light_color(color)
Sets the color which this dome light will emit.
- Parameters
The – RGB color emitted that this dome light should emit.
- nvisii.set_dome_light_exposure(exposure)
Modifies the intensity, or brightness, that the dome light (aka environment light) will emit it’s color. Increasing the exposure by 1 will double the energy emitted by the light. An exposure of 0 produces an unmodified intensity. An exposure of -1 cuts the intensity of the light in half. light_intensity = intensity * pow(2, exposureExposure)
- Parameters
exposure (float) – How powerful the light source is in emitting light.
- nvisii.set_dome_light_intensity(intensity)
Sets the intensity, or brightness, that the dome light (aka environment light) will emit it’s color.
- Parameters
intensity (float) – How powerful the dome light is in emitting light
- nvisii.set_dome_light_rotation(rotation)
Sets the rotation to apply to the dome light (aka the environment).
- Parameters
rotation (
quat
) – The rotation to apply to the dome light
- nvisii.set_dome_light_sky(*args, **kwargs)
Configures the procedural sky for the dome light (aka the environment). :type sun_position:
vec3
:param sun_position: The position of the sun relative to [0,0,0]. As the sungoes down (in Z), Rayleigh scattering will cause the sky to change colors.
- Parameters
sky_tint (
vec3
, optional) – controls the relative color of the sky before Rayleigh scattering.atmosphere_thickness (float, optional) – effects Rayleigh scattering. Thin atmospheres look more like space, and thick atmospheres see more Rayleigh scattering.
saturation (float, optional) – causes the sky to appear more or less “vibrant”
- nvisii.set_dome_light_texture(texture, enable_cdf=False)
Sets the texture used to color the dome light (aka the environment). Textures are sampled using a 2D to 3D latitude/longitude strategy.
- Parameters
texture (
Texture
) – The texture to sample for the dome light.enable_cdf (boolean, optional) – If True, reduces noise of sampling a dome light texture, but at the expense of frame rate. Useful for dome lights with bright lights that should cast shadows.
- nvisii.set_indirect_lighting_clamp(clamp)
Clamps the indirect light intensity during progressive image refinement. This reduces fireflies from indirect lighting, but also removes energy, and biases the resulting image.
- Parameters
clamp (float) – The maximum intensity that indirect lighting can contribute per frame. A value of 0 disables indirect light clamping.
- nvisii.set_light_sample_count(count)
Sets the number of light samples to take per path vertex. A higher number of samples will reduce noise per frame, but also reduces frames per second.
- Parameters
count (int) – The number of light samples to take per path vertex. Currently constrained to a maximum of 10 samples per vertex.
- nvisii.set_max_bounce_depth(diffuse_depth=2, glossy_depth=8, transparency_depth=8, transmission_depth=12, volume_depth=2)
Sets the maximum number of times that a ray originating from the camera can bounce through the scene to accumulate light. For scenes containing only rough surfaces, this max bounce depth can be set to lower values. For scenes containing complex transmissive or reflective objects like glass or metals, this max bounce depth might need to be increased to accurately render these objects.
- Parameters
diffuse_depth (int, optional) – The maximum number of diffuse bounces allowed per ray. Higher counts will increase global illumination effects.
glossy_depth (int, optional) – The maximum number of glossy (reflection) bounces allowed per ray. Increases recursion in setups with mirrors, shiny surfaces, metals, etc
transparency_depth (int, optional) – The maximum number of transparency (alpha) bounces allowed per ray. Used for alpha cutouts of folliage and alpha transparent objects.
transmission_depth (int, optional) – The maximum number of transmission (refraction) bounces allowed per ray. For scenes containing glass, higher transmission depths result in more realistic refractions.
volume_depth (int, optional) – The maximum number of volume bounces allowed per ray. At 0, volumes are single-scattering. Higher values result in multiple scattering.
- nvisii.should_window_close()
If in interactive mode, returns true if the close button on the window was clicked.