Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main()
- {
- float4 color = Sample();
- float Gamma = 1.2;
- float IntensityContrast = 1.3;
- float Saturation = 1.7;
- float ToneMappingCurve = 2.0;
- float ToneMappingOversaturation = 40.0;
- float Brightness = 0.16;
- float BrightnessCurve = 1.28;
- float BrightnessMultiplier = 0.85;
- float BrightnessToneMappingCurve = 0.42;
- float HPDTonemappingExposure = 2.2;
- float HPDTonemappingClipping = 0.0004;
- float HPDTonemappingUpperTone = 6.2;
- float HPDTonemappingGreyTone = 0.5;
- float HPDTonemappingMiddleTone = 1.7;
- float HPDTonemappingLowerTone = 0.064;
- color.r = pow(color.r, Gamma);
- color.g = pow(color.g, Gamma);
- color.b = pow(color.b, Gamma);
- color.rgb *= Brightness;
- color.rgb += 0.000001;
- float3 xncol = normalize(color.rgb);
- float3 scl = color.rgb/xncol.rgb;
- scl.r = pow(scl.r, IntensityContrast);
- scl.g = pow(scl.g, IntensityContrast);
- scl.b = pow(scl.b, IntensityContrast);
- xncol.r = pow(xncol.r, Saturation);
- xncol.g = pow(xncol.g, Saturation);
- xncol.b = pow(xncol.b, Saturation);
- color.r = scl*xncol.r;
- color.g = scl*xncol.g;
- color.b = scl*xncol.b;
- float lumamax = ToneMappingOversaturation;
- color.rgb = (color.rgb * (1.0 + color.rgb/lumamax))/(color.rgb + ToneMappingCurve);
- float Y = dot(color.rgb, float3(0.299, 0.587, 0.114)); //0.299 * R + 0.587 * G + 0.114 * B;
- float U = dot(color.rgb, float3(-0.14713, -0.28886, 0.436)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
- float V = dot(color.rgb, float3(0.615, -0.51499, -0.10001)); //0.615 * R - 0.51499 * G - 0.10001 * B;
- Y = pow(Y, BrightnessCurve);
- Y = Y*BrightnessMultiplier;
- Y = Y/(Y+BrightnessToneMappingCurve);
- float desaturatefact = clamp(Y*Y*Y*1.7, 0.0, 1.0);
- U = mix(U, 0.0, desaturatefact);
- V = mix(V, 0.0, desaturatefact);
- color.rgb = V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
- float3 xColor = color.xyz;
- xColor = max(xColor, HPDTonemappingClipping);
- xColor = abs((xColor * (HPDTonemappingUpperTone * xColor + HPDTonemappingGreyTone )) / (xColor * (HPDTonemappingUpperTone * xColor + HPDTonemappingMiddleTone) + HPDTonemappingLowerTone ));
- color.r = pow(xColor.r, HPDTonemappingExposure);
- color.g = pow(xColor.g, HPDTonemappingExposure);
- color.b = pow(xColor.b, HPDTonemappingExposure);
- SetOutput(color);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement