Fix for NORSPEC 271 - Transparent prims in Materials Viewer are incorrectly affecting depth of field by modifying the depth buffer

master
Arun Bapu 2013-08-14 11:35:06 -07:00
parent 61129c73c9
commit 55c36ab7db
2 changed files with 23 additions and 6 deletions

View File

@ -100,7 +100,7 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
}
else
{
simple_shader = &gDeferredAlphaProgram;
simple_shader = &gDeferredAlphaProgram;
fullbright_shader = &gDeferredFullbrightProgram;
}
@ -276,11 +276,11 @@ void LLDrawPoolAlpha::render(S32 pass)
if (mVertexShaderLevel > 0)
{
renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2);
renderAlpha(getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2, pass);
}
else
{
renderAlpha(getVertexDataMask());
renderAlpha(getVertexDataMask(), pass);
}
gGL.setColorMask(true, false);
@ -352,7 +352,7 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)
}
}
void LLDrawPoolAlpha::renderAlpha(U32 mask)
void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
{
BOOL initialized_lighting = FALSE;
BOOL light_enabled = TRUE;
@ -385,6 +385,23 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
continue;
}
// Fix for bug - NORSPEC-271
// If the face is more than 90% transparent, then don't update the Depth buffer for Dof
// We don't want the nearly invisible objects to cause of DoF effects
if(pass == 1)
{
LLFace* face = params.mFace;
if(face)
{
const LLTextureEntry* tep = face->getTextureEntry();
if(tep)
{
if(tep->getColor().mV[3] < 0.1f)
continue;
}
}
}
LLRenderPass::applyModelMatrix(params);
LLMaterial* mat = NULL;
@ -548,7 +565,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
// If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha.
if (current_shader &&
if (current_shader &&
!LLPipeline::sImpostorRender &&
draw_glow_for_this_partition &&
params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))

View File

@ -63,7 +63,7 @@ public:
/*virtual*/ void prerender();
void renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE);
void renderAlpha(U32 mask);
void renderAlpha(U32 mask, S32 pass);
void renderAlphaHighlight(U32 mask);
static BOOL sShowDebugAlpha;