1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-22 14:15:37 +01:00
GiantsTools/Shaders/fxh/Fog.fxh

17 lines
372 B
HLSL
Raw Normal View History

2020-12-01 02:40:33 +01:00
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);
}