Lightprepass: Only store normals in rtt
Use a more economical rtt format.
This commit is contained in:
parent
0bbba17e5e
commit
d642bc1489
@ -4,7 +4,7 @@ uniform sampler2D normalMap;
|
|||||||
noperspective in vec3 tangent;
|
noperspective in vec3 tangent;
|
||||||
noperspective in vec3 bitangent;
|
noperspective in vec3 bitangent;
|
||||||
in vec2 uv;
|
in vec2 uv;
|
||||||
out vec4 FragColor;
|
out vec3 Normal;
|
||||||
|
|
||||||
void main()
|
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;
|
vec3 FragmentNormal = TS_normal.x * Frag_tangent + TS_normal.y * Frag_bitangent - TS_normal.z * Frag_normal;
|
||||||
FragmentNormal = normalize(FragmentNormal);
|
FragmentNormal = normalize(FragmentNormal);
|
||||||
|
|
||||||
FragColor = vec4(0.5 * FragmentNormal + 0.5, gl_FragCoord.z);
|
Normal = 0.5 * FragmentNormal + 0.5, gl_FragCoord.z;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#version 130
|
#version 130
|
||||||
noperspective in vec3 nor;
|
noperspective in vec3 nor;
|
||||||
out vec4 FragColor;
|
out vec3 Normal;
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
FragColor = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
|
Normal = 0.5 * normalize(nor) + 0.5, gl_FragCoord.z;
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,12 @@ uniform sampler2D tex;
|
|||||||
|
|
||||||
noperspective in vec3 nor;
|
noperspective in vec3 nor;
|
||||||
in vec2 uv;
|
in vec2 uv;
|
||||||
out vec4 NormalDepth;
|
out vec3 Normal;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 col = texture(tex, uv);
|
vec4 col = texture(tex, uv);
|
||||||
if (col.a < 0.5)
|
if (col.a < 0.5)
|
||||||
discard;
|
discard;
|
||||||
NormalDepth = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
|
Normal = 0.5 * normalize(nor) + 0.5, gl_FragCoord.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ namespace video
|
|||||||
//! The normalized non-float formats from the _rg extension
|
//! The normalized non-float formats from the _rg extension
|
||||||
ECF_R8,
|
ECF_R8,
|
||||||
ECF_R8G8,
|
ECF_R8G8,
|
||||||
|
ECF_R11G11B10F,
|
||||||
ECF_R16,
|
ECF_R16,
|
||||||
ECF_R16G16,
|
ECF_R16G16,
|
||||||
|
|
||||||
|
@ -238,6 +238,12 @@ GLint COpenGLTexture::getOpenGLFormatAndParametersFromColorFormat(ECOLOR_FORMAT
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ECF_R11G11B10F:
|
||||||
|
filtering = GL_NEAREST;
|
||||||
|
colorformat = GL_RGB;
|
||||||
|
type = GL_FLOAT;
|
||||||
|
internalformat = GL_R11F_G11F_B10F;
|
||||||
|
break;
|
||||||
case ECF_G32R32F:
|
case ECF_G32R32F:
|
||||||
{
|
{
|
||||||
#ifdef GL_ARB_texture_rg
|
#ifdef GL_ARB_texture_rg
|
||||||
|
@ -67,7 +67,7 @@ RTT::RTT()
|
|||||||
rtts[RTT_TMP2] = drv->addRenderTargetTexture(res, "rtt.tmp2", ECF_A8R8G8B8, stencil);
|
rtts[RTT_TMP2] = drv->addRenderTargetTexture(res, "rtt.tmp2", ECF_A8R8G8B8, stencil);
|
||||||
rtts[RTT_TMP3] = drv->addRenderTargetTexture(res, "rtt.tmp3", 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_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_COLOR] = drv->addRenderTargetTexture(res, "rtt.color", ECF_A16B16G16R16F, stencil);
|
||||||
rtts[RTT_SPECULARMAP] = drv->addRenderTargetTexture(res, "rtt.specularmap", ECF_R8, stencil);
|
rtts[RTT_SPECULARMAP] = drv->addRenderTargetTexture(res, "rtt.specularmap", ECF_R8, stencil);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user