diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index cfe40d8fd..4887eb084 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1252,19 +1252,37 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, LLColor4U color = (tep ? LLColor4U(tep->getColor()) : LLColor4U::white); if (rebuild_color) // FALSE if tep == NULL - { - if (tep) + { //decide if shiny goes in alpha channel of color + if (tep && + getPoolType() != LLDrawPool::POOL_ALPHA) // <--- alpha channel MUST contain transparency, not shiny { - GLfloat alpha[4] = + bool shiny_in_alpha = false; + + if (LLPipeline::sRenderDeferred) + { //store shiny in alpha if we don't have a specular map + //if (!mat || mat->getSpecularID().isNull()) + { + shiny_in_alpha = true; + } + } + else { + if(LLPipeline::sRenderBump && tep->getShiny()) + { + shiny_in_alpha = true; + } + } + if(shiny_in_alpha) + { + GLfloat alpha[4] = + { 0.00f, 0.25f, 0.5f, 0.75f - }; + }; - if (getPoolType() != LLDrawPool::POOL_ALPHA && (LLPipeline::sRenderDeferred || (LLPipeline::sRenderBump && tep->getShiny()))) - { + llassert(tep->getShiny() <= 3); color.mV[3] = U8 (alpha[tep->getShiny()] * 255); } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f99f40007..c2828a027 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1415,12 +1415,32 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima return 0; } - bool alpha = te->getColor().mV[3] < 0.999f; + LLMaterial* mat = te->getMaterialParams().get(); + + bool color_alpha = te->getColor().mV[3] < 0.999f; + bool alpha = color_alpha; if (imagep) { alpha = alpha || (imagep->getComponents() == 4 && imagep->getType() != LLViewerTexture::MEDIA_TEXTURE) || (imagep->getComponents() == 2); } - + + if (alpha && mat) + { + switch (mat->getDiffuseAlphaMode()) + { + case 1: + alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool. + break; + case 0: //alpha mode set to none, never go to alpha pool + case 3: //alpha mode set to emissive, never go to alpha pool + alpha = color_alpha; + break; + default: //alpha mode set to "mask", go to alpha pool if fullbright + alpha = color_alpha; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool. + break; + } + } + if (alpha) { return LLDrawPool::POOL_ALPHA;