diff options
5 files changed, 33 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index ca11f58888..a8a5cc22db 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -217,7 +217,16 @@ void main() vec2 pos_screen = vary_texcoord0.xy; vec4 diffuse_srgb = texture2D(diffuseMap, vary_texcoord0.xy); - diffuse_srgb *= vertex_color; + diffuse_srgb.rgb *= vertex_color.rgb; + + // For some reason the Transparency slider sets vertex_color.a to 0.0 both for + // fully opaque and for fully transparent objects. This code assumes the 0 alpha + // is always from the opaque end of the scale. TODO: Remove the conditional once + // the root cause of the slider ambiguity is fixed. + if (vertex_color.a > 0.0) + { + diffuse_srgb.a *= vertex_color.a; + } vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 547a159f3a..20ac78947b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -154,8 +154,6 @@ vec3 post_diffuse = color.rgb; } vec3 post_spec = color.rgb; - - color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); if (envIntensity > 0.0) { //add environmentmap @@ -165,7 +163,11 @@ vec3 post_diffuse = color.rgb; color = mix(color.rgb, reflected_color, envIntensity*0.75); // MAGIC NUMBER SL-12574; ALM: On, Quality <= Mid+ #endif } - + else + { + color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); + } + vec3 post_env = color.rgb; if (norm.w < 1) diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 15a3bc349a..9c7a4df767 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -161,8 +161,6 @@ vec3 post_diffuse = color.rgb; } vec3 post_spec = color.rgb; - - color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); if (envIntensity > 0.0) { //add environmentmap @@ -172,7 +170,11 @@ vec3 post_diffuse = color.rgb; color = mix(color.rgb, reflected_color, envIntensity*0.75); // MAGIC NUMBER SL-12574; ALM: On, Quality >= High #endif } - + else + { + color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a); + } + vec3 post_env = color.rgb; if (norm.w < 1) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index f32f34c354..8a894c4ec8 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -108,6 +108,10 @@ const double RETAIN_COEFFICIENT = 100; // So this const is used as a size of Smooth combobox list. const S32 SMOOTH_VALUES_NUMBER = 10; +// mCameraDistance +// Also see: mCameraZoom +const F32 MODEL_PREVIEW_CAMERA_DISTANCE = 16.f; + void drawBoxOutline(const LLVector3& pos, const LLVector3& size); @@ -431,7 +435,7 @@ void LLFloaterModelPreview::initModelPreview() } mModelPreview = new LLModelPreview(512, 512, this ); - mModelPreview->setPreviewTarget(16.f); + mModelPreview->setPreviewTarget(MODEL_PREVIEW_CAMERA_DISTANCE); mModelPreview->setDetailsCallback(boost::bind(&LLFloaterModelPreview::setDetails, this, _1, _2, _3, _4, _5)); mModelPreview->setModelUpdatedCallback(boost::bind(&LLFloaterModelPreview::modelUpdated, this, _1)); } @@ -3641,10 +3645,9 @@ BOOL LLModelPreview::render() S32 width = getWidth(); S32 height = getHeight(); - LLGLSUIDefault def; + LLGLSUIDefault def; // GL_BLEND, GL_ALPHA_TEST, GL_CULL_FACE, depth test LLGLDisable no_blend(GL_BLEND); - LLGLEnable cull(GL_CULL_FACE); - LLGLDepthTest depth(GL_TRUE); + LLGLDepthTest depth(GL_FALSE); // SL-12781 disable z-buffer to render background color LLGLDisable fog(GL_FOG); { @@ -3652,7 +3655,7 @@ BOOL LLModelPreview::render() { gUIProgram.bind(); } - //clear background to blue + //clear background to grey gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); gGL.loadIdentity(); @@ -3757,7 +3760,7 @@ BOOL LLModelPreview::render() F32 explode = mFMP->childGetValue("physics_explode").asReal(); - glClear(GL_DEPTH_BUFFER_BIT); + LLGLDepthTest gls_depth(GL_TRUE); // SL-12781 re-enable z-buffer for 3D model preview LLRect preview_rect; @@ -3780,7 +3783,6 @@ BOOL LLModelPreview::render() target_pos = getPreviewAvatar()->getPositionAgent(); z_near = 0.01f; z_far = 1024.f; - mCameraDistance = 16.f; //render avatar previews every frame refresh(); @@ -3920,9 +3922,9 @@ BOOL LLModelPreview::render() { glClear(GL_DEPTH_BUFFER_BIT); - for (U32 i = 0; i < 2; i++) + for (U32 pass = 0; pass < 2; pass++) { - if (i == 0) + if (pass == 0) { //depth only pass gGL.setColorMask(false, false); } @@ -3932,7 +3934,7 @@ BOOL LLModelPreview::render() } //enable alpha blending on second pass but not first pass - LLGLState blend(GL_BLEND, i); + LLGLState blend(GL_BLEND, pass); gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d6ff9bd548..fda79984ab 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1250,7 +1250,7 @@ void LLPipeline::createGLBuffers() } // Use FBO for bake tex - mBake.allocate(512, 512, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, true); + mBake.allocate(512, 512, GL_RGBA, TRUE, FALSE, LLTexUnit::TT_TEXTURE, true); // SL-12781 Build > Upload > Model; 3D Preview mHighlight.allocate(256,256,GL_RGBA, FALSE, FALSE); |