Drake
drake::geometry::render Namespace Reference

Namespaces

 shaders
 
 vtk_util
 

Classes

class  ClippingRange
 Defines the near and far clipping planes for frustum-based (OpenGL) RenderEngine cameras. More...
 
class  ColorRenderCamera
 Collection of camera properties for cameras to be used with color/label images. More...
 
class  DepthRange
 Defines a depth sensor's functional range. More...
 
class  DepthRenderCamera
 Collection of camera properties for cameras to be used with depth images. More...
 
class  RenderCameraCore
 Collection of core parameters for modeling a pinhole-model camera in a RenderEngine. More...
 
class  RenderEngine
 The engine for performing rasterization operations on geometry. More...
 
class  RenderEngineGl
 See documentation of MakeRenderEngineGl(). More...
 
struct  RenderEngineGlParams
 Construction parameters for RenderEngineGl. More...
 
class  RenderEngineVtk
 See documentation of MakeRenderEngineVtk(). More...
 
struct  RenderEngineVtkParams
 Construction parameters for the RenderEngineVtk. More...
 
class  RenderLabel
 Class representing object "labels" for rendering. More...
 

Functions

std::unique_ptr< RenderEngineMakeRenderEngineGl (RenderEngineGlParams params={})
 Constructs a RenderEngine implementation which uses a purely OpenGL renderer. More...
 
vtkSmartPointer< vtkPolyDataAlgorithm > CreateVtkCapsule (const Capsule &capsule)
 
vtkSmartPointer< vtkPolyDataAlgorithm > CreateVtkBox (const Box &box, const PerceptionProperties &properties)
 
vtkSmartPointer< vtkPolyDataAlgorithm > CreateVtkEllipsoid (const Ellipsoid &ellipsoid)
 
void SetSphereOptions (vtkTexturedSphereSource *vtk_sphere, double radius)
 
void SetCylinderOptions (vtkCylinderSource *vtk_cylinder, double height, double radius)
 
void TransformToDrakeCylinder (vtkTransform *transform, vtkTransformPolyDataFilter *transform_filter, vtkCylinderSource *vtk_cylinder)
 
std::unique_ptr< RenderEngineMakeRenderEngineVtk (const RenderEngineVtkParams &params)
 Constructs a RenderEngine implementation which uses a VTK-based OpenGL renderer. More...
 

Function Documentation

◆ CreateVtkBox()

vtkSmartPointer<vtkPolyDataAlgorithm> drake::geometry::render::CreateVtkBox ( const Box box,
const PerceptionProperties properties 
)

◆ CreateVtkCapsule()

vtkSmartPointer<vtkPolyDataAlgorithm> drake::geometry::render::CreateVtkCapsule ( const Capsule capsule)

◆ CreateVtkEllipsoid()

vtkSmartPointer<vtkPolyDataAlgorithm> drake::geometry::render::CreateVtkEllipsoid ( const Ellipsoid ellipsoid)

◆ MakeRenderEngineGl()

std::unique_ptr<RenderEngine> drake::geometry::render::MakeRenderEngineGl ( RenderEngineGlParams  params = {})

Constructs a RenderEngine implementation which uses a purely OpenGL renderer.

The engine only works under Ubuntu. If called on a Mac, it will produce a "dummy" implementation.

Note
RenderEngineGl behaves a bit differently from other RenderEngine implementations (e.g., RenderEngineVtk) with respect to displayed images. First, RenderEngineGl can only display a single image type at a time. So, if a shown window has been requested for both label and color images, the images will alternate in the same window. Second, the window display draws all images flipped vertically. The image produced will be compatible with the Drake ecosystem, only the visualization will be upside down. This has been documented in https://github.com/RobotLocomotion/drake/issues/14254.
Warning
RenderEngineGl is not threadsafe. If a SceneGraph is instantiated with a RenderEngineGl and there are multiple Context instances for that SceneGraph, rendering in multiple threads may exhibit issues.

◆ MakeRenderEngineVtk()

std::unique_ptr<RenderEngine> drake::geometry::render::MakeRenderEngineVtk ( const RenderEngineVtkParams params)

Constructs a RenderEngine implementation which uses a VTK-based OpenGL renderer.

Geometry perception properties

This RenderEngine implementation looks for the following properties when registering visual geometry, categorized by rendered image type.

RGB images

Group name Property Name Required Property Type Property Description
phong diffuse no¹ Eigen::Vector4d The rgba value of the object surface.
phong diffuse_map no² std::string The path to a texture to apply to the geometry.³

¹ If no diffuse value is given, a default rgba value will be applied. The default color is a bright orange. This default value can be changed to a different value at construction.
² If no path is specified, or the file cannot be read, the diffuse rgba value is used (or its default). ³ RenderEngineVtk implements a legacy feature for associating textures with meshes. If no (phong, diffuse_map) property is provided (or it refers to a file that doesn't exist), for a mesh named /path/to/mesh.obj, RenderEngineVtk will search for a file /path/to/mesh.png (replacing "obj" with "png"). If that image exists, it will be used as a texture on the mesh object.

Depth images

No specific properties required.

Label images

Group name Property Name Required Property Type Property Description
label id configurable⁵ RenderLabel The label to render into the image.

⁵ RenderEngineVtk has a default render label value that is applied to any geometry that doesn't have a (label, id) property at registration. If a value is not explicitly specified, RenderEngineVtk uses RenderLabel::kUnspecified as this default value. It can be explicitly set upon construction. The possible values for this default label and the ramifications of that choice are documented here.

Geometries accepted by RenderEngineVtk

As documented in RenderEngine::RegisterVisual(), a RenderEngine implementation can use the properties found in the PerceptionProperties to determine whether it accepts a shape provided for registration. RenderEngineVtk makes use of defaults to accept all geometries (assuming the properties pass validation, e.g., render label validation).

◆ SetCylinderOptions()

void drake::geometry::render::SetCylinderOptions ( vtkCylinderSource *  vtk_cylinder,
double  height,
double  radius 
)

◆ SetSphereOptions()

void drake::geometry::render::SetSphereOptions ( vtkTexturedSphereSource *  vtk_sphere,
double  radius 
)

◆ TransformToDrakeCylinder()

void drake::geometry::render::TransformToDrakeCylinder ( vtkTransform *  transform,
vtkTransformPolyDataFilter *  transform_filter,
vtkCylinderSource *  vtk_cylinder 
)