Shaders for Shadows
Shader code for rendering shadows of translucent occluders, soft shadows and single scattering with moment shadow maps.
 All Classes Files Functions Variables Pages
Functions
Shadow.fx File Reference
#include "ShadowUtility.fx"
#include "TrigonometricMomentProblemShadow.fx"
#include "RandomNumbers.fx"

Go to the source code of this file.

Functions

void ComputeFragmentDepth (out float OutFragmentDepth, float4 ProjectionSpacePosition)
 
void ComputeShadowMapDepth (out float OutShadowMapDepth, float FragmentDepth)
 
void CombineVectorWithAlpha_float1 (out float4 OutVectorWithAlpha, float Vector, float Alpha)
 
void CombineVectorWithAlpha_float2 (out float4 OutVectorWithAlpha, float2 Vector, float Alpha)
 
void CombineVectorWithAlpha_float3 (out float4 OutVectorWithAlpha, float3 Vector, float Alpha)
 
void CombineVectorWithAlpha_float4 (out float4 OutVectorWithAlpha, float4 Vector)
 
void ConvertShadowIntensityToColor (out float4 OutColor, float ShadowIntensity)
 
void ComputeMomentVectorExponential (out float OutExponential, float FragmentDepth, float Factor=80.0f)
 
void ComputeMomentVectorFourier8 (out float4 OutFourier1_2, out float4 OutFourier3_4, out float4 OutFourier5_6, out float4 OutFourier7_8, float FragmentDepth)
 
void ComputeMomentVectorFourier16 (out float4 OutFourier1_2, out float4 OutFourier3_4, out float4 OutFourier5_6, out float4 OutFourier7_8, out float4 OutFourier9_10, out float4 OutFourier11_12, out float4 OutFourier13_14, out float4 OutFourier15_16, float FragmentDepth)
 
void ComputeTrigonometricMomentVector (out float4 OutFourier1_2, float FragmentDepth)
 
void ComputeExponentialVarianceVector (out float4 OutDepthExponentialVariance, float FragmentDepth, float2 ExponentialVarianceFactors)
 
void ComputeExponentialVarianceVectorSplit (out float2 OutDepthExponentialVariance0, out float2 OutDepthExponentialVariance1, float FragmentDepth, float2 ExponentialVarianceFactors)
 
void ComputeMomentVector2Moments_float2 (out float2 Out2Moments_float2, float FragmentDepth)
 
void ComputeMomentVector4Moments_float4 (out float4 Out4Moments_float4, float FragmentDepth)
 
void ComputeMomentVector4MomentsOptimized_float4 (out float4 Out4MomentsOptimized_float4, float FragmentDepth)
 
void ComputeMomentVector4Moments_float2_float2 (out float2 Out4Moments0_float2, out float2 Out4Moments1_float2, float FragmentDepth)
 
void ComputeMomentVector4MomentsOptimized_float2_float2 (out float2 Out4MomentsOptimized0_float2, out float2 Out4MomentsOptimized1_float2, float FragmentDepth)
 
void ComputeDirectionalLightCamera (out float4x4 OutViewToWorldSpace, out float4x4 OutViewToProjectionSpace, float3 WorldSpaceBoundingBoxMin, float3 WorldSpaceBoundingBoxMax, float3 WorldSpaceLightDirection)
 
void ComputeSpotLightCamera (out float4x4 OutViewToWorldSpace, out float4x4 OutViewToProjectionSpace, float3 WorldSpaceLightPosition, float3 WorldSpaceConeAxisDirection, float OuterConeAngle, float NearClippingPlane, float FarClippingPlane)
 
void ComputeShadowMapCoordinate (out float2 OutShadowMapTexCoord, out float OutShadowMapDepth, float4 ShadowMapProjectionSpacePosition, float4 ShadowMapSize)
 
void ComputeWorldSpacePositionUnderCursor (out float3 OutWorldSpacePosition, Texture2DMS< float, 1 > SceneDepthTexture, float4 SceneDepthTextureSize, int2 iCursorPosition, float4x4 CameraProjectionToWorldSpace)
 
void HeavisideStepFunction (out float OutShadowIntensity, float BlockerDepth, float FragmentDepth)
 
void SampleShadowMap (out float OutShadowMapDepth, SSamplerTexturePair2D_float ShadowMapSampler, float2 ShadowMapTexCoord)
 
void SampleExponentialVarianceShadowMap (out float4 OutExponentialVarianceVector, SSamplerTexturePair2D ExponentialVarianceShadowMapSampler0, float2 ShadowMapTexCoord)
 
void SampleExponentialVarianceSplitShadowMap (out float4 OutExponentialVarianceVector, SSamplerTexturePair2D_float2 ExponentialVarianceShadowMapSampler0, SSamplerTexturePair2D_float2 ExponentialVarianceShadowMapSampler1, float2 ShadowMapTexCoord)
 
void SampleExponentialShadowMap (out float OutExponentialShadowMap, SSamplerTexturePair2D_float ExponentialShadowMapSampler, float2 ShadowMapTexCoord)
 
void SampleConvolutionShadowMap8 (out float2 pOutFourierCoefficient[8], SSamplerTexturePair2D ConvolutionShadowMapSampler0, SSamplerTexturePair2D ConvolutionShadowMapSampler1, SSamplerTexturePair2D ConvolutionShadowMapSampler2, SSamplerTexturePair2D ConvolutionShadowMapSampler3, float2 ShadowMapTexCoord)
 
void SampleConvolutionShadowMap16 (out float2 pOutFourierCoefficient[16], SSamplerTexturePair2D ConvolutionShadowMapSampler0, SSamplerTexturePair2D ConvolutionShadowMapSampler1, SSamplerTexturePair2D ConvolutionShadowMapSampler2, SSamplerTexturePair2D ConvolutionShadowMapSampler3, SSamplerTexturePair2D ConvolutionShadowMapSampler4, SSamplerTexturePair2D ConvolutionShadowMapSampler5, SSamplerTexturePair2D ConvolutionShadowMapSampler6, SSamplerTexturePair2D ConvolutionShadowMapSampler7, float2 ShadowMapTexCoord)
 
void Sample2TMSMShadowMap (out float2 pOutFourierCoefficient[2], SSamplerTexturePair2D _2TMSMShadowMapSampler, float2 ShadowMapTexCoord)
 
void Sample2MomentShadowMap (out float2 OutBiased2Moments, SSamplerTexturePair2D_float2 _2MomentShadowMapSampler, float2 ShadowMapTexCoord, float MomentBias=0.0f)
 
void Convert2MomentToCanonical (out float2 OutBiased2Moments, float2 Moments0, float MomentBias=0.0f)
 
void Sample4MomentShadowMap (out float4 OutBiased4Moments, SSamplerTexturePair2D _4MomentShadowMapSampler, float2 ShadowMapTexCoord, float MomentBias=3.0e-7f)
 
void Sample4MomentOptimizedShadowMap (out float4 OutBiased4Moments, SSamplerTexturePair2D _4MomentOptimizedShadowMapSampler, float2 ShadowMapTexCoord, float MomentBias=6.0e-5f)
 
void Sample4MomentSplitShadowMap (out float4 OutBiased4Moments, SSamplerTexturePair2D_float2 _4MomentShadowMapSampler0, SSamplerTexturePair2D_float2 _4MomentShadowMapSampler1, float2 ShadowMapTexCoord, float MomentBias=3.0e-7f)
 
void Sample4MomentOptimizedSplitShadowMap (out float4 OutBiased4Moments, SSamplerTexturePair2D_float2 _4MomentOptimizedShadowMapSampler0, SSamplerTexturePair2D_float2 _4MomentOptimizedShadowMapSampler1, float2 ShadowMapTexCoord, float MomentBias=6.0e-5f)
 
void Convert4MomentToCanonical (out float4 OutBiased4Moments, float4 Moments0, float MomentBias=3.0e-7f)
 
void ConvertSplit4MomentToCanonical (out float4 OutBiased4Moments, float2 Moments0, float2 Moments1, float MomentBias=3.0e-7f)
 
void Convert4MomentOptimizedToCanonical (out float4 OutBiased4Moments, float4 OptimizedMoments0, float MomentBias=6.0e-5f)
 
void ConvertSplit4MomentOptimizedToCanonical (out float4 OutBiased4Moments, float2 OptimizedMoments0, float2 OptimizedMoments1, float MomentBias=6.0e-5f)
 
void ScaleShadowIntensity (out float OutShadowIntensity, float ShadowIntensity, float ShadowIntensityFactor, float2 ShadowMapTexCoord, float FragmentDepth)
 
void ComputeHardShadowIntensity (out float OutShadowIntensity, float SampledShadowMapDepth, float FragmentDepth, float DepthBias)
 
void ComputePCFShadowIntensity1x1 (out float OutShadowIntensity, SSamplerTexturePair2D_float ShadowMapSampler, float2 ShadowMapTexCoord, float FragmentDepth, float4 ShadowMapSize, float DepthBias)
 
void ComputePCFShadowIntensity5x5 (out float OutShadowIntensity, SSamplerTexturePair2D_float ShadowMapSampler, float2 ShadowMapTexCoord, float FragmentDepth, float4 ShadowMapSize, float DepthBias)
 
void ComputePCFShadowIntensity7x7 (out float OutShadowIntensity, SSamplerTexturePair2D_float ShadowMapSampler, float2 ShadowMapTexCoord, float FragmentDepth, float4 ShadowMapSize, float DepthBias)
 
void ComputePCFShadowIntensity9x9 (out float OutShadowIntensity, SSamplerTexturePair2D_float ShadowMapSampler, float2 ShadowMapTexCoord, float FragmentDepth, float4 ShadowMapSize, float DepthBias)
 
void ComputePCFShadowIntensity15x15 (out float OutShadowIntensity, SSamplerTexturePair2D_float ShadowMapSampler, float2 ShadowMapTexCoord, float FragmentDepth, float4 ShadowMapSize, float DepthBias)
 
void ComputePCFShadowIntensityPoisson (out float OutShadowIntensity, SSamplerTexturePair2D_float ShadowMapSampler, float2 ShadowMapTexCoord, float FragmentDepth, float4 ShadowMapSize, float DepthBias, float KernelDiameter)
 
void ComputeExponentialShadowIntensity (out float OutShadowIntensity, float ExponentialShadowMapSample, float FragmentDepth, float DepthBias, float Factor=80.0f)
 
void ComputeConvolutionShadowIntensity8 (out float OutShadowIntensity, float2 pFourierCoefficient[8], float FragmentDepth, float DepthBias)
 
void ComputeConvolutionShadowIntensity16 (out float OutShadowIntensity, float2 pFourierCoefficient[16], float FragmentDepth, float DepthBias)
 
void ComputeExponentialVarianceShadowIntensity (out float OutShadowIntensity, float4 ExponentialVarianceVector, float FragmentDepth, float DepthBias, float2 ExponentialVarianceFactors)
 
void Compute2MomentShadowIntensity (out float OutShadowIntensity, float2 Biased2Moments, float FragmentDepth, float DepthBias)
 
void Compute4MomentShadowIntensity (out float OutShadowIntensity, float4 Biased4Moments, float FragmentDepth, float DepthBias)
 
void Compute4MomentUnboundedShadowIntensity (out float OutShadowIntensity, float4 Biased4Moments, float FragmentDepth, float DepthBias)
 
void Compute2TMSMShadowIntensity (out float OutShadowIntensity, float2 pFourierCoefficient[2], float FragmentDepth, float DepthBias, float MomentBias)
 
void ApplyGaussianFilterHorizontal5_float4 (out float4 OutFilteredValue, SSamplerTexturePair2D SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical5_float4 (out float4 OutFilteredValue, SSamplerTexturePair2D SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal7_float4 (out float4 OutFilteredValue, SSamplerTexturePair2D SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical7_float4 (out float4 OutFilteredValue, SSamplerTexturePair2D SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal9_float4 (out float4 OutFilteredValue, SSamplerTexturePair2D SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical9_float4 (out float4 OutFilteredValue, SSamplerTexturePair2D SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal15_float4 (out float4 OutFilteredValue, SSamplerTexturePair2D SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical15_float4 (out float4 OutFilteredValue, SSamplerTexturePair2D SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal5_float2 (out float4 OutFilteredValue, SSamplerTexturePair2D_float2 SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical5_float2 (out float4 OutFilteredValue, SSamplerTexturePair2D_float2 SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal7_float2 (out float4 OutFilteredValue, SSamplerTexturePair2D_float2 SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical7_float2 (out float4 OutFilteredValue, SSamplerTexturePair2D_float2 SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal9_float2 (out float4 OutFilteredValue, SSamplerTexturePair2D_float2 SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical9_float2 (out float4 OutFilteredValue, SSamplerTexturePair2D_float2 SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal15_float2 (out float4 OutFilteredValue, SSamplerTexturePair2D_float2 SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical15_float2 (out float4 OutFilteredValue, SSamplerTexturePair2D_float2 SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal5_float (out float4 OutFilteredValue, SSamplerTexturePair2D_float SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical5_float (out float4 OutFilteredValue, SSamplerTexturePair2D_float SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal7_float (out float4 OutFilteredValue, SSamplerTexturePair2D_float SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical7_float (out float4 OutFilteredValue, SSamplerTexturePair2D_float SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal9_float (out float4 OutFilteredValue, SSamplerTexturePair2D_float SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical9_float (out float4 OutFilteredValue, SSamplerTexturePair2D_float SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterHorizontal15_float (out float4 OutFilteredValue, SSamplerTexturePair2D_float SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyGaussianFilterVertical15_float (out float4 OutFilteredValue, SSamplerTexturePair2D_float SourceSampler, float2 TexCoord, float4 TextureSize)
 
void ApplyPrefixSumHorizontal_float4 (inout RWTexture2D< float4 > OutFilteredTexture, SSamplerTexturePair2D SourceSampler, uint3 ThreadID)
 
void ApplyPrefixSumVertical_float4 (inout RWTexture2D< float4 > OutFilteredTexture, SSamplerTexturePair2D SourceSampler, uint3 ThreadID)
 
void ApplyPrefixSumHorizontal_uint4 (inout RWTexture2D< uint4 > OutFilteredTexture, SSamplerTexturePair2D SourceSampler, uint3 ThreadID, float2 FixedPrecision)
 
void ApplyPrefixSumVertical_uint4 (inout RWTexture2D< uint4 > OutFilteredTexture, SSamplerTexturePair2D_uint4 SourceSampler, uint3 ThreadID)
 
void ApplyPrefixSumHorizontal_float2 (inout RWTexture2D< float2 > OutFilteredTexture, SSamplerTexturePair2D_float2 SourceSampler, uint3 ThreadID)
 
void ApplyPrefixSumVertical_float2 (inout RWTexture2D< float2 > OutFilteredTexture, SSamplerTexturePair2D_float2 SourceSampler, uint3 ThreadID)
 
void ApplyPrefixSumHorizontal_uint2 (inout RWTexture2D< uint2 > OutFilteredTexture, SSamplerTexturePair2D_float2 SourceSampler, uint3 ThreadID, float2 FixedPrecision)
 
void ApplyPrefixSumVertical_uint2 (inout RWTexture2D< uint2 > OutFilteredTexture, SSamplerTexturePair2D_uint2 SourceSampler, uint3 ThreadID)
 
void ApplyPrefixSumHorizontal_half4 (inout RWTexture2D< half4 > OutFilteredTexture, SSamplerTexturePair2D SourceSampler, uint3 ThreadID)
 
void ApplyPrefixSumVertical_half4 (inout RWTexture2D< half4 > OutFilteredTexture, SSamplerTexturePair2D SourceSampler, uint3 ThreadID)
 
void GetSummedAreaTableThreadGroupCount (out uint3 nOutThreadGroupHorizontal, out uint3 nOutThreadGroupVertical, uint3 ThreadGroupSizeHorizontal, uint3 ThreadGroupSizeVertical, float4 TextureSize)
 
void ComputeRectangleAverage_uint4 (out float4 OutAverageValue, float2 LeftTop, float2 RightBottom, SSamplerTexturePair2D_uint4 SummedAreaTableSampler, float4 TextureSize, float2 FixedPrecision)
 
void ComputeIntegerRectangleAverage_uint4 (out float4 OutAverageValue, float2 LeftTop, float2 RightBottom, SSamplerTexturePair2D_uint4 SummedAreaTableSampler, float4 TextureSize, float2 FixedPrecision)
 
void ComputeRectangleAverage_float4 (out float4 OutAverageValue, float2 LeftTop, float2 RightBottom, SSamplerTexturePair2D SummedAreaTableSampler, float4 TextureSize)
 
void ComputeRectangleAverage_uint2 (out float2 OutAverageValue, float2 LeftTop, float2 RightBottom, SSamplerTexturePair2D_uint2 SummedAreaTableSampler, float4 TextureSize, float2 FixedPrecision)
 
void ComputeIntegerRectangleAverage_uint2 (out float2 OutAverageValue, float2 LeftTop, float2 RightBottom, SSamplerTexturePair2D_uint2 SummedAreaTableSampler, float4 TextureSize, float2 FixedPrecision)
 
void ComputeRectangleAverage_float2 (out float2 OutAverageValue, float2 LeftTop, float2 RightBottom, SSamplerTexturePair2D_float2 SummedAreaTableSampler, float4 TextureSize)
 
void ComputeFixedPrecision (out float2 OutFixedPrecision, float3x2 KernelSizeParameter, float2 ShadowMapSize)
 
void GetBlockerSearchRectangle (out float2 OutSearchRegionLeftTop, out float2 OutSearchRegionRightBottom, float2 SearchRegionCenter, float3x2 KernelSizeParameter, float4 ShadowMapSize)
 
void GetShadowFilterRectangle (out float2 OutFilterRegionLeftTop, out float2 OutFilterRegionRightBottom, float2 FilterRegionCenter, float2 KernelSize)
 
void EstimatePenumbraSize (out float2 OutKernelSize, out float OutDepthBias, float OccluderDepth, float FragmentDepth, float3x2 LightParameter, float3x2 KernelSizeParameter, float MaxDepthBias)
 
void ComputeDirectionalLightSoftShadowParameters (out float3x2 OutLightParameter, float4x4 ViewToProjectionSpace, float2 LightSourceAngle)
 
void Compute2MomentAverageBlockerDepth (out float OutAverageBlockerDepth, out float OutBlockerSearchShadowIntensity, float2 BlockerSearchBiased2Moments, float FragmentDepth, float DepthBias)
 
void Compute4MomentAverageBlockerDepth (out float OutAverageBlockerDepth, out float OutBlockerSearchShadowIntensity, float4 BlockerSearchBiased4Moments, float FragmentDepth)
 
void ComputePCSSAverageBlockerDepth (out float OutAverageBlockerDepth, out float OutBlockerSearchShadowIntensity, SSamplerTexturePair2D_float ShadowMapSampler, float2 ShadowMapTexCoord, float FragmentDepth, float4 ShadowMapSize, float DepthBias, float3x2 KernelSizeParameter)
 
void PickShadowIntensity (out float OutShadowIntensity, float FilteredShadowIntensity, float BlockerSearchShadowIntensity)
 
void ComputeIntegerPCSSShadowIntensity (out float OutShadowIntensity, SSamplerTexturePair2D_float ShadowMapSampler, float2 FilterRegionLeftTop, float2 FilterRegionRightBottom, float FragmentDepth, float4 ShadowMapSize, float DepthBias)
 
void ComputePCSSShadowIntensity (out float OutShadowIntensity, float BlockerSearchShadowIntensity, SSamplerTexturePair2D_float ShadowMapSampler, float2 FilterRegionLeftTop, float2 FilterRegionRightBottom, float FragmentDepth, float4 ShadowMapSize, float DepthBias)
 
void LoadDepthSample1 (out float OutDepthSample, Texture2DMS< float, 1 > ShadowMap, float2 TexCoord, uint SampleIndex, float4 ShadowMapSize)
 
void LoadDepthSample2 (out float OutDepthSample, Texture2DMS< float, 2 > ShadowMap, float2 TexCoord, uint SampleIndex, float4 ShadowMapSize)
 
void LoadDepthSample4 (out float OutDepthSample, Texture2DMS< float, 4 > ShadowMap, float2 TexCoord, uint SampleIndex, float4 ShadowMapSize)
 
void LoadDepthSample8 (out float OutDepthSample, Texture2DMS< float, 8 > ShadowMap, float2 TexCoord, uint SampleIndex, float4 ShadowMapSize)
 
void AddShadowMapData_float (out float OutSum, float LHS, float RHS)
 
void AddShadowMapData_float2 (out float2 OutSum, float2 LHS, float2 RHS)
 
void AddShadowMapData_float4 (out float4 OutSum, float4 LHS, float4 RHS)
 
void AddShadowMapData_uint2 (out uint2 OutSum, uint2 LHS, uint2 RHS)
 
void AddShadowMapData_uint4 (out uint4 OutSum, uint4 LHS, uint4 RHS)
 
void AddShadowMapData_half4 (out half4 OutSum, half4 LHS, half4 RHS)
 
void ComputeSampleAverage_float (out float OutSampleAverage, float SampleSum, uint nSample)
 
void ComputeSampleAverage_float2 (out float2 OutSampleAverage, float2 SampleSum, uint nSample)
 
void ComputeSampleAverage_float4 (out float4 OutSampleAverage, float4 SampleSum, uint nSample)
 
void ComputeSampleAverage_uint2 (out uint2 OutSampleAverage, uint2 SampleSum, uint nSample)
 
void ComputeSampleAverage_uint4 (out uint4 OutSampleAverage, uint4 SampleSum, uint nSample)
 
void ComputeSampleAverage_half4 (out half4 OutSampleAverage, half4 SampleSum, uint nSample)
 

Detailed Description

Provides function definitions for all available shadow mapping techniques. This includes parametrization, generation, post-processing and usage of shadow maps.

Definition in file Shadow.fx.

Function Documentation

void AddShadowMapData_float ( out float  OutSum,
float  LHS,
float  RHS 
)

The following functions add two vectors to be stored in a shadow map. They are used to combine moment vectors for different samples of a multisampled depth stencil texture.

Parameters
OutSumThe component-wise sum of the vectors.
LHS,RHSThe summands.

Definition at line 969 of file Shadow.fx.

void ApplyGaussianFilterHorizontal15_float ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 4.3 and kernel size 15.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1253 of file Shadow.fx.

void ApplyGaussianFilterHorizontal15_float2 ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float2  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 4.3 and kernel size 15.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1169 of file Shadow.fx.

void ApplyGaussianFilterHorizontal15_float4 ( out float4  OutFilteredValue,
SSamplerTexturePair2D  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 4.3 and kernel size 15.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1081 of file Shadow.fx.

void ApplyGaussianFilterHorizontal5_float ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 1.2 and kernel size 5.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1199 of file Shadow.fx.

void ApplyGaussianFilterHorizontal5_float2 ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float2  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 1.2 and kernel size 5.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1109 of file Shadow.fx.

void ApplyGaussianFilterHorizontal5_float4 ( out float4  OutFilteredValue,
SSamplerTexturePair2D  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

This function can be used to filter a texture using a horizontal Gaussian with standard deviation 1.2, cut off to obtain a 5-texel kernel.

Parameters
OutFilteredValueThe weighted sum of the values in the kernel.
SourceSamplerA sampler for the texture to be filtered, which uses bilinear interpolation.
TexCoordA grid-aligned texture coordinate, i.e. its x-coordinate is a multiple of TextureSize.z and its y-coordinate is a multiple of TextureSize.w.
TextureSizeThe source texture size in x and y and its reciproque in z and w.

Definition at line 1027 of file Shadow.fx.

void ApplyGaussianFilterHorizontal7_float ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 1.8 and kernel size 7.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1215 of file Shadow.fx.

void ApplyGaussianFilterHorizontal7_float2 ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float2  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 1.8 and kernel size 7.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1127 of file Shadow.fx.

void ApplyGaussianFilterHorizontal7_float4 ( out float4  OutFilteredValue,
SSamplerTexturePair2D  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 1.8 and kernel size 7.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1043 of file Shadow.fx.

void ApplyGaussianFilterHorizontal9_float ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 2.4 and kernel size 9.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1233 of file Shadow.fx.

void ApplyGaussianFilterHorizontal9_float2 ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float2  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 2.4 and kernel size 9.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1147 of file Shadow.fx.

void ApplyGaussianFilterHorizontal9_float4 ( out float4  OutFilteredValue,
SSamplerTexturePair2D  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Horizontal Gaussian filter with standard deviation 2.4 and kernel size 9.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1061 of file Shadow.fx.

void ApplyGaussianFilterVertical15_float ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 4.3 and kernel size 15.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1266 of file Shadow.fx.

void ApplyGaussianFilterVertical15_float2 ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float2  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 4.3 and kernel size 15.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1183 of file Shadow.fx.

void ApplyGaussianFilterVertical15_float4 ( out float4  OutFilteredValue,
SSamplerTexturePair2D  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 4.3 and kernel size 15.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1094 of file Shadow.fx.

void ApplyGaussianFilterVertical5_float ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 1.2 and kernel size 5.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1207 of file Shadow.fx.

void ApplyGaussianFilterVertical5_float2 ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float2  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 1.2 and kernel size 5.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1118 of file Shadow.fx.

void ApplyGaussianFilterVertical5_float4 ( out float4  OutFilteredValue,
SSamplerTexturePair2D  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 1.2 and kernel size 5.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1035 of file Shadow.fx.

void ApplyGaussianFilterVertical7_float ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 1.8 and kernel size 7.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1224 of file Shadow.fx.

void ApplyGaussianFilterVertical7_float2 ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float2  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 1.8 and kernel size 7.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1137 of file Shadow.fx.

void ApplyGaussianFilterVertical7_float4 ( out float4  OutFilteredValue,
SSamplerTexturePair2D  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 1.8 and kernel size 7.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1052 of file Shadow.fx.

void ApplyGaussianFilterVertical9_float ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 2.4 and kernel size 9.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1243 of file Shadow.fx.

void ApplyGaussianFilterVertical9_float2 ( out float4  OutFilteredValue,
SSamplerTexturePair2D_float2  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 2.4 and kernel size 9.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1158 of file Shadow.fx.

void ApplyGaussianFilterVertical9_float4 ( out float4  OutFilteredValue,
SSamplerTexturePair2D  SourceSampler,
float2  TexCoord,
float4  TextureSize 
)

Vertical Gaussian filter with standard deviation 2.4 and kernel size 9.

See Also
ApplyGaussianFilterHorizontal5_float4()

Definition at line 1071 of file Shadow.fx.

void ApplyPrefixSumHorizontal_float2 ( inout RWTexture2D< float2 >  OutFilteredTexture,
SSamplerTexturePair2D_float2  SourceSampler,
uint3  ThreadID 
)

Like ApplyPrefixSumHorizontal_float4() but operates on two channel textures.

Definition at line 1335 of file Shadow.fx.

void ApplyPrefixSumHorizontal_float4 ( inout RWTexture2D< float4 >  OutFilteredTexture,
SSamplerTexturePair2D  SourceSampler,
uint3  ThreadID 
)

Generates horizontal prefix sums of the given source texture and stores them in the given output texture.

Parameters
OutFilteredTextureThe texture which is to be overwritten by prefix sums.
SourceSamplerA texture and sampler providing access to the texture for which prefix sums are to be generated. It must have the same dimensions as the output texture.
ThreadIDThe y component of this vector indicates the row on which to operate.

Definition at line 1287 of file Shadow.fx.

void ApplyPrefixSumHorizontal_half4 ( inout RWTexture2D< half4 >  OutFilteredTexture,
SSamplerTexturePair2D  SourceSampler,
uint3  ThreadID 
)

Like ApplyPrefixSumHorizontal_float4() but operates on four channel textures with half precision entries.

Definition at line 1382 of file Shadow.fx.

void ApplyPrefixSumHorizontal_uint2 ( inout RWTexture2D< uint2 >  OutFilteredTexture,
SSamplerTexturePair2D_float2  SourceSampler,
uint3  ThreadID,
float2  FixedPrecision 
)

Like ApplyPrefixSumHorizontal_float4() but operates on two channel textures with 32-bit unsigned integers.

Definition at line 1358 of file Shadow.fx.

void ApplyPrefixSumHorizontal_uint4 ( inout RWTexture2D< uint4 >  OutFilteredTexture,
SSamplerTexturePair2D  SourceSampler,
uint3  ThreadID,
float2  FixedPrecision 
)

Like ApplyPrefixSumHorizontal_float4() but operates on four channel textures with 32-bit unsigned integers.

See Also
ComputeFixedPrecision()

Definition at line 1312 of file Shadow.fx.

void ApplyPrefixSumVertical_float2 ( inout RWTexture2D< float2 >  OutFilteredTexture,
SSamplerTexturePair2D_float2  SourceSampler,
uint3  ThreadID 
)

Like ApplyPrefixSumVertical_float4() but operates on two channel textures.

Definition at line 1346 of file Shadow.fx.

void ApplyPrefixSumVertical_float4 ( inout RWTexture2D< float4 >  OutFilteredTexture,
SSamplerTexturePair2D  SourceSampler,
uint3  ThreadID 
)

Like ApplyPrefixSumHorizontal but generates vertical prefix sums for the column indicated by ThreadID.x.

Definition at line 1299 of file Shadow.fx.

void ApplyPrefixSumVertical_half4 ( inout RWTexture2D< half4 >  OutFilteredTexture,
SSamplerTexturePair2D  SourceSampler,
uint3  ThreadID 
)

Like ApplyPrefixSumVertical_float4() but operates on four channel textures with half precision entries.

Definition at line 1394 of file Shadow.fx.

void ApplyPrefixSumVertical_uint2 ( inout RWTexture2D< uint2 >  OutFilteredTexture,
SSamplerTexturePair2D_uint2  SourceSampler,
uint3  ThreadID 
)

Like ApplyPrefixSumVertical_float4() but operates on two channel textures with 32-bit unsigned integers.

Definition at line 1370 of file Shadow.fx.

void ApplyPrefixSumVertical_uint4 ( inout RWTexture2D< uint4 >  OutFilteredTexture,
SSamplerTexturePair2D_uint4  SourceSampler,
uint3  ThreadID 
)

Like ApplyPrefixSumVertical_float4() but operates on four channel textures with 32-bit unsigned integers.

Definition at line 1324 of file Shadow.fx.

void CombineVectorWithAlpha_float1 ( out float4  OutVectorWithAlpha,
float  Vector,
float  Alpha 
)

Returns a vector where r contains Vector, gb contains zero and a contains Alpha.

Definition at line 26 of file Shadow.fx.

void CombineVectorWithAlpha_float2 ( out float4  OutVectorWithAlpha,
float2  Vector,
float  Alpha 
)

Returns a vector where rg contains Vector, b contains zero and a contains Alpha.

Definition at line 31 of file Shadow.fx.

void CombineVectorWithAlpha_float3 ( out float4  OutVectorWithAlpha,
float3  Vector,
float  Alpha 
)

Returns a vector where rgb contains Vector and a contains Alpha.

Definition at line 35 of file Shadow.fx.

void CombineVectorWithAlpha_float4 ( out float4  OutVectorWithAlpha,
float4  Vector 
)

Outputs Vector unmodified. There is no space for an alpha channel.

Definition at line 39 of file Shadow.fx.

void Compute2MomentAverageBlockerDepth ( out float  OutAverageBlockerDepth,
out float  OutBlockerSearchShadowIntensity,
float2  BlockerSearchBiased2Moments,
float  FragmentDepth,
float  DepthBias 
)

This function estimates the average depth of fragments in a filter region which are less than FragmentDepth-DepthBias and outputs it. This is done using two moments of the shadow map depth within this filter region.

Parameters
OutBlockerSearchShadowIntensitySee ComputePCSSAverageBlockerDepth().

Definition at line 1755 of file Shadow.fx.

void Compute2MomentShadowIntensity ( out float  OutShadowIntensity,
float2  Biased2Moments,
float  FragmentDepth,
float  DepthBias 
)

Given a sampled value from a two-moment shadow map (i.e. a variance shadow map) and a computed shadow map depth for a point at the same location this function outputs 1.0, if the fragment is in shadow 0.0f, if the fragment is lit and an intermediate value for partial shadow.

Definition at line 777 of file Shadow.fx.

void Compute2TMSMShadowIntensity ( out float  OutShadowIntensity,
float2  pFourierCoefficient[2],
float  FragmentDepth,
float  DepthBias,
float  MomentBias 
)

Given a sampled value from a trigonometric moment shadow map providing two complex Fourier coefficients and a computed shadow map depth for a point at the same location this function outputs 1.0, if the fragment is in shadow 0.0f, if the fragment is lit and an intermediate value for partial shadow. The returned value is an optimal lower bound.

Definition at line 929 of file Shadow.fx.

void Compute4MomentAverageBlockerDepth ( out float  OutAverageBlockerDepth,
out float  OutBlockerSearchShadowIntensity,
float4  BlockerSearchBiased4Moments,
float  FragmentDepth 
)

This function estimates the average depth of fragments in a filter region which are less than FragmentDepth-DepthBias and outputs it. This is done using four moments of the shadow map depth within this filter region.

Parameters
OutBlockerSearchShadowIntensitySee ComputePCSSAverageBlockerDepth().

Definition at line 1777 of file Shadow.fx.

void Compute4MomentShadowIntensity ( out float  OutShadowIntensity,
float4  Biased4Moments,
float  FragmentDepth,
float  DepthBias 
)

Given a sampled value from a four-moment shadow map and a computed shadow map depth for a point at the same location this function outputs 1.0, if the fragment is in shadow 0.0f, if the fragment is lit and an intermediate value for partial shadow. The returned value is an optimal lower bound.

Definition at line 791 of file Shadow.fx.

void Compute4MomentUnboundedShadowIntensity ( out float  OutShadowIntensity,
float4  Biased4Moments,
float  FragmentDepth,
float  DepthBias 
)

Given a sampled value from a four-moment shadow map and a computed shadow map depth for a point at the same location this function outputs 1.0, if the fragment is in shadow 0.0f, if the fragment is lit and an intermediate value for partial shadow. The returned value is an optimal lower bound except for the fact that it does not exploit the knowledge that the original distribution has support in [0,1].

Definition at line 874 of file Shadow.fx.

void ComputeConvolutionShadowIntensity16 ( out float  OutShadowIntensity,
float2  pFourierCoefficient[16],
float  FragmentDepth,
float  DepthBias 
)

Like ComputeConvolutionShadowIntensity8() but for 16 Fourier coefficients.

Definition at line 716 of file Shadow.fx.

void ComputeConvolutionShadowIntensity8 ( out float  OutShadowIntensity,
float2  pFourierCoefficient[8],
float  FragmentDepth,
float  DepthBias 
)

Given Fourier coefficients from a convolution shadow map and a computed shadow map depth for a point at the same location this function outputs 1.0f, if the fragment is in shadow 0.0f, if the fragment is lit and an intermediate value for partial shadow.

Definition at line 690 of file Shadow.fx.

void ComputeDirectionalLightCamera ( out float4x4  OutViewToWorldSpace,
out float4x4  OutViewToProjectionSpace,
float3  WorldSpaceBoundingBoxMin,
float3  WorldSpaceBoundingBoxMax,
float3  WorldSpaceLightDirection 
)

This function computes the transformations for a shadow map camera for a directional light such that the given axis-aligned world-space bounding box is contained in its frustum.

Note
This is a reference implementation only. The function should be implemented on the CPU-side of the application.

Definition at line 212 of file Shadow.fx.

void ComputeDirectionalLightSoftShadowParameters ( out float3x2  OutLightParameter,
float4x4  ViewToProjectionSpace,
float2  LightSourceAngle 
)

Computes LightParameter as expected by EstimatePenumbraSize() for a directional light.

Parameters
OutLightParameterThe light parameters as expected by EstimatePenumbraSize().
ViewToProjectionSpaceThe projection matrix used for the shadow map of the directional light.
LightSourceAngleThe angle spanned by the directional light across the hemisphere along the two directions corresponding to rows and columns in the shadow map.

Definition at line 1731 of file Shadow.fx.

void ComputeExponentialShadowIntensity ( out float  OutShadowIntensity,
float  ExponentialShadowMapSample,
float  FragmentDepth,
float  DepthBias,
float  Factor = 80.0f 
)

Given a sampled value from an exponential shadow map and a computed shadow map depth for a point at the same location this function outputs 1.0, if the fragment is in shadow 0.0f, if the fragment is lit and an intermediate value for partial shadow.

Definition at line 679 of file Shadow.fx.

void ComputeExponentialVarianceShadowIntensity ( out float  OutShadowIntensity,
float4  ExponentialVarianceVector,
float  FragmentDepth,
float  DepthBias,
float2  ExponentialVarianceFactors 
)

Given a sampled value from an exponential variance shadow map and a computed shadow map depth for a point at the same location this function outputs 1.0, if the fragment is in shadow 0.0f, if the fragment is lit and an intermediate value for partial shadow.

Definition at line 745 of file Shadow.fx.

void ComputeExponentialVarianceVector ( out float4  OutDepthExponentialVariance,
float  FragmentDepth,
float2  ExponentialVarianceFactors 
)

Given a scalar this function sends it through four scaled exponential functions and returns the resulting vector.

Definition at line 138 of file Shadow.fx.

void ComputeExponentialVarianceVectorSplit ( out float2  OutDepthExponentialVariance0,
out float2  OutDepthExponentialVariance1,
float  FragmentDepth,
float2  ExponentialVarianceFactors 
)

Given a scalar this function sends it through four scaled exponential functions and returns the resulting vector.

Definition at line 147 of file Shadow.fx.

void ComputeFixedPrecision ( out float2  OutFixedPrecision,
float3x2  KernelSizeParameter,
float2  ShadowMapSize 
)

This function computes factors that define how much precision is to be used for moments stored in integers. It chooses the precision such that adding up all the integer moments within a kernel of the specified maximal size will not overflow a 32-bit unsigned integer.

Parameters
OutFixedPrecisionx holds a factor by which values between zero and one have to be multiplied to convert them to the unsigned integer representation with fixed precision. y holds the reciprocal of x.
KernelSizeParameterSee EstimatePenumbraSize().
ShadowMapSizeThe size of the shadow map KernelSizeParameter refers to in x and y.
Note
This is a reference implementation only and you would typically implement it on the CPU-side of your application.

Definition at line 1652 of file Shadow.fx.

void ComputeFragmentDepth ( out float  OutFragmentDepth,
float4  ProjectionSpacePosition 
)

Given the projection space position of a fragment this function outputs a perspective depth value, which can be used to represent this fragment in a shadow map.

Definition at line 13 of file Shadow.fx.

void ComputeHardShadowIntensity ( out float  OutShadowIntensity,
float  SampledShadowMapDepth,
float  FragmentDepth,
float  DepthBias 
)

Given a sampled value from the shadow map and a computed shadow map depth for a point at the same location this function outputs 1.0, if the fragment is in shadow and 0.0f, if the fragment is lit.

Definition at line 587 of file Shadow.fx.

void ComputeIntegerPCSSShadowIntensity ( out float  OutShadowIntensity,
SSamplerTexturePair2D_float  ShadowMapSampler,
float2  FilterRegionLeftTop,
float2  FilterRegionRightBottom,
float  FragmentDepth,
float4  ShadowMapSize,
float  DepthBias 
)

This function evaluates percentage closer filtering for a rectangular kernel with the given dynamically computed corners (in texture coordinates). Texture coordinates are rounded to the texel grid such that texels contribute either entirely or not at all. In this sense there is no interpoltion. SampleCmp() is used to quarter the number of required samples.

Definition at line 1882 of file Shadow.fx.

void ComputeIntegerRectangleAverage_uint2 ( out float2  OutAverageValue,
float2  LeftTop,
float2  RightBottom,
SSamplerTexturePair2D_uint2  SummedAreaTableSampler,
float4  TextureSize,
float2  FixedPrecision 
)

Like ComputeIntegerRectangleAverage_uint4() but for two-channel textures.

Definition at line 1604 of file Shadow.fx.

void ComputeIntegerRectangleAverage_uint4 ( out float4  OutAverageValue,
float2  LeftTop,
float2  RightBottom,
SSamplerTexturePair2D_uint4  SummedAreaTableSampler,
float4  TextureSize,
float2  FixedPrecision 
)

Like ComputeRectangleAverage_uint4() but without interpolation. The result refers to a modified version of the given rectangle where corner points have been rounded to the pixel grid. This is substantially faster.

See Also
ComputeFixedPrecision()

Definition at line 1502 of file Shadow.fx.

void ComputeMomentVector2Moments_float2 ( out float2  Out2Moments_float2,
float  FragmentDepth 
)

Given a scalar this function outputs a vector whose first component is the given scalar remapped from [-1,1] to [0,1] and whose second component is the square of the given scalar.

Definition at line 158 of file Shadow.fx.

void ComputeMomentVector4Moments_float2_float2 ( out float2  Out4Moments0_float2,
out float2  Out4Moments1_float2,
float  FragmentDepth 
)

Given a scalar this function outputs two vectors consisting of the first, second, third and fourth power of this scalar. Splitting it up into two vectors (and two textures) is useful if the alpha channel is needed for alpha blending.

See Also
ComputeFixedPrecision()

Definition at line 185 of file Shadow.fx.

void ComputeMomentVector4Moments_float4 ( out float4  Out4Moments_float4,
float  FragmentDepth 
)

Given a scalar this function outputs a vector consisting of the first, second, third and fourth power of this scalar.

Definition at line 165 of file Shadow.fx.

void ComputeMomentVector4MomentsOptimized_float2_float2 ( out float2  Out4MomentsOptimized0_float2,
out float2  Out4MomentsOptimized1_float2,
float  FragmentDepth 
)

Given a scalar this function outputs a vector consisting of the first, second, third and fourth power of this scalar linearly transformed using an optimized basis for optimal quantization. The output is split up into two vectors as with ComputeMomentVector4Moments_float2_float2.

See Also
ComputeFixedPrecision()

Definition at line 196 of file Shadow.fx.

void ComputeMomentVector4MomentsOptimized_float4 ( out float4  Out4MomentsOptimized_float4,
float  FragmentDepth 
)

Given a scalar this function outputs a vector consisting of the first, second, third and fourth power of this scalar linearly transformed using an optimized basis for optimal quantization.

Definition at line 173 of file Shadow.fx.

void ComputeMomentVectorExponential ( out float  OutExponential,
float  FragmentDepth,
float  Factor = 80.0f 
)

Given a scalar this function outputs a vector whose first component is the exponential of the given depth times -Factor.

Definition at line 54 of file Shadow.fx.

void ComputeMomentVectorFourier16 ( out float4  OutFourier1_2,
out float4  OutFourier3_4,
out float4  OutFourier5_6,
out float4  OutFourier7_8,
out float4  OutFourier9_10,
out float4  OutFourier11_12,
out float4  OutFourier13_14,
out float4  OutFourier15_16,
float  FragmentDepth 
)

Given a scalar this function outputs four vectors, each consisting of two complex Fourier coefficients of the delta distribution realizing this scalar.

Definition at line 87 of file Shadow.fx.

void ComputeMomentVectorFourier8 ( out float4  OutFourier1_2,
out float4  OutFourier3_4,
out float4  OutFourier5_6,
out float4  OutFourier7_8,
float  FragmentDepth 
)

Given a scalar this function outputs four vectors, each consisting of two complex Fourier coefficients of the delta distribution realizing this scalar.

Definition at line 60 of file Shadow.fx.

void ComputePCFShadowIntensity15x15 ( out float  OutShadowIntensity,
SSamplerTexturePair2D_float  ShadowMapSampler,
float2  ShadowMapTexCoord,
float  FragmentDepth,
float4  ShadowMapSize,
float  DepthBias 
)

Performs bilinearly filtered PCF using standard deviation 4.3 and a kernel of size 15*15.

See Also
ComputePCFShadowIntensity()

Definition at line 639 of file Shadow.fx.

void ComputePCFShadowIntensity1x1 ( out float  OutShadowIntensity,
SSamplerTexturePair2D_float  ShadowMapSampler,
float2  ShadowMapTexCoord,
float  FragmentDepth,
float4  ShadowMapSize,
float  DepthBias 
)

Performs bilinearly filtered PCF using standard deviation 0.0 and a kernel of size 1*1.

See Also
ComputePCFShadowIntensity()

Definition at line 595 of file Shadow.fx.

void ComputePCFShadowIntensity5x5 ( out float  OutShadowIntensity,
SSamplerTexturePair2D_float  ShadowMapSampler,
float2  ShadowMapTexCoord,
float  FragmentDepth,
float4  ShadowMapSize,
float  DepthBias 
)

Performs bilinearly filtered PCF using standard deviation 1.2 and a kernel of size 5*5.

See Also
ComputePCFShadowIntensity()

Definition at line 606 of file Shadow.fx.

void ComputePCFShadowIntensity7x7 ( out float  OutShadowIntensity,
SSamplerTexturePair2D_float  ShadowMapSampler,
float2  ShadowMapTexCoord,
float  FragmentDepth,
float4  ShadowMapSize,
float  DepthBias 
)

Performs bilinearly filtered PCF using standard deviation 1.8 and a kernel of size 7*7.

See Also
ComputePCFShadowIntensity()

Definition at line 617 of file Shadow.fx.

void ComputePCFShadowIntensity9x9 ( out float  OutShadowIntensity,
SSamplerTexturePair2D_float  ShadowMapSampler,
float2  ShadowMapTexCoord,
float  FragmentDepth,
float4  ShadowMapSize,
float  DepthBias 
)

Performs bilinearly filtered PCF using standard deviation 2.4 and a kernel of size 9*9.

See Also
ComputePCFShadowIntensity()

Definition at line 628 of file Shadow.fx.

void ComputePCFShadowIntensityPoisson ( out float  OutShadowIntensity,
SSamplerTexturePair2D_float  ShadowMapSampler,
float2  ShadowMapTexCoord,
float  FragmentDepth,
float4  ShadowMapSize,
float  DepthBias,
float  KernelDiameter 
)

Performs bilinearly filtered PCF using a hard-coded, randomly rotated Poisson disk sampling.

See Also
ComputePCFShadowIntensity()

Definition at line 651 of file Shadow.fx.

void ComputePCSSAverageBlockerDepth ( out float  OutAverageBlockerDepth,
out float  OutBlockerSearchShadowIntensity,
SSamplerTexturePair2D_float  ShadowMapSampler,
float2  ShadowMapTexCoord,
float  FragmentDepth,
float4  ShadowMapSize,
float  DepthBias,
float3x2  KernelSizeParameter 
)

This function computes the average depth of fragments in a filter region which are less than FragmentDepth-DepthBias and outputs it. Samples are taken from the given shadow map in filter kernel whose size corresponds to the maximal admitted size according to the shadow map parameters. The kernel is centered at ShadowMapTexCoord. If all samples are less than FragmentDepth-DepthBias, it outputs FragmentDepth to avoid that time is wasted on filtering a large kernel.

Parameters
OutBlockerSearchShadowIntensityIf the information obtained during the blocker search admits a definite statement on the appropriate shadow intensity, this value is set accordingly. Otherwise it is set to -1.0f.

Definition at line 1829 of file Shadow.fx.

void ComputePCSSShadowIntensity ( out float  OutShadowIntensity,
float  BlockerSearchShadowIntensity,
SSamplerTexturePair2D_float  ShadowMapSampler,
float2  FilterRegionLeftTop,
float2  FilterRegionRightBottom,
float  FragmentDepth,
float4  ShadowMapSize,
float  DepthBias 
)

This function evaluates percentage closer filtering for a rectangular kernel with the given dynamically computed corners (in texture coordinates). Texels are weighted according to the area covered by the specified rectangle. This results in bilinear interpolation. SampleCmp() is used to quarter the number of required samples.

Definition at line 1932 of file Shadow.fx.

void ComputeRectangleAverage_float2 ( out float2  OutAverageValue,
float2  LeftTop,
float2  RightBottom,
SSamplerTexturePair2D_float2  SummedAreaTableSampler,
float4  TextureSize 
)

Like ComputeRectangleAverage_uint4 but for summed area tables providing samples as float2.

Definition at line 1621 of file Shadow.fx.

void ComputeRectangleAverage_float4 ( out float4  OutAverageValue,
float2  LeftTop,
float2  RightBottom,
SSamplerTexturePair2D  SummedAreaTableSampler,
float4  TextureSize 
)

Like ComputeRectangleAverage_uint4 but for summed area-tables providing samples as float4.

Definition at line 1519 of file Shadow.fx.

void ComputeRectangleAverage_uint2 ( out float2  OutAverageValue,
float2  LeftTop,
float2  RightBottom,
SSamplerTexturePair2D_uint2  SummedAreaTableSampler,
float4  TextureSize,
float2  FixedPrecision 
)

Like ComputeRectangleAverage_uint4 but for two-channel textures.

See Also
ComputeFixedPrecision()

Definition at line 1540 of file Shadow.fx.

void ComputeRectangleAverage_uint4 ( out float4  OutAverageValue,
float2  LeftTop,
float2  RightBottom,
SSamplerTexturePair2D_uint4  SummedAreaTableSampler,
float4  TextureSize,
float2  FixedPrecision 
)

This function computes the average value (component-wise) of a texture with values from zero to one within a rectangle.

Parameters
OutAverageValueThe average value as values in the range from zero to one.
LeftTop,RightBottomThe minimal and maximal texture coordinates which are still contained in the rectangle. Restrictions to the size of this rectangle may apply.
SummedAreaTableSamplerA texture and sampler for a summed area table which provides prefix sums of the texture of interest.
TextureSizeThe width and height of the texture in x and y, reciprocals in z,w.
See Also
ComputeFixedPrecision()

Definition at line 1435 of file Shadow.fx.

void ComputeSampleAverage_float ( out float  OutSampleAverage,
float  SampleSum,
uint  nSample 
)

The following functions divide a vector of moments by an integer. They are used to compute the average of moment vectors moment vectors for different samples of a multisampled depth stencil texture once the sum has been computed.

Parameters
OutSampleAverageThe result of the component-wise division.
SampleSumThe dividend.
nSampleThe divisor.

Definition at line 996 of file Shadow.fx.

void ComputeShadowMapCoordinate ( out float2  OutShadowMapTexCoord,
out float  OutShadowMapDepth,
float4  ShadowMapProjectionSpacePosition,
float4  ShadowMapSize 
)

Given the coordinate of a point in the projection space of the shadow map camera of a light source this function outputs the texture coordinate, which has to be used to look up a shadow map sample for this point and the depth this point would have in the shadow map.

Note
It is non-linear and thus has to be evaluated per pixel.

Definition at line 299 of file Shadow.fx.

void ComputeShadowMapDepth ( out float  OutShadowMapDepth,
float  FragmentDepth 
)

Maps the given fragment depth from the interval [-1,1] to [0,1] such that it can be stored in an unsigned shadow map. This is to ensure consistency with shadow maps created as depth buffers.

Definition at line 20 of file Shadow.fx.

void ComputeSpotLightCamera ( out float4x4  OutViewToWorldSpace,
out float4x4  OutViewToProjectionSpace,
float3  WorldSpaceLightPosition,
float3  WorldSpaceConeAxisDirection,
float  OuterConeAngle,
float  NearClippingPlane,
float  FarClippingPlane 
)

Given various parameters of a spot light this function outputs a view to world space and view to projection space transformation, which can be used for a camera to render a shadow map for this spot light.

Note
This is a reference implementation only. The function should be implemented on the CPU-side of the application.

Definition at line 273 of file Shadow.fx.

void ComputeTrigonometricMomentVector ( out float4  OutFourier1_2,
float  FragmentDepth 
)

Given a scalar this function outputs a vector, consisting of the first two complex Fourier coefficients of the delta distribution realizing this scalar.

Definition at line 122 of file Shadow.fx.

void ComputeWorldSpacePositionUnderCursor ( out float3  OutWorldSpacePosition,
Texture2DMS< float, 1 >  SceneDepthTexture,
float4  SceneDepthTextureSize,
int2  iCursorPosition,
float4x4  CameraProjectionToWorldSpace 
)

This function computes the world space position of the surface that is currently visible under the mouse cursor.

Parameters
OutWorldSpacePositionThe world space position of the fragment that last wrote to the depth buffer at the cursor position. Typically this is the foremost opaque surface.
SceneDepthTextureThe depth stencil texture used during main scene rendering.
SceneDepthTextureSizeThe size (xy) and reciprocal size (zw) of SceneDepthTexture in pixels.
iCursorPositionThe index of the pixel in the depth stencil texture pointed to by the mouse cursor.
CameraProjectionToWorldSpaceThe projection to world space transform of the camera used for main scene rendering.

Definition at line 321 of file Shadow.fx.

void Convert2MomentToCanonical ( out float2  OutBiased2Moments,
float2  Moments0,
float  MomentBias = 0.0f 
)

Maps the first given moment from [0,1] to [-1,1] and copies the second moment.

Definition at line 479 of file Shadow.fx.

void Convert4MomentOptimizedToCanonical ( out float4  OutBiased4Moments,
float4  OptimizedMoments0,
float  MomentBias = 6.0e-5f 
)

This function converts a vector of four moments from a representation that is optimized for quantization to the canonical representation.

Definition at line 556 of file Shadow.fx.

void Convert4MomentToCanonical ( out float4  OutBiased4Moments,
float4  Moments0,
float  MomentBias = 3.0e-7f 
)

Just applies biasing.

Definition at line 545 of file Shadow.fx.

void ConvertShadowIntensityToColor ( out float4  OutColor,
float  ShadowIntensity 
)

This function turns a shadow intensity into a color that can be displayed for debugging purposes.

Definition at line 46 of file Shadow.fx.

void ConvertSplit4MomentOptimizedToCanonical ( out float4  OutBiased4Moments,
float2  OptimizedMoments0,
float2  OptimizedMoments1,
float  MomentBias = 6.0e-5f 
)

Like Convert4MomentOptimizedToCanonical() but takes in a moment vector which is split into two.

Definition at line 563 of file Shadow.fx.

void ConvertSplit4MomentToCanonical ( out float4  OutBiased4Moments,
float2  Moments0,
float2  Moments1,
float  MomentBias = 3.0e-7f 
)

Combines the split moment vector into a single vector.

Definition at line 550 of file Shadow.fx.

void EstimatePenumbraSize ( out float2  OutKernelSize,
out float  OutDepthBias,
float  OccluderDepth,
float  FragmentDepth,
float3x2  LightParameter,
float3x2  KernelSizeParameter,
float  MaxDepthBias 
)

This function computes the adequate filter size for generating a contact hardening shadow. It also adapts the depth bias to the filter size.

Parameters
OutKernelSizeThe size of the kernel as texture coordinate offset from its center to the right bottom.
OutDepthBiasThe depth bias to be used when computing filtered shadows over the returned kernel. For a maximal kernel size it is MaxDepthBias and it is proportional to OutKernelSize but may be clamped below.
OccluderDepthThe (estimated) depth of the occluding geometry in shadow map coordintes.
FragmentDepthThe depth of the receiving fragment in shadow map coordinates.
LightParameterParameters defining the computation of the kernel size which depend solely on the light source and the shadow map projection. The first column relates to the horizontal kernel size, the second one to the vertical kernel size. Row 0 holds the factor to be multiplied onto the distance between occluder and receiver. Row 1 and 2 hold the gradient and intercept of the linear function in the denominator which depends on the occluder depth, respectively.
KernelSizeParameterThe first row provides the upper top texture coordinate offst from the center of the smallest possible filter kernel. The second row provides the same for the biggest possible kernel. The third row provides the reciprocal of the horizontal kernel offset (in texture coordinates) at which the depth bias becomes maximal and the minimal depth bias as multiple of MaxDepthBias.
MaxDepthBiasThe depth bias that is to be used for a kernel of maximal size.

Definition at line 1714 of file Shadow.fx.

void GetBlockerSearchRectangle ( out float2  OutSearchRegionLeftTop,
out float2  OutSearchRegionRightBottom,
float2  SearchRegionCenter,
float3x2  KernelSizeParameter,
float4  ShadowMapSize 
)

This function computes the left top and right bottom of the rectangle in which the blocker search is to take place.

Parameters
OutSearchRegionLeftTopThe left top of the search region as texture coordinate.
OutSearchRegionRightBottomThe right bottom of the search region as texture coordinate.
SearchRegionCenterThe center of the search region as texture coordinate.
KernelSizeParameterSee KernelSizeParameter in EstimatePenumbraSize().
ShadowMapSizeShadow map resolution in xy, reciprocal in zw.

Definition at line 1668 of file Shadow.fx.

void GetShadowFilterRectangle ( out float2  OutFilterRegionLeftTop,
out float2  OutFilterRegionRightBottom,
float2  FilterRegionCenter,
float2  KernelSize 
)

This function computes the left top and right bottom of the rectangle over which the shadow map should be filtered to get contact-hardening shadows.

Parameters
OutFilterRegionLeftTopThe left top of the filter region as texture coordinate.
OutFilterRegionRightBottomThe right bottom of the filter region as texture coordinate.
FilterRegionCenterThe center of the filter region as texture coordinate.
KernelSizeSee OutKernelSize in EstimatePenumbraSize().

Definition at line 1682 of file Shadow.fx.

void GetSummedAreaTableThreadGroupCount ( out uint3  nOutThreadGroupHorizontal,
out uint3  nOutThreadGroupVertical,
uint3  ThreadGroupSizeHorizontal,
uint3  ThreadGroupSizeVertical,
float4  TextureSize 
)

This function computes the number of thread groups to be dispatched for generation of a summed area table.

Parameters
nOutThreadGroupHorizontalThe number of thread groups along each dimension to be dispatched for the horizontal filter.
nOutThreadGroupVerticalThe number of thread groups along each dimension to be dispatched for the vertical filter.
ThreadGroupSizeHorizontalThe size of thread groups along each dimension for the horizontal filter. Only the second entry is supposed to be not one.
ThreadGroupSizeVerticalThe size of thread groups along each dimension for the vertical filter. Only the first entry is supposed to be not one.
TextureSizeThe width and height of the texture for which a summed area table is to be generated in x and y.

Definition at line 1416 of file Shadow.fx.

void HeavisideStepFunction ( out float  OutShadowIntensity,
float  BlockerDepth,
float  FragmentDepth 
)

The Heaviside step function. OutShadowIntensity is zero for BlockerDepth>= FragmentDepth and one otherwise.

Definition at line 335 of file Shadow.fx.

void LoadDepthSample1 ( out float  OutDepthSample,
Texture2DMS< float, 1 >  ShadowMap,
float2  TexCoord,
uint  SampleIndex,
float4  ShadowMapSize 
)

The following functions take a depth sample from a multisampled texture.

Parameters
OutDepthSampleThe loaded depth sample mapped to the range from -1 to 1.
ShadowMapThe multisampled shadow map.
TexCoordThe texture coordinate at which sampling should take place. No interpolation is performed.
SampleIndexThe index of the sample in the multisampled texture which is to be loaded.
ShadowMapSizeThe size of the texture in texels in x and y.

Definition at line 949 of file Shadow.fx.

void PickShadowIntensity ( out float  OutShadowIntensity,
float  FilteredShadowIntensity,
float  BlockerSearchShadowIntensity 
)

This function takes in a shadow intensity computed by the filtering step of an algorithm for contact-hardening shadows and another shadow intensity computed by the blocker search. The shadow intensity computed by the blocker search can be negative to imply that results are inconclusive. Only in this case the shadow intensity computed during filtering will be used. Otherwise the shadow intensity computed during the blocker search is output and the compiler can branch away the entire filtering step.

Warning
This method is heavily reliant on compiler optimizations so the produced assembly should be checked to see whether branches have been created as intended.

Definition at line 1867 of file Shadow.fx.

void Sample2MomentShadowMap ( out float2  OutBiased2Moments,
SSamplerTexturePair2D_float2  _2MomentShadowMapSampler,
float2  ShadowMapTexCoord,
float  MomentBias = 0.0f 
)

This function takes a sample from the two-moment shadow map in the given sampler using the given texture coordinate and outputs it.

Definition at line 467 of file Shadow.fx.

void Sample2TMSMShadowMap ( out float2  pOutFourierCoefficient[2],
SSamplerTexturePair2D  _2TMSMShadowMapSampler,
float2  ShadowMapTexCoord 
)

This function takes a sample from the given shadow map containing two complex Fourier coefficients using the given texture coordinate and outputs the complex Fourier coefficients to the given array.

Definition at line 452 of file Shadow.fx.

void Sample4MomentOptimizedShadowMap ( out float4  OutBiased4Moments,
SSamplerTexturePair2D  _4MomentOptimizedShadowMapSampler,
float2  ShadowMapTexCoord,
float  MomentBias = 6.0e-5f 
)

This function takes a sample from the four-moment optimized shadow map in the given sampler using the given texture coordinate converts to biased moments and outputs it.

Definition at line 501 of file Shadow.fx.

void Sample4MomentOptimizedSplitShadowMap ( out float4  OutBiased4Moments,
SSamplerTexturePair2D_float2  _4MomentOptimizedShadowMapSampler0,
SSamplerTexturePair2D_float2  _4MomentOptimizedShadowMapSampler1,
float2  ShadowMapTexCoord,
float  MomentBias = 6.0e-5f 
)

This function takes a sample from the four-moment optimized shadow map in the given sampler using the given texture coordinate converts to moments and outputs it.

Definition at line 529 of file Shadow.fx.

void Sample4MomentShadowMap ( out float4  OutBiased4Moments,
SSamplerTexturePair2D  _4MomentShadowMapSampler,
float2  ShadowMapTexCoord,
float  MomentBias = 3.0e-7f 
)

This function takes a sample from the four-moment shadow map in the given sampler using the given texture coordinate converts to biased moments and outputs them.

Definition at line 489 of file Shadow.fx.

void Sample4MomentSplitShadowMap ( out float4  OutBiased4Moments,
SSamplerTexturePair2D_float2  _4MomentShadowMapSampler0,
SSamplerTexturePair2D_float2  _4MomentShadowMapSampler1,
float2  ShadowMapTexCoord,
float  MomentBias = 3.0e-7f 
)

This function takes a sample from a four-moment shadow map split into two two- channel shadow maps using the given texture coordinate and outputs it.

Definition at line 515 of file Shadow.fx.

void SampleConvolutionShadowMap16 ( out float2  pOutFourierCoefficient[16],
SSamplerTexturePair2D  ConvolutionShadowMapSampler0,
SSamplerTexturePair2D  ConvolutionShadowMapSampler1,
SSamplerTexturePair2D  ConvolutionShadowMapSampler2,
SSamplerTexturePair2D  ConvolutionShadowMapSampler3,
SSamplerTexturePair2D  ConvolutionShadowMapSampler4,
SSamplerTexturePair2D  ConvolutionShadowMapSampler5,
SSamplerTexturePair2D  ConvolutionShadowMapSampler6,
SSamplerTexturePair2D  ConvolutionShadowMapSampler7,
float2  ShadowMapTexCoord 
)

Like SampleConvolutionShadowMap8 but for sixteen Fourier coefficients.

Definition at line 408 of file Shadow.fx.

void SampleConvolutionShadowMap8 ( out float2  pOutFourierCoefficient[8],
SSamplerTexturePair2D  ConvolutionShadowMapSampler0,
SSamplerTexturePair2D  ConvolutionShadowMapSampler1,
SSamplerTexturePair2D  ConvolutionShadowMapSampler2,
SSamplerTexturePair2D  ConvolutionShadowMapSampler3,
float2  ShadowMapTexCoord 
)

This function takes a sample from the given set of convolution shadow maps in the given samplers using the given texture coordinate and outputs the complex Fourier coefficients to the given array.

Definition at line 382 of file Shadow.fx.

void SampleExponentialShadowMap ( out float  OutExponentialShadowMap,
SSamplerTexturePair2D_float  ExponentialShadowMapSampler,
float2  ShadowMapTexCoord 
)

This function takes a sample from the exponential shadow map in the given sampler using the given texture coordinate and outputs it.

Definition at line 371 of file Shadow.fx.

void SampleExponentialVarianceShadowMap ( out float4  OutExponentialVarianceVector,
SSamplerTexturePair2D  ExponentialVarianceShadowMapSampler0,
float2  ShadowMapTexCoord 
)

This function takes a sample from the exponential variance shadow map in the given sampler using the given texture coordinate and outputs it.

Definition at line 348 of file Shadow.fx.

void SampleExponentialVarianceSplitShadowMap ( out float4  OutExponentialVarianceVector,
SSamplerTexturePair2D_float2  ExponentialVarianceShadowMapSampler0,
SSamplerTexturePair2D_float2  ExponentialVarianceShadowMapSampler1,
float2  ShadowMapTexCoord 
)

This function takes samples from the split exponential variance shadow map in the given two samplers using the given texture coordinate and outputs it the packed result.

Definition at line 359 of file Shadow.fx.

void SampleShadowMap ( out float  OutShadowMapDepth,
SSamplerTexturePair2D_float  ShadowMapSampler,
float2  ShadowMapTexCoord 
)

This function takes a sample from the shadow map in the given sampler using the given texture coordinate and outputs the result.

Definition at line 342 of file Shadow.fx.

void ScaleShadowIntensity ( out float  OutShadowIntensity,
float  ShadowIntensity,
float  ShadowIntensityFactor,
float2  ShadowMapTexCoord,
float  FragmentDepth 
)

This function scales the given shadow intensity by a factor greater than 1.0 and clamps the result back into the valid range. In addition it sets the shadow intensity to 0.0, if the given shadow map texture coordinate or depth are outside the valid range.

Definition at line 575 of file Shadow.fx.