API Reference#
This section contains a detailed description of the objects included in pysdic-blender.
The reference describes how the methods work and which parameters can be used.
Rendering a scene#
A Blender scene is built from the objects of pysdic:
pysdic pysdic-blender
------ --------------
Camera ──────────────────────► BlenderCamera ──────┐
Mesh (triangle_3) + texture ─► BlenderMesh ────────┤
BlenderMaterialBSDF ┼─► BlenderExperiment ──► render(camera) ──► image
BlenderSpotLight ───┤
BlenderAreaLight ───┘
The pose of the camera is converted from the OpenCV convention (\(z\) forward, \(y\) down) to the Blender convention (\(z\) backward, \(y\) up): with the world-to-camera rotation \(R\) and translation \(\vec{t}\) of the extrinsic, the center of the camera is \(\vec{C} = -R^T \vec{t}\) and its orientation in Blender is \(R^T \, \text{diag}(1, -1, -1)\).
The render is a linear intensity (float64, no quantization): a weighted sum of the RGB channels of Cycles for a
monochrome sensor (channel_weights), or the RGB image with color=True. The gray levels, the noise and the
quantization of the sensor are added in pysdic.
Note
Blender has a single scene per process: only one BlenderExperiment is active at a time (a new experiment
resets the scene).
Experiment#
BlenderExperiment: The Blender scene (cameras, meshes, lights, background) and its rendering.
render_blender_image: Render one image in a single call.
Camera and mesh#
BlenderCamera: A Blender camera from a
pysdic.Camera(OpenCV pinhole model only), with an optional depth of field.BlenderMesh: A Blender mesh from a
triangle_3pysdic.Meshwith its UV map and its texture.
Materials#
BlenderMaterialBSDF: The material of a mesh (Principled BSDF).
get_matte_paint_material: A matte paint material.
get_steel_material: A steel material.
get_iron_material: An iron material.
get_copper_material: A copper material.
get_titanium_material: A titanium material.
get_mirror_material: A mirror material.
Lights#
BlenderSpotLight: A spot light (cone of light from an emitting sphere), created from its position and direction or with
looking_at.BlenderAreaLight: An area light (square, rectangle, disk or ellipse emitting from one side), e.g. an LED panel.