This class applies atmospheric effects to a fragment.
Only useful if you're doing your own Shading Model, otherwise this is already all implied when you use ShadingModelStandard.
Fog::Apply( float3 WorldPosition, float2 ScreenPosition, float3 Color );
This will apply all types of atmospheric effects onto current pixel (float3 Color) if they are available on scene:
If you only need specific fog effects, see the functions below.
ApplyGradientFog( inout float3 Color, float3 WolrdPosition, float3 PositionToCamera );
For both gradient and cubemap fog, you need to calculate PositionToCamera. This can be done by simply subtracting world-space camera position from pixel world position:
float3 PositionToCamera = worldPos.xyz - g_vCameraPositionWs;
ApplyCubemapFog( float3 Color, float3 WolrdPosition, float3 PositionToCamera );
ApplyVolumetricFog( float3 Color, float3 WorldPosition, float2 ScreenPosition );