gamma refactor part2
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user