Shadows Visualization (Part 2 of 2)

Andrew Markovich

November 06, 2020

In the previous article, we enabled shadows in general. This topic describes how to work with shadows on a per-entity basis and how shadows vary depending on the type of light source and properties that you can set. For the previous article about enabling shadows, see Shadows Visualization (Part 1 of 2).

Per-Entity Shadow Configuration

By default, all entities inside a scene receive and cast shadows, however, you can control this behavior for each entity.

void setEntityShadowParameters(OdDbEntity *pEntity, bool bCastShadows, bool bReceiveShadows)


shadow configuration example


The methods from the code example above influence not only shadow generation performance but also can help create better visual effects. For example, if your graphics scene contains a table lamp with a lampshade and a light source is placed under it, you can exclude the lamp entity from the shadow casting process to avoid shadow generation for the lampshade occlusion object (blocking object).

Light Source Type

Resulting shadows depend on the type of light source:

  • Distant light — The simplest light source type. It is specified only by a light direction vector, and it influences the entire graphics scene.
Distant light example
  • Spot light — Represents a lighting cone inside a scene. It has a position, direction, and an angle that controls the projector lighting area.
spot light example
  • Point light — Specified only by position and emits lighting in all graphics scene directions.
Point light example


Spot and point light types contain additional attenuation parameters, which can be used to control attenuation of light intensity to different lengths from a light source. It is recommended to use start and end light attenuation limits to control lighting areas and exclude lighting in scene parts where it is not needed.

The next topic in this series will describe how to further control shadows using various properties.

Renderer Settings

Renderers contain additional properties for precise control of shadow behavior. Typically these properties aren't required and can be used with their default settings, but sometimes they can be helpful to reach more stable or correct results.

  • ShadowsRenderMode — The ShadowsRenderMode property represents a bit mask that can be used to enable/disable shadow generation features such as cube maps, smoothing, and more.
  • VsmShadowsAmount — Variance shadows may contain artifacts caused by edges of occlusion objects displaced a large length from other occlusion objects inside a scene. This effect is called light-bleeding. Unfortunately the amount of this effect depends on rendered scene specifics and cannot be computed automatically. The VsmShadowsAmount property gives you the ability to minimize the described light-bleeding effect and can be experimentally selected by client applications.
  • ShadowMapSoftnessOverride — The ShadowMapSoftnessOverride property provides the ability to override a shadow blur effect amount for all light sources inside a scene. By default it is enabled and set to 3. It can be set in the range of [0..3].
  • ShadowMapSizeOverride — The ShadowMapSizeOverride property provides the ability to override shadow texture size for all light sources inside a scene. By default it is disabled. Larger texture sizes allow you to get more detailed shadows but provide shadow edges that are crisper. With smaller texture sizes, shadow edges are smoother but contain fewer details. Larger texture sizes also require more GPU memory and resources for shadow map generation.

These shadow properties are described in more detail in ODA documentation (login required).

All shadow properties can be set through the standard graphics system properties interface. To get more information about properties of vectorization, see ODA Vectorization Device Properties (login required).