diff --git a/data/shaders/normalmap.frag b/data/shaders/normalmap.frag index 97922296c..f5fd7d194 100644 --- a/data/shaders/normalmap.frag +++ b/data/shaders/normalmap.frag @@ -4,7 +4,7 @@ uniform sampler2D normalMap; noperspective in vec3 tangent; noperspective in vec3 bitangent; in vec2 uv; -out vec4 FragColor; +out vec3 Normal; void main() { @@ -18,5 +18,5 @@ void main() vec3 FragmentNormal = TS_normal.x * Frag_tangent + TS_normal.y * Frag_bitangent - TS_normal.z * Frag_normal; FragmentNormal = normalize(FragmentNormal); - FragColor = vec4(0.5 * FragmentNormal + 0.5, gl_FragCoord.z); + Normal = 0.5 * FragmentNormal + 0.5, gl_FragCoord.z; } diff --git a/data/shaders/object_pass1.frag b/data/shaders/object_pass1.frag index fb9dce400..33712bf5d 100644 --- a/data/shaders/object_pass1.frag +++ b/data/shaders/object_pass1.frag @@ -1,8 +1,8 @@ #version 130 noperspective in vec3 nor; -out vec4 FragColor; +out vec3 Normal; void main(void) { - FragColor = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z); + Normal = 0.5 * normalize(nor) + 0.5, gl_FragCoord.z; } diff --git a/data/shaders/objectref_pass1.frag b/data/shaders/objectref_pass1.frag index 5eb201f69..c3e0bfb58 100644 --- a/data/shaders/objectref_pass1.frag +++ b/data/shaders/objectref_pass1.frag @@ -3,12 +3,12 @@ uniform sampler2D tex; noperspective in vec3 nor; in vec2 uv; -out vec4 NormalDepth; +out vec3 Normal; void main() { vec4 col = texture(tex, uv); if (col.a < 0.5) discard; - NormalDepth = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z); + Normal = 0.5 * normalize(nor) + 0.5, gl_FragCoord.z; } diff --git a/lib/irrlicht/include/SColor.h b/lib/irrlicht/include/SColor.h index 8b6c2afa1..93654333c 100644 --- a/lib/irrlicht/include/SColor.h +++ b/lib/irrlicht/include/SColor.h @@ -34,6 +34,7 @@ namespace video //! The normalized non-float formats from the _rg extension ECF_R8, ECF_R8G8, + ECF_R11G11B10F, ECF_R16, ECF_R16G16, diff --git a/lib/irrlicht/source/Irrlicht/COpenGLTexture.cpp b/lib/irrlicht/source/Irrlicht/COpenGLTexture.cpp index 0bc4b612a..c0b3bd7a3 100644 --- a/lib/irrlicht/source/Irrlicht/COpenGLTexture.cpp +++ b/lib/irrlicht/source/Irrlicht/COpenGLTexture.cpp @@ -238,6 +238,12 @@ GLint COpenGLTexture::getOpenGLFormatAndParametersFromColorFormat(ECOLOR_FORMAT #endif } break; + case ECF_R11G11B10F: + filtering = GL_NEAREST; + colorformat = GL_RGB; + type = GL_FLOAT; + internalformat = GL_R11F_G11F_B10F; + break; case ECF_G32R32F: { #ifdef GL_ARB_texture_rg diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 35e0420fe..be514c91b 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -67,7 +67,7 @@ RTT::RTT() rtts[RTT_TMP2] = drv->addRenderTargetTexture(res, "rtt.tmp2", ECF_A8R8G8B8, stencil); rtts[RTT_TMP3] = drv->addRenderTargetTexture(res, "rtt.tmp3", ECF_A8R8G8B8, stencil); rtts[RTT_TMP4] = drv->addRenderTargetTexture(res, "rtt.tmp4", ECF_R8, stencil); - rtts[RTT_NORMAL_AND_DEPTH] = drv->addRenderTargetTexture(res, "rtt.normal_and_depth", ECF_A32B32G32R32F, stencil); + rtts[RTT_NORMAL_AND_DEPTH] = drv->addRenderTargetTexture(res, "rtt.normal_and_depth", ECF_R11G11B10F, stencil); rtts[RTT_COLOR] = drv->addRenderTargetTexture(res, "rtt.color", ECF_A16B16G16R16F, stencil); rtts[RTT_SPECULARMAP] = drv->addRenderTargetTexture(res, "rtt.specularmap", ECF_R8, stencil);