1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-16 19:55:36 +01:00
GiantsTools/Shaders/fxh/Fog.fxh
2020-11-30 17:40:33 -08:00

17 lines
372 B
HLSL

struct FogParams
{
float FogMin;
float FogMax;
float3 Color;
int Enabled;
};
float CalculateFogFactor(float fogMax, float fogMin, float d)
{
return saturate((fogMax - d) / (fogMax - fogMin));
}
float4 ApplyPixelFog(float4 pixelColor, float fogFactor, float3 fogColor)
{
return (fogFactor * pixelColor) + (1.0 - fogFactor) * float4(fogColor, 1);
}