utkuatlastuzcu/tst / Engine /Shaders /TdToneMapExposurePixelShader.usf
utkuatlastuzcu's picture
download
raw
1.07 kB
#include "Common.usf"
sampler2D SceneDownsampledTexture;
sampler2D PreviousExposureTexture;
float4 ExposureSettings; //Packed (Manual,MaxDeltaUp,LowClamp,HighClamp)
float MaxDeltaDown;
void Main(
in float2 SceneTexCoord : TEXCOORD0,
out float4 OutColor : COLOR0
)
{
half3 tmp2 = tex2D(SceneDownsampledTexture,float2(0.5,0.5)).rgb;
if ((!(tmp2.r > 0)) && (!(tmp2.r < 0))) // Nice NaN check for the nice optimizing compiler!
tmp2 = float3(0.25,0.25,0.25);
half Luminosity = dot(tmp2,float3(0.3,0.59,0.11));
half TargetExposure = sqrt(0.25 / clamp(Luminosity,0.0000001,5000.0));
TargetExposure = clamp(TargetExposure,ExposureSettings.b,ExposureSettings.a);
half tmp = tex2D(PreviousExposureTexture,float2(0.5,0.5)).r*64;
half LastExposure = clamp(sqrt(tmp),ExposureSettings.b,ExposureSettings.a);
float a = abs(TargetExposure - LastExposure);
float sqr = (LastExposure + clamp((TargetExposure- LastExposure)*a,-MaxDeltaDown*a*a,ExposureSettings.g*a*a));
sqr = sqr*sqr;
OutColor = sqr*ExposureSettings.r/64;
}

Xet Storage Details

Size:
1.07 kB
·
Xet hash:
b31fa5347d73eeb5c0fe829351eb65e3178dde881732085b82f2788acdb6bd3e

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.