Crest Compatibility

Crest Compatibility

Buto is compatible with Crest.

Include Buto

Include the URP and Buto helper functions in your Crest Ocean Shader.

  1. Open Crest Ocean Shader
  2. Find: #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl”
  3. Add: #include "Packages/com.occasoftware.buto/Shaders/Resources/Buto.hlsl” below it

Update Shader

Find: if (!underwater)

Replace with:

if (!underwater)
{
    float2 screenPosition = GetNormalizedScreenSpaceUV(input.positionCS).xy;
    float viewDistance = -TransformWorldToView(input.positionWS_fogFactor).z;
    col.rgb = ButoFogBlend(screenPosition, viewDistance, col.rgb);
}

If you want to keep Unity's default fog as well, make sure you keep the MixFog function: col.rgb = MixFog(col, input.positionWS_fogFactor.w)

if (!underwater)
{
    col.rgb = MixFog(col, input.positionWS_fogFactor.w);
 
    float2 screenPosition = GetNormalizedScreenSpaceUV(input.positionCS).xy;
    float viewDistance = -TransformWorldToView(input.positionWS_fogFactor).z;
    col.rgb = ButoFogBlend(screenPosition, viewDistance, col.rgb);
}