Shadows

DiligentFX module now implements the Shadowing component that can be used by applications to render high-quality shadows.

Screenshot

The component implements the following shadowing BKMs:

  • Cascaded shadow maps with cascade stabilization
  • PCF
  • Variance shadow maps
  • Two and four-component exponential variance shadow maps
  • Optimized fixed-size or world-sized filter kernels
  • Best cascade search based on projection into light space
  • Filtering across cascades
  • Various artifact removal techniques

Preventing Erectile Dysfunction Condition There are various steps men can viagra pfizer cialis follow for reducing their risk for erectile dysfunction. If it’s a low education day, viagra in italy it is recommended to take the next amount about 8 hours after the initial dose. These soft cialis pills meds are antidepressants, medications utilized as a medicine to treat heart diseases. However, none of these can compare to the branded getting viagra in canada .

Integrating shadows into application

The component is implemented by the following source files:

ShadowMapManager.h/ShadowMapManager.cpp – implementation of the shadow map manager.
Shadows.fxh – shader functionality.

Initialization

The shadow map manager is responsible for creating required textures and views, cascade partitioning, converting shadow map to filterable representations (VSM/EVSM) etc.

To initialize the manager, prepare ShadowMapManager::InitInfo structure that defines initialization parameters and call ShadowMapManager::Initialize, for example:

Most of the fields of ShadowMapManager::InitInfo  structure are self-explanatory. pComparisonSampler  defines optional texture sampler to be set in the shadow map resource view. If the sampler is null, the application is responsible for setting appropriate sampler before using the shadow map in the shader.

Cascade Partitioning

To distribute shadow map cascades, populate ShadowMapManager::DistributeCascadeInfo that defines partitioning parameters and call ShadowMapManager::DistributeCascades:

fPartitioningFactor member defines the ratio between fully linear (0.0) and fully logarithmic (1.0) partitioning. The method populates the ShadowMapAttribs structure that is part of the LightAttribs structure and should be made available to a shader via constant buffer.

Rendering Shadow Cascades

After cascades are distributed, use ShadowMapManager::GetCascadeTranform method to access transform matrices and render every cascade:

 

When using filterable represenations, the shadow map must be post-processed before it can be used in a shader:

Rendering with Shadows

To use shadowing functionality in the shader, include BasicStructures.fxh and Shadows.fxh files and depending on the shadowing mode, define shadow map or filterable shadow map textures and corresponding samplers (note that the names must be different to allow HLSL to GLSL conversion):

To filter shadow map, call FilterShadowMap or SampleFilterableShadowMap  function:

 

Shadow filtering mode is controlled by a number of macros that should be defined when creating the shader:

Shadows sample gives an example of using the shadowing component.

References

Variance Shadow Maps
Layered variance shadow maps
Shadow sample update by MJP
MJP’s shadows sample source code
Shadow Explorer sample from Intel
Cascaded Shadow Maps technical article by Microsoft

 

Leave a Comment

Your email address will not be published.