skip to Main Content

Integration with other shaders

The asset allows you to integrate the shadow sampling function into your own shaders.

1) Add the required include files (you may need to add the path to these hlsl files).

#include "path..\CloudShadowsInput.hlsl"
#include "path..\CloudShadowsCommon.hlsl"

2) Now you can use the GetShadowAttenuation() function to obtain the shadow term at a given world position. You will need to provide world position (wpos parameter), the linear depth in the 0-1 range (depth01 parameter) and optionally you can pass the normal in world space (normalWS parameter, or pass any vector like float3(0,1,0)). The normal is used to avoid cloud shadows being rendered on ceilings for example.

half4 GetShadowAttenuation (float3 wpos, float depth01, float3 normalWS);

3) In any of your scripts, you have to pass the required shader variables to allow this function work to your shader. You can do so by calling UpdateMaterialProperties(your material) function of CloudShadows script.

Back To Top