Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
RenderEngineGlParams Struct Reference

Detailed Description

Construction parameters for RenderEngineGl.

#include <drake/geometry/render_gl/render_engine_gl_params.h>

Public Member Functions

template<typename Archive>
void Serialize (Archive *a)
 Passes this object to an Archive.

Public Attributes

Rgba default_diffuse {0.9, 0.7, 0.2, 1.0}
 Default diffuse color to apply to a geometry when none is otherwise specified in the (phong, diffuse) property.
Rgba default_clear_color {204 / 255., 229 / 255., 255 / 255., 1.0}
 The default background color for color images.
std::vector< render::LightParameter > lights
 Lights in the scene.
bool cast_shadows {false}
 If true, all lights that are able to cast shadows will do so.
int shadow_map_size {256}
 The size of texture map (in pixels) to use for shadow maps.

Member Function Documentation

◆ Serialize()

template<typename Archive>
void Serialize ( Archive * a)

Passes this object to an Archive.

Refer to YAML Serialization for background.

Member Data Documentation

◆ cast_shadows

bool cast_shadows {false}

If true, all lights that are able to cast shadows will do so.

Several important notes when designing your lighting:

  • Point lights do not cast shadows.
  • Spot lights will not cast shadows if the spot light angle is 90 degrees or more. At 90 degrees, the spot light is now a half-point light. Even though 89.9 degrees would enable shadows, it is still an impractical value. To actually see shadows, the shadow_map_size value would have to be absurdly large to support such a wide extent.
  • Directional lights will create a shadow map that spans the whole scene. If your scene includes a geometry that is significantly larger than the locale you're rendering, this will significantly reduce the efficacy of the directional light's shadows. Consider truncating that larger geometry. A common case would be to use a HalfSpace to define a ground. A half space has infinite extent, so any reasonable approximation would be quite large. Better to use a box targeted to where you need it.
  • Shadows may have unexpected behavior with transparent objects.
    • Transparent objects will receive shadows.
    • If the object is rendered transparent in the diffuse color's alpha channel (i.e., any alpha value less than 1.0), the object will not cast shadows.
    • If the object has full diffuse color alpha, but it has a diffuse map with non opaque texels, the object will cast shadows and the shadows will completely ignore the texel transparency (the whole mesh will be treated as fully opaque).
  • If you only plan to render depth or label images, leave this as false. Setting it as true will increase start up time and GPU memory usage to support shadows that will never be used.

Currently, there is no way to enable/disable shadows on a per-light basis.

◆ default_clear_color

Rgba default_clear_color {204 / 255., 229 / 255., 255 / 255., 1.0}

The default background color for color images.

◆ default_diffuse

Rgba default_diffuse {0.9, 0.7, 0.2, 1.0}

Default diffuse color to apply to a geometry when none is otherwise specified in the (phong, diffuse) property.

◆ lights

std::vector<render::LightParameter> lights

Lights in the scene.

If no lights are defined, a single directional light, fixed to the camera frame, is used.

Note: RenderEngineGl does not have a hard-coded limit on the number of lights, but more lights increases rendering cost.

◆ shadow_map_size

int shadow_map_size {256}

The size of texture map (in pixels) to use for shadow maps.

Note: this is a global setting. All shadow casting lights will use a map of the same size. Larger map sizes increase GPU memory usage and rendering times but improve shadow fidelity (less obvious pixelation).

See the note on cast_shadows for the warning on directional lights and shadow maps.

Precondition
shadow_map_size is positive and does not exceed the OpenGL implementation's maximum allowable texture size. Powers of two are best.

The documentation for this struct was generated from the following file: