Table of Contents

Custom Fog Shader


The Custom fog appearance lets you write your own full-screen fog look in HLSL when none of the built-in appearances (Solid Color, Grayscale, Blur, Texture, Outline) fit your art direction.

Overview

You implement a single function, FOW_Shade_Custom, in your own .hlsl file and point the system at it. The package keeps your effect wired up across updates by redirecting its internal FowCustomInclude.hlsl to your file — so your code lives outside the package folder and survives reimports.

Setup

  1. Create an .hlsl file anywhere in your project that implements FOW_Shade_Custom (see below).
  2. Select the FOW_ShaderConfig asset in your project (auto-created at Assets/FogOfWar/FOW_ShaderConfig.asset).
  3. Assign your .hlsl file to the Custom Effect Hlsl field.
  4. On the Fog Of War World, set Fog Appearance to Custom.
Important

Do not edit FowCustomInclude.hlsl directly — it is auto-generated. Assign your file to the shader config instead, and the system redirects the include to it automatically (it re-syncs whenever the config or project assets change).

The FOW_Shade_Custom Function

float4 FOW_Shade_Custom(
    float4 SceneColor,    // the current screen pixel color
    float2 screenUV,      // screen-space UV
    float4 sceneTexel,    // raw scene texel
    float2 FowPosition,   // position on the fog plane
    float  FowHeight,     // height at this pixel
    float3 worldPos,      // reconstructed world position
    float3 worldNormal,   // world normal
    float  FowInfluence)  // 0 = fully fogged, 1 = fully visible
{
    // your custom look here — return the final pixel color
}

FowInfluence is the fog visibility for the pixel: blend between your fogged look and the unmodified SceneColor using it.

Example

This is the default template — a simple tinted fog that you can use as a starting point:

float4 FOW_Shade_Custom(float4 SceneColor, float2 screenUV, float4 sceneTexel,
                        float2 FowPosition, float FowHeight, float3 worldPos, float3 worldNormal,
                        float FowInfluence)
{
    float3 fogColor = lerp(_fowColor.rgb, SceneColor.rgb * _fowColor.rgb, _fowColor.a);
    return float4(lerp(fogColor, SceneColor.rgb, FowInfluence), SceneColor.a);
}

_fowColor is the Fog Color set on the Fog Of War World, available to your function.