Skip to content

Commit f7b90f7

Browse files
committed
GITechDemo:
*gamma correction is no longer applied to input diffuse textures *the G-Buffer's albedo component now stores sRGB color information and gamma correction is done at lighting stage
1 parent 6cbc24f commit f7b90f7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

GITechDemo/Code/AppMain/GITechDemo/RenderScheme/GBufferPass.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ void GBufferPass::Update(const float fDeltaTime)
6565

6666
f44WorldViewMat = f44ViewMat * f44WorldMat;
6767
f44WorldViewProjMat = f44ProjMat * f44WorldViewMat;
68+
69+
// In order to have better low-intensity precision in the G-Buffer (which is in LDR format, obviously)
70+
// we need to delay the gamma correction of input textures right up until we need them to be linear,
71+
// which is at the lighting stage. To achieve this, we need to keep the G-buffer in sRGB format.
72+
// The rest of the rendering pipeline supports HDR, so we keep color information in linear format
73+
// up until the tone mapping pass, where we output a LDR sRGB texture.
74+
// Kudos to VladC of FUN labs for pointing this out!
75+
ResourceMgr->GetTexture(GBuffer.GetRenderTarget()->GetColorBuffer(0))->SetSRGBEnabled(true);
6876
}
6977

7078
void GBufferPass::Draw()

GITechDemo/Code/AppMain/GITechDemo/Resources/RenderResource.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,9 @@ namespace GITechDemoApp
702702
{
703703
tex->SetAnisotropy(/*MAX_ANISOTROPY*/ 1u);
704704
tex->SetFilter(SF_MIN_MAG_LINEAR_MIP_LINEAR);
705-
tex->SetSRGBEnabled(true);
705+
706+
// Check note in GBufferPass.cpp about sRGB G-Buffer
707+
//tex->SetSRGBEnabled(true);
706708
}
707709

708710
// Specular power texture

0 commit comments

Comments
 (0)