diff options
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl | 20 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 16 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 12 |
4 files changed, 30 insertions, 20 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 7dc2fb4cc0..241857dd92 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -96,12 +96,12 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec float dist = length(lv); float da = 1.0; - if (dist > la) + /*if (dist > la) { return col; } - /* clip to projector bounds + clip to projector bounds vec4 proj_tc = proj_mat * lp; if (proj_tc.z < 0 @@ -116,15 +116,15 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec if (dist > 0.0 && la > 0.0) { - dist /= la; + dist /= la; //normalize light vector lv = normalize(lv); //distance attenuation + fa += 1.0f; float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); dist_atten *= dist_atten; - //dist_atten *= 2.0f; if (dist_atten <= 0.0) { @@ -137,10 +137,11 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec //angular attenuation da *= dot(n, lv); + da = max(0.0, da); float lit = 0.0f; - float amb_da = ambiance; + float amb_da = 0.0;//ambiance; if (da > 0) { lit = max(da * dist_atten,0.0); @@ -151,7 +152,8 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec amb_da *= dist_atten; amb_da = min(amb_da, 1.0f - lit); - col.rgb += amb_da * light_col * diffuse; + // SL-10969 ... need to work out why this blows out in many setups... + //col.rgb += amb_da * light_col * diffuse; // no spec for alpha shader... } @@ -174,13 +176,14 @@ void main() #endif #ifdef USE_DIFFUSE_TEX - vec4 diffuse_srgb = texture2D(diffuseMap,vary_texcoord0.xy); + vec4 diffuse_tap = texture2D(diffuseMap,vary_texcoord0.xy); #endif #ifdef USE_INDEXED_TEX - vec4 diffuse_srgb = diffuseLookup(vary_texcoord0.xy); + vec4 diffuse_tap = diffuseLookup(vary_texcoord0.xy); #endif + vec4 diffuse_srgb = diffuse_tap; vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); #ifdef FOR_IMPOSTOR @@ -205,7 +208,6 @@ void main() #ifdef USE_VERTEX_COLOR float final_alpha = diffuse_linear.a * vertex_color.a; - diffuse_srgb.rgb *= vertex_color.rgb; diffuse_linear.rgb *= vertex_color.rgb; #else float final_alpha = diffuse_linear.a; diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 571d0dd17a..8ebb2f44d3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -117,6 +117,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe lv = normalize(lv); //distance attenuation + fa += 1.0f; float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); dist_atten *= dist_atten; //dist_atten *= 2.0f; @@ -136,7 +137,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe float lit = 0.0f; float amb_da = ambiance; - if (da > 0) + if (da >= 0) { lit = max(da * dist_atten,0.0); col = lit * light_col * diffuse; @@ -146,7 +147,8 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe amb_da *= dist_atten; amb_da = min(amb_da, 1.0f - lit); - col.rgb += amb_da * light_col * diffuse; + // SL-10969 need to see why these are blown out + //col.rgb += amb_da * light_col * diffuse; if (spec.a > 0.0) { @@ -225,8 +227,14 @@ void main() vec2 pos_screen = vary_texcoord0.xy; vec4 diffuse_tap = texture2D(diffuseMap, vary_texcoord0.xy); + +#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) + vec4 diffuse_srgb = diffuse_tap; + vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); +#else vec4 diffuse_linear = diffuse_tap; - vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_tap.a); + vec4 diffuse_srgb = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a); +#endif #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_MASK) if (diffuse_linear.a < minimum_alpha) @@ -338,7 +346,7 @@ vec3 post_ambient = color.rgb; vec3 post_sunlight = color.rgb; - color.rgb *= diffuse_linear.rgb; + color.rgb *= diffuse_srgb.rgb; vec3 post_diffuse = color.rgb; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 664615d4eb..61eb6f18a2 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3370,7 +3370,7 @@ F32 LLVOVolume::getLightFalloff() const const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); if (param_block) { - return param_block->getFalloff(); + return param_block->getFalloff() * 0.5f; } else { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d13b0634cf..d1a6fd12f2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6346,11 +6346,11 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) continue; } - F32 x = (3.f * (1.f + light->getLightFalloff())); // why this magic? probably trying to match a historic behavior. + F32 x = (3.f * (1.f + (light->getLightFalloff() * 2.0f))); // why this magic? probably trying to match a historic behavior. F32 linatten = x / (light_radius); // % of brightness at radius // get falloff to match for forward deferred rendering lights - F32 falloff = light->getLightFalloff() * 0.5f + (sRenderDeferred ? 0.0 : 1.f); + F32 falloff = light->getLightFalloff() + (sRenderDeferred ? 0.0 : 1.f); mHWLightColors[cur_light] = light_color; LLLightState* light_state = gGL.getLight(cur_light); @@ -8784,7 +8784,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target) gDeferredLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c); gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s); gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV); - gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f); + gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()); gGL.syncMatrices(); mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center)); @@ -8804,7 +8804,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target) mat.mult_matrix_vec(tc); fullscreen_lights.push_back(LLVector4(tc.v[0], tc.v[1], tc.v[2], s)); - light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f)); + light_colors.push_back(LLVector4(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff())); } } unbindDeferredShader(gDeferredLightProgram); @@ -8840,7 +8840,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target) gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c); gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s); gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV); - gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()*0.5f); + gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff()); gGL.syncMatrices(); mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center)); @@ -8915,7 +8915,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target) LLVector3 center = drawablep->getPositionAgent(); F32* c = center.mV; F32 light_size_final = volume->getLightRadius()*1.5f; - F32 light_falloff_final = volume->getLightFalloff()*0.5f; + F32 light_falloff_final = volume->getLightFalloff(); sVisibleLightCount++; |