diff --git a/WickedEngine/globals.hlsli b/WickedEngine/globals.hlsli index 952cc17b0..b34912b7c 100644 --- a/WickedEngine/globals.hlsli +++ b/WickedEngine/globals.hlsli @@ -119,7 +119,7 @@ CBUFFER(APICB, CBSLOT_API) #define ALPHATEST(x) clip((x)-0.1); -static const float g_GammaValue = 2.2; +static const float g_GammaValue = 1.1; #define DEGAMMA(x) pow(abs(x),1.0/g_GammaValue) #define GAMMA(x) pow(abs(x),g_GammaValue) diff --git a/WickedEngine/luminancePass1CS.hlsl b/WickedEngine/luminancePass1CS.hlsl index 9ccc1a83f..72a03c8bb 100644 --- a/WickedEngine/luminancePass1CS.hlsl +++ b/WickedEngine/luminancePass1CS.hlsl @@ -44,7 +44,7 @@ void main( // reduction //Load pixel into local memory buffer. - float3 color = texture_gbuffer0.Load(uint3(dispatchThreadId.xy, 0)).rgb; + float3 color = texture_0.Load(uint3(dispatchThreadId.xy, 0)).rgb; accumulator[groupIndex] = dot(color.rgb, float3(0.2126, 0.7152, 0.0722)); //Wait for all diff --git a/WickedEngine/objectHF.hlsli b/WickedEngine/objectHF.hlsli index ddc82595f..01b905291 100644 --- a/WickedEngine/objectHF.hlsli +++ b/WickedEngine/objectHF.hlsli @@ -71,7 +71,7 @@ inline void NormalMapping(in float2 UV, in float3 V, inout float3 N, inout float inline void SpecularMapping(in float2 UV, inout float4 specularColor) { - specularColor = lerp(specularColor, xSpecularMap.Sample(sampler_aniso_wrap, UV).r, g_xMat_hasSpe); + specularColor = lerp(specularColor, specularColor * xSpecularMap.Sample(sampler_aniso_wrap, UV).r, g_xMat_hasSpe); } inline void PlanarReflection(in float2 UV, in float2 reflectionUV, in float3 N, inout float4 baseColor) diff --git a/WickedEngine/toneMapPS.hlsl b/WickedEngine/toneMapPS.hlsl index a857146b0..6cc79d571 100644 --- a/WickedEngine/toneMapPS.hlsl +++ b/WickedEngine/toneMapPS.hlsl @@ -1,20 +1,23 @@ #include "postProcessHF.hlsli" -static const float WHITE = pow(1, 2); -static const float ALPHA = 0.72; float4 main(VertexToPixelPostProcess PSIn) : SV_TARGET { float4 hdr = xTexture.Load(uint3(PSIn.pos.xy,0)); float average_luminance = xMaskTex.Load(uint3(0,0,0)).r; + //if (PSIn.pos.x < 100 && PSIn.pos.y < 100) + // return float4(average_luminance.xxx,1); + float luminance = dot(hdr.rgb, float3(0.2126, 0.7152, 0.0722)); - luminance = (luminance * (1 + luminance / WHITE)) / (1 + luminance); // Reinhard - luminance *= ALPHA / average_luminance; + luminance = (luminance * (1 + luminance)) / (1 + luminance); // Reinhard + luminance *= 1 / average_luminance; // adaption //luminance = 1; + //hdr = GAMMA(hdr); + float4 ldr = float4(saturate(hdr.rgb * luminance), hdr.a); ldr = GAMMA(ldr);