Rendering Images
Offscreen renders
All functions in rpts.render are offscreen. They write PNG files to disk and do not use the viewport to produce them, so you can script image output without changing what is on screen.
Output paths and directories are relative to the working directory of the process when you do not give an absolute path. If you do not pass output_path or output_dir, the file ends up in that folder. Pass full paths when you want to control where the files go, or print the absolute path, as the example at the end of this page does.
Listing renderers and quality presets
rpts.render.list_renderers()returns the renderers you can pass asrenderer_id. The real-time renderer (Storm) is always first, as{"id": "HdStormRendererPlugin", "name": "Storm"}.rpts.render.list_quality_presets()returns the quality preset names, for examplePreview,DefaultandFinalfor the offline renderer.
The preset list reflects the renderer that is active in the interactive viewport, not the renderer_id you pass. Storm has no presets, so the list is empty while Storm is active. To use presets, select the offline renderer in the viewport's renderer switcher first. Passing quality_preset=None leaves the renderer's current settings as they are.
Rendering the whole asset
rpts.render.render_asset(renderer_id=None, quality_preset=None, background_color=None, output_path="render.png", resolution=(1024, 1024)) renders the whole asset from a fixed default camera view into one PNG. background_color is an (r, g, b) tuple in the range 0 to 1. Without it, the background is transparent. The function returns True on success.
Rendering a single node
rpts.render.render_node(node, ...) renders one node in isolation. node can be a node path or an rpd.Node. The useful options are:
color: an(r, g, b)tuple that gives the node a flat, unlit colour for this render only. The scene is not changed. This is handy for per-part masks.focus:True(the default) frames just this node and hides everything else.Falsekeeps the whole asset framed and shows the other nodes as translucent ghosts instead.ghost_opacitysets how strong the ghosts are whenfocus=False.
# this script is written for RPTS 0.9.8
import rpts
def render_part(node_path, output_path):
ok = rpts.render.render_node(
node_path,
color=(0.9, 0.2, 0.2), # flat red mask for this render only
focus=False, # show the part within the whole asset
ghost_opacity=0.15,
output_path=output_path,
)
print("Rendered" if ok else "Render failed", output_path)
render_part("<node-path>", "C:\\Path\\to\\your\\output\\part.png")
Rendering each mesh separately
rpts.render.render_meshes_separately(nodes=None, output_dir="renders", ...) writes one PNG per mesh. With nodes=None it renders every mesh in the scene. A group node in nodes is expanded to the meshes below it. The function returns a dict that maps each node path to the PNG file it wrote. Meshes that fail are left out of the dict.
Rendering a turntable
rpts.render.render_turntable(num_steps=36, ...) renders num_steps frames evenly spaced around one full turn of the whole asset. Frames are written to output_dir as frame_0000.png, frame_0001.png and so on. The function returns the list of file paths in order, or an empty list if the render failed.
Example: render the current asset
The next script renders the current asset with the first renderer in the list and the first quality preset, if there is one. It then prints where the file went:
# this script is written for RPTS 0.9.8
import os
import rpts
def render_current_asset(output_path="render.png"):
renderers = rpts.render.list_renderers()
if not renderers:
print("No renderers available.")
return
renderer = renderers[0]
presets = rpts.render.list_quality_presets()
quality = presets[0] if presets else None
ok = rpts.render.render_asset(
renderer_id=renderer["id"],
quality_preset=quality,
output_path=output_path,
)
if not ok:
print("Render failed.")
return
# output_path is relative to the working directory unless it is absolute,
# so print the absolute path to show where the file really went
print(f"Rendered with {renderer['name']} (quality: {quality or 'renderer default'}).")
print(f"Saved to: {os.path.abspath(output_path)}")
render_current_asset("C:\\Path\\to\\your\\output\\render.png")
When you render a turntable or many meshes, pass a dedicated output_dir with a full path. This keeps the frames together and avoids mixing them with other files in the working directory.