Panda3DRGBRenderer¶
- class Panda3DRGBRenderer(*args, **kwargs)¶
Bases:
Panda3DBaseRenderer
,Panda3DLightableScene
Implementation of a traditional RGB renderer in Panda3D.
The lighting model follows a Cook-torrance BRDF.
For each object, a specific Version of the cook-torrance shader is compiled: diffuse textures are supported, but normal/bump/roughness maps are not. This class will try to automatically detect whether an object has RGB textures.
Specular highlights and reflections can be ignored, depending on the value of isShowingSpeculars.
Warning
if an object is detected as having image textures but it actually doesn’t have any, the object may appear washed out.
Note
Most of the tested objects were in BAM format, Panda3D’s own format. The following pipeline was used:
Export to GLTF with Blender
In a Python environment, install gltf2bam with pip install panda3d-gltf
run gltf2bam path/to/yourObject.gltf path/to/yourObject.bam
then, in the code, use renderer.addNodeToScene(“/path/to/yourObject.bam”);
Overloaded function.
__init__(self: visp._visp.ar.Panda3DRGBRenderer) -> None
Default constructor. Initialize an RGB renderer with the normal rendering behavior showing speculars.
__init__(self: visp._visp.ar.Panda3DRGBRenderer, showSpeculars: bool) -> None
RGB renderer constructor allowing to specify whether specular highlights should be rendered or if only ambient/diffuse lighting should be considered.
- Parameters:
- showSpeculars
whether to render speculars
Methods
Overloaded function.
Overloaded function.
Store the render resulting from calling renderFrame() into a vpImage .
Inherited Methods
Set the behaviour when a Panda3D assertion fails.
Get the name of the renderer.
Load a 3D object.
Overloaded function.
Retrieve the camera's pose, in the world frame.
Set the camera's pose.
Initialize the whole Panda3D framework.
Overloaded function.
Get the rendering order of this renderer.
set whether vertical sync is enabled.
Compute the near and far planes for the camera at the current pose, given a certain node/part of the graph.
Get the scene root.
Returns true if this renderer process 3D data and its scene root can be interacted with.
Overloaded function.
Set new rendering parameters.
Operators
__doc__
Overloaded function.
__module__
Attributes
__annotations__
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: visp._visp.ar.Panda3DRGBRenderer) -> None
Default constructor. Initialize an RGB renderer with the normal rendering behavior showing speculars.
__init__(self: visp._visp.ar.Panda3DRGBRenderer, showSpeculars: bool) -> None
RGB renderer constructor allowing to specify whether specular highlights should be rendered or if only ambient/diffuse lighting should be considered.
- Parameters:
- showSpeculars
whether to render speculars
- addLight(self, light: visp._visp.ar.Panda3DLight) None ¶
- addNodeToScene(*args, **kwargs)¶
Overloaded function.
addNodeToScene(self: visp._visp.ar.Panda3DRGBRenderer, object: NodePath) -> None
Add a node to the scene. Its pose is set as the identity matrix.
- Parameters:
- object
addNodeToScene(self: visp._visp.ar.Panda3DBaseRenderer, object: NodePath) -> None
Add a node to the scene. Its pose is set as the identity matrix.
- Parameters:
- object
- computeNearAndFarPlanesFromNode(self, name: str, near: float, far: float, fast: bool) tuple[float, float] ¶
Compute the near and far planes for the camera at the current pose, given a certain node/part of the graph.
The near clipping value will be set to the distance to the closest point of the object. The far clipping value will be set to the distance to farthest vertex of the object.
Warning
Depending on geometry complexity, this may be an expensive operation.
Warning
if the object lies partly behind the camera, the near plane value will be zero. If it fully behind, the far plane will also be zero. If these near/far values are used to update the rendering parameters of the camera, this may result in an invalid projection matrix.
- Parameters:
- name: str¶
name of the node that should be used to compute near and far values.
- near: float¶
resulting near clipping plane distance
- far: float¶
resulting far clipping plane distance
- fast: bool¶
Whether to use the axis align bounding box to compute the clipping planes. This is faster than reprojecting the full geometry in the camera frame
- Returns:
A tuple containing:
near: resulting near clipping plane distance
far: resulting far clipping plane distance
- getCameraPose(self) visp._visp.core.HomogeneousMatrix ¶
Retrieve the camera’s pose, in the world frame. The pose is specified using the ViSP convention (Y-down right handed).
- getNodePose(*args, **kwargs)¶
Overloaded function.
getNodePose(self: visp._visp.ar.Panda3DBaseRenderer, name: str) -> visp._visp.core.HomogeneousMatrix
Get the pose of a Panda node, in world frame in the ViSP convention (Y-down right handed).
- Parameters:
- name
Node path to search for.
- Returns:
wTo, the pose of the object in world frame
getNodePose(self: visp._visp.ar.Panda3DBaseRenderer, object: NodePath) -> visp._visp.core.HomogeneousMatrix
Get the pose of a Panda node, in world frame in the ViSP convention (Y-down right handed). This version of the method directly uses the Panda Nodepath.
- getRender(self, I: visp._visp.core.ImageRGBa) None ¶
Store the render resulting from calling renderFrame() into a vpImage .
If the image does not have the correct dimensions, it is resized.
- Parameters:
- I: visp._visp.core.ImageRGBa¶
The image in which to store the render.
- getRenderOrder(self) int ¶
Get the rendering order of this renderer. If a renderer A has a lower order value than B, it will be rendered before B. This is useful, if for instance, B is a postprocessing filter that depends on the result of B.
- Returns:
int
- getRenderRoot(self) NodePath ¶
Get the scene root.
- initFramework(self) None ¶
Initialize the whole Panda3D framework. Create a new PandaFramework object and a new window.
Will also perform the renderer setup (scene, camera and render targets)
- initFromParent(*args, **kwargs)¶
Overloaded function.
initFromParent(self: visp._visp.ar.Panda3DBaseRenderer, framework: PandaFramework, window: PointerTo<WindowFramework>) -> None
initFromParent(self: visp._visp.ar.Panda3DBaseRenderer, renderer: visp._visp.ar.Panda3DBaseRenderer) -> None
- isRendering3DScene(self) bool ¶
Returns true if this renderer process 3D data and its scene root can be interacted with.
This value could be false, if for instance it is redefined in a subclass that performs postprocessing on a texture.
- loadObject(self, nodeName: str, modelPath: str) NodePath ¶
Load a 3D object. To load an .obj file, Panda3D must be compiled with assimp support.
Once loaded, the object will not be visible, it should be added to the scene.
- setAbortOnPandaError(self, abort: bool) None ¶
Set the behaviour when a Panda3D assertion fails. If abort is true, the program will stop. Otherwise, an error will be displayed in the console.
- setBackgroundImage(self, background: visp._visp.core.ImageRGBa) None ¶
- setCameraPose(self, wTc: visp._visp.core.HomogeneousMatrix) None ¶
Set the camera’s pose. The pose is specified using the ViSP convention (Y-down right handed).
- Parameters:
- wTc: visp._visp.core.HomogeneousMatrix¶
the new pose of the camera, in world frame
- setNodePose(*args, **kwargs)¶
Overloaded function.
setNodePose(self: visp._visp.ar.Panda3DBaseRenderer, name: str, wTo: visp._visp.core.HomogeneousMatrix) -> None
Set the pose of a node. This node can be any Panda object (light, mesh, camera). The pose is specified using the ViSP convention (Y-down right handed).
- Parameters:
- name
Node path to search for, from the render root. This is the object that will be modified See https://docs.panda3d.org/1.10/python/programming/scene-graph/searching-scene-graph
- wTo
Pose of the object in the world frame
setNodePose(self: visp._visp.ar.Panda3DBaseRenderer, object: NodePath, wTo: visp._visp.core.HomogeneousMatrix) -> None
Set the pose of a node. The pose is specified using the ViSP convention (Y-down right handed). This node can be any Panda object (light, mesh, camera).
- Parameters:
- object
The object for which to set the pose
- wTo
Pose of the object in the world frame
- setRenderParameters(self, params: visp._visp.ar.Panda3DRenderParameters) None ¶
Set new rendering parameters. If the scene has already been initialized, the renderer camera is updated.
- Parameters:
- params: visp._visp.ar.Panda3DRenderParameters¶
the new rendering parameters
- setVerticalSyncEnabled(self, useVsync: bool) None ¶
set whether vertical sync is enabled. When vertical sync is enabled, render speed will be limited by the display’s refresh rate
- static vispPointToPanda(point: visp._visp.core.ColVector) visp._visp.core.ColVector ¶
- static vispVectorToPanda(vec: visp._visp.core.ColVector) visp._visp.core.ColVector ¶