Landscape Light

From C4 Engine Wiki

Jump to: navigation, search

The landscape light is one of the fundamental light types in the C4 Engine. It is an infinite light, meaning that it is considered to be infinitely far away regardless of its position in a scene, and all of its rays are parallel. The landscape light uses a shadow casting technique known as cascaded shadow mapping in order to display real-time dynamic shadows over very large areas. This article describes the settings that pertain to the shadows cast by the landscape light.

Shadow Settings

The landscape light generates up to four separate shadows maps during every frame in which it is visible. These four shadow maps are rendered at different resolutions for four sections of space corresponding to increasing distance ranges from the camera position. This concept is illustrated in the following diagram.

Image:Landscape.png

The sizes of the sections are specified by four maximum distance settings in the Node Info window for the landscape light. As shown in the figure, these four distances determine the far planes for the four shadow sections. Shadow maps for sections closer to the camera are rendered at higher resolutions, and the distance between adjacent lower numbered sections is typically lower than the distance between adjacent higher numbered sections. If smaller distances are used, then the shadows are rendered at higher resolution, but the coverage of the landscape light is reduced as well.

The four sections overlap by a little bit so that a smooth transition from one resolution to the next can be rendered for objects that straddle a section boundary. The three transition lengths specify how much distance each section extends into the one preceding it. A short distance means a quick transition, and longer distances mean more gradual transitions. The transition length can be any distance smaller than the higher-resolution section's overall size, but it typically covers only a fraction of the whole section.

Shadow Casting and Receiving

Each section has its own shadow map. Because sections overlap, shadow castors may contribute to more than one of these shadow maps, and in fact could contribute to all of the sections. An object must be rendered into the shadow map n times if it crosses into n sections, so this should be considered when designing your worlds.

Starting with version 2.5.5, an object can also receive shadows in all four shadow sections. Which shadow map to use is determined on a per-pixel basis in the shader, so the highest-resolution shadow map covering an object is always used wherever possible. In the transition area between sections, samples from both sections' shadow maps are blended together in order to produce a smooth transition from one resolution to the next. The number of sections into which a shadow-receiving object crosses does not affect rendering performance. Whether an object falls completely in one section or extends through all four sections, the rendering speed is the same.

See Also

Personal tools