summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/impostorF.glsl20
-rwxr-xr-xindra/newview/lldrawpoolalpha.cpp2
-rwxr-xr-xindra/newview/pipeline.cpp29
-rwxr-xr-xindra/newview/pipeline.h1
4 files changed, 47 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index d52744103f..d1eaabf901 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
@@ -38,6 +38,17 @@ uniform sampler2D specularMap;
VARYING vec2 vary_texcoord0;
+vec3 decode_normal (vec2 enc)
+{
+ vec2 fenc = enc*4-2;
+ float f = dot(fenc,fenc);
+ float g = sqrt(1-f/4);
+ vec3 n;
+ n.xy = fenc*g;
+ n.z = 1-f/2;
+ return n;
+}
+
vec2 encode_normal(vec3 n)
{
float f = sqrt(8 * n.z + 8);
@@ -72,7 +83,10 @@ void main()
discard;
}
- frag_data[0] = vec4(linear_to_srgb(col.rgb), col.a);
- frag_data[1] = vec4(texture2D(specularMap, vary_texcoord0.xy));
- frag_data[2] = vec4(texture2D(normalMap, vary_texcoord0.xy).xy,0,0);
+ vec4 norm = texture2D(normalMap, vary_texcoord0.xy);
+ vec4 spec = texture2D(specularMap, vary_texcoord0.xy);
+
+ frag_data[0] = vec4(col.rgb, col.a);
+ frag_data[1] = spec;
+ frag_data[2] = vec4(norm.xy,0,0);
}
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 60e22c08dc..8b2cbb1b9d 100755
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -228,7 +228,7 @@ void LLDrawPoolAlpha::render(S32 pass)
|| (deferred_render && pass == 1)
// we want depth written so that rendered alpha will
// contribute to the alpha mask used for impostors
- || LLPipeline::sImpostorRender;
+ || LLPipeline::sImpostorRenderAlphaDepthPass;
LLGLDepthTest depth(GL_TRUE, write_depth ? GL_TRUE : GL_FALSE);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 29b7e30655..9378c89eb7 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -379,6 +379,7 @@ BOOL LLPipeline::sWaterReflections = FALSE;
BOOL LLPipeline::sRenderGlow = FALSE;
BOOL LLPipeline::sReflectionRender = FALSE;
BOOL LLPipeline::sImpostorRender = FALSE;
+BOOL LLPipeline::sImpostorRenderAlphaDepthPass = FALSE;
BOOL LLPipeline::sUnderWaterRender = FALSE;
BOOL LLPipeline::sTextureBindTest = FALSE;
BOOL LLPipeline::sRenderFrameTest = FALSE;
@@ -11387,14 +11388,40 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
{
avatar->mImpostor.clear();
renderGeomDeferred(camera);
+
+ renderGeomPostDeferred(camera);
+
+ // Shameless hack time: render it all again,
+ // this time writing the depth
+ // values we need to generate the alpha mask below
+ // while preserving the alpha-sorted color rendering
+ // from the previous pass
+ //
+ sImpostorRenderAlphaDepthPass = true;
+ // depth-only here...
+ //
+ gGL.setColorMask(false,false);
renderGeomPostDeferred(camera);
+ sImpostorRenderAlphaDepthPass = false;
}
else
- {
+ {
LLGLEnable scissor(GL_SCISSOR_TEST);
glScissor(0, 0, resX, resY);
avatar->mImpostor.clear();
renderGeom(camera);
+
+ // Shameless hack time: render it all again,
+ // this time writing the depth
+ // values we need to generate the alpha mask below
+ // while preserving the alpha-sorted color rendering
+ // from the previous pass
+ //
+ sImpostorRenderAlphaDepthPass = true;
+ // depth-only here...
+ //
+ gGL.setColorMask(false,false);
+ renderGeom(camera);
}
{ //create alpha mask based on depth buffer (grey out if muted)
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 36b293b998..5e68524067 100755
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -588,6 +588,7 @@ public:
static BOOL sPickAvatar;
static BOOL sReflectionRender;
static BOOL sImpostorRender;
+ static BOOL sImpostorRenderAlphaDepthPass;
static BOOL sUnderWaterRender;
static BOOL sRenderGlow;
static BOOL sTextureBindTest;