Fixed bug introduced with new rendering method for G-Buffer.

This commit is contained in:
Jonathas Costa
2017-06-16 14:04:21 -04:00
parent 589e85cf58
commit 2b99d1a2c2
3 changed files with 8 additions and 5 deletions
@@ -497,10 +497,13 @@ vec3 groundColor(const vec3 x, const float t, const vec3 v, const vec3 s, const
// E[L*] at x0
vec3 irradianceReflected = irradiance(irradianceTexture, r0, muSun) * irradianceFactor;
// R[L0] + R[L*]
vec3 groundRadiance = groundReflectance.rgb * (muSun * transmittanceL0 + irradianceReflected)
* sunRadiance / M_PI;
// Night illumination from cities
//groundRadiance *= mix(30.0, 1.0, dot(n,s));
// Specular reflection from sun on oceans and rivers
if (waterReflectance > 0.1) {
@@ -34,7 +34,7 @@ Fragment getFragment() {
#endif // SHOW_CHUNK_EDGES
// TODO: Change the color for the new deferred system (JCC)
frag.gOtherData = vec4(waterReflectance, 0.0, 0.0, 1.0);
frag.gOtherData = vec4(waterReflectance, waterReflectance, waterReflectance, 1.0);
// Normal is written in Camera Rig (OS Eye) Space
frag.gNormal = vec4(fs_normal, 1.0);
frag.gPosition = vec4(positionCameraSpace, 1.0); // in Camera Rig Space
+3 -3
View File
@@ -118,7 +118,7 @@ void FramebufferRenderer::initialize() {
glBindFramebuffer(GL_FRAMEBUFFER, _mainFramebuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, _mainColorTexture, 0);
// DEBUG: deferred g-buffer
// G-buffer
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D_MULTISAMPLE, _mainOtherDataTexture, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D_MULTISAMPLE, _mainPositionTexture, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D_MULTISAMPLE, _mainNormalTexture, 0);
@@ -311,7 +311,7 @@ void FramebufferRenderer::updateResolution() {
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
#endif
#ifdef _OLD_RENDERING_
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _mainOtherDataTexture);
glTexImage2DMultisample(
@@ -321,7 +321,7 @@ void FramebufferRenderer::updateResolution() {
GLsizei(_resolution.x),
GLsizei(_resolution.y),
true);
#endif
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, _mainPositionTexture);
glTexImage2DMultisample(