Click or drag to resize
Ab4d.SharpEngine logo

SoftShadowRenderingProvider Class

SoftShadowRenderingProvider provides support for rendering shadow of a single shadow casting light (DirectionalLight or SpotLight). It can render shadows by using Percentage Closer Soft Shadows (PCSS) algorithm. When the ShadowSamplesCount is set to 1 or ShadowLightSize or ShadowBlockerSearchRadius are set to 0, then the shadow is the same regardless of the distance from the shadow casting object. To add a shadow casting light to the scene, call CreateSoftShadowRenderingProvider(ILight) method and it will return the SoftShadowRenderingProvider object. Based on the scene you may need to adjust the ShadowNormalBias, ShadowConstantBias or ShadowSlopeBias to prevent shadow artifacts (shadow acne, peter panning, etc.).
Inheritance Hierarchy
SystemObject
  Ab4d.SharpEngine.CoreComponentBase
    Ab4d.SharpEngine.CoreSceneComponent
      Ab4d.SharpEngine.UtilitiesSoftShadowRenderingProvider

Namespace: Ab4d.SharpEngine.Utilities
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 4.1.9680+a1b1e43de1ad9a7e35472c33948d688d7b40ef79
Syntax
C#
public class SoftShadowRenderingProvider : SceneComponent, 
	IDisposable

The SoftShadowRenderingProvider type exposes the following members.

Properties
 NameDescription
Public propertyDepthFormat 
Public propertyIsSpotLight 
Public propertyLightZFar 
Public propertyLightZNear 
Public propertyShadowBlockerSearchRadius Gets or sets the radius used to search for shadow blockers in the Percentage Closer Soft Shadows (PCSS) algorithm. A larger value increases the area used to determine the shadow blockers, which can result in softer shadows. When set to 0, the shadow becomes hard and does not vary based on the distance from the shadow casting object.
Public propertyShadowBlur Gets or sets the shadow blur factor used to control the softness of shadow edges. This blur amount is not dependent on the distance from the shadow object as it is when using ShadowLightSize.
Public propertyShadowConstantBias Gets or sets the depth bias used to reduce shadow artifacts, such as shadow acne, caused by precision issues in shadow mapping. This value offsets the depth of the lights (distance from the lights to the object). A higher value increases the bias, which can help reduce artifacts but may also cause shadows to appear detached from objects. The default value is 0.001.
Public propertyShadowDepthImage 
Public propertyShadowDepthSampler 
Public propertyShadowLight Gets the light that is casting the shadow.
Public propertyShadowLightSize Gets or sets the size of the light source used for rendering soft shadows. A larger value results in softer shadows with a more pronounced penumbra, while a smaller value produces harder shadows. Setting this value to 0 results in hard shadows, regardless of the distance from the shadow casting object. To set constat shadow blur that is not dependent to the distance from the shadow object, use ShadowBlur.
Public propertyShadowMapSize Gets or sets and integer value that represents the size of a shadow depth map texture. Default value is 1024 and means that by default a 1024 x 1024 texture is used.
Public propertyShadowNormalBias Gets or sets the normal bias used to reduce shadow artifacts, such as shadow acne, caused by precision issues in shadow mapping. This value offsets the position of the shadow receiver along its normal vector. A higher value increases the bias, which can help reduce artifacts but may also cause shadows to appear detached from objects. The default value is 1.0.
Public propertyShadowSamplesCount Gets or sets how many samples are used for soft shadows. The minimum value is 8. The maximum value is 64. Default value is 16.
Public propertyShadowSlopeBias Gets or sets the slope-scaled depth bias used to reduce shadow artifacts, such as shadow acne, caused by precision issues in shadow mapping. This value adjusts the bias based on the slope of the surface relative to the light direction. A higher value increases the bias, which can help reduce artifacts but may also cause shadows to appear detached from objects. The default value is 1.0.
Top
Methods
Fields
 NameDescription
Public fieldMinDepthNearPlaneDistance 
Top
See Also