Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***************************************************************************************/
- /*! DopeShader v2.0
- ****************************************************************************************/
- #include "Common.usf"
- #include "PostProcessCommon.usf"
- // Bloom parameterse.
- sampler2D BlurredImage;
- // Tone-mapping parameters.
- sampler2D AdaptedLuminance;
- static const float WHITE = pow(1, 2);
- // The per-color weighting to be used for luminance calculations in RGB order.
- static const float3 LuminanceVector = float3(0.3, 0.59, 0.11);
- // Perform tone mapping on a pixel.
- float3 ToneMap(float3 WorldColor)
- {
- float fAdaptedLuminance = tex2D(AdaptedLuminance,float2(0.5,0.5));
- float lum = saturate(0.1 + WorldColor) * (LuminanceVector / fAdaptedLuminance);
- lum = lum * (lum / WHITE) / lum;
- return pow(WorldColor * lum, 1.0);
- }
- void Main(
- in float2 UV : TEXCOORD0,
- in float2 SceneUV : TEXCOORD1,
- out float4 OutColor : COLOR0
- )
- {
- float4 sceneColor = tex2D(SceneColorTexture,SceneUV);
- float4 rawColor = tex2D(BlurredImage,UV);
- float3 filteredColor = MAX_SCENE_COLOR * rawColor.rgb;
- float3 RTWBloom = 1-(saturate(1-(filteredColor.rgb*0.02))*saturate(1-lerp(sceneColor.rgb, 0, saturate(rawColor.a*4)*0.02)));
- float3 ToneMappedColor = ToneMap(RTWBloom);
- OutColor = float4(ToneMappedColor.rgb, sceneColor.a);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement