pysdic_blender.render_blender_image#
- render_blender_image(camera, mesh, *, displacement=None, texture=None, texture_range=(0.0, 255.0), material=None, spotlights=(), arealights=(), background_color=(1.0, 1.0, 1.0), background_strength=1.0, **render_options)[source]#
Render one image of a mesh seen by a camera with Blender: the counterpart of
pysdic.generate_synthetic_image()with the lighting and the materials of Cycles (shading, shadows, specular reflections, depth of field).Creates a
BlenderExperiment(which clears the data of Blender) with the camera (seeBlenderCamera), the mesh (seeBlenderMesh) and the lights, and renders it. For several images of the same scene, use aBlenderExperimentdirectly (the scene is built once).Important
Requires
bpy. The camera must follow the OpenCV pinhole model without distortion, and the mesh must be a 3Dtriangle_3mesh.- Parameters:
camera (Union[
pysdic.Camera,BlenderCamera]) – The camera: apysdic.Camera(converted with the default options ofBlenderCamera, pinhole) or aBlenderCamera(e.g. with a depth of field).mesh (
pysdic.Mesh) – The 3Dtriangle_3mesh, with a UV map for a texture.displacement (ArrayLike | None) – See
BlenderMesh.texture (Image | ArrayLike | None) – See
BlenderMesh.texture_range (Tuple[float, float]) – See
BlenderMesh.material (Optional[
BlenderMaterialBSDF], optional) – The material of the mesh. By default, the default material of Blender.spotlights (Sequence[
BlenderSpotLight], optional) – The spot lights.arealights (Sequence[
BlenderAreaLight], optional) – The area lights.background_color (ArrayLike) – The ambient light (see
BlenderExperiment.set_background()), by default a white ambient light of strength 1 (a uniform lighting without spot light).background_strength (Real) – The ambient light (see
BlenderExperiment.set_background()), by default a white ambient light of strength 1 (a uniform lighting without spot light).**render_options (Any) – The options of
BlenderExperiment.render()(color,channel_weights,n_samples,filter_width, …).
- Returns:
The linear intensity \((H, W)\), or the RGB image \((H, W, 3)\) with
color=True(float64).- Return type: