diff options
author | Dave Parks <davep@lindenlab.com> | 2013-07-01 16:27:20 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2013-07-01 16:27:20 -0500 |
commit | d6d2f74fbbf22ba70166a97e15b6c3b39e42ac4d (patch) | |
tree | f4bdf0bb387e4d8157963d1c0f5f971d470fde22 /indra/newview | |
parent | d262ca32d3b80803595fcc3f61f008786125250d (diff) |
NORSPEC-290 Shader optimization WIP -- compatibility pass with OpenGL 3.3, slight cleanup.
Diffstat (limited to 'indra/newview')
5 files changed, 11 insertions, 30 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index b666b7b0d9..4b428cb904 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -93,7 +93,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa float da = 0.0; -// if (d > 0.0 && la > 0.0 && fa > 0.0) + //if (d > 0.0 && la > 0.0 && fa > 0.0) { //normalize light vector lv /= d; @@ -230,7 +230,6 @@ void main() } #endif - vec4 gamma_diff = diff; vec3 normal = vary_norm; vec3 l = light_position[0].xyz; diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index ed51e01a53..5a08980fec 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -36,7 +36,6 @@ uniform sampler2DRect diffuseRect; uniform sampler2DRect specularRect; uniform sampler2DRect normalMap; uniform samplerCube environmentMap; -uniform sampler2D noiseMap; uniform sampler2D lightFunc; @@ -99,7 +98,6 @@ void main() norm = normalize(norm); vec4 spec = texture2DRect(specularRect, frag.xy); vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; - float noise = texture2D(noiseMap, frag.xy/128.0).b; vec3 out_col = vec3(0,0,0); vec3 npos = normalize(-pos); @@ -122,14 +120,10 @@ void main() dist_atten *= dist_atten; dist_atten *= 2.0; - dist_atten *= noise; - float lit = da * dist_atten; vec3 col = light_col[i].rgb*lit*diff; - //vec3 col = vec3(dist2, light_col[i].a, lit); - if (spec.a > 0.0) { lit = min(da*6.0, 1.0) * dist_atten; @@ -144,12 +138,8 @@ void main() float gtdenom = 2 * nh; float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - col += lit*scol*light_col[i].rgb*spec.rgb; - //col += spec.rgb; - } + float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); + col += max(lit*scol*light_col[i].rgb*spec.rgb, vec3(0.0)); } out_col += col; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index f162f70592..b331258952 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -102,11 +102,10 @@ void main() { vec3 norm = texture2DRect(normalMap, frag.xy).xyz; norm = decode_normal(norm.xy); // unpack norm - float da = dot(norm, lv); - + norm = normalize(norm); lv = normalize(lv); - da = max(dot(norm, lv), 0.0); + float da = max(dot(norm, lv), 0.0); //float noise = texture2D(noiseMap, frag.xy/128.0).b; @@ -116,7 +115,7 @@ void main() dist_atten *= dist_atten; dist_atten *= 2.0; - float lit = da * dist_atten; // * noise; + float lit = da * dist_atten; col = color.rgb*lit*col; @@ -135,11 +134,8 @@ void main() float gtdenom = 2 * nh; float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh))); - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - col += lit*scol*color.rgb*spec.rgb; - } + float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); + col += max(lit*scol*color.rgb*spec.rgb, vec3(0.0)); } } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 422f18566f..aae84709d8 100755 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -675,6 +675,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; gPipeline.updateCull(*LLViewerCamera::getInstance(), result, water_clip); + LLPipeline::sUnderWaterRender = FALSE; stop_glerror(); LLGLState::checkStates(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 7fa0a972ad..14529099b5 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -6316,13 +6316,6 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) F32 x = (3.f * (1.f + light->getLightFalloff())); // why this magic? probably trying to match a historic behavior. float linatten = x / (light_radius); // % of brightness at radius - if (LLPipeline::sRenderDeferred) - { - /*light_color.mV[0] = powf(light_color.mV[0], 2.2f); - light_color.mV[1] = powf(light_color.mV[1], 2.2f); - light_color.mV[2] = powf(light_color.mV[2], 2.2f);*/ - } - mHWLightColors[cur_light] = light_color; LLLightState* light_state = gGL.getLight(cur_light); @@ -6381,6 +6374,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool) light->setDiffuse(LLColor4::black); light->setAmbient(LLColor4::black); light->setSpecular(LLColor4::black); + light->setQuadraticAttenuation(1.f); + light->setLinearAttenuation(1.f); } if (gAgentAvatarp && gAgentAvatarp->mSpecialRenderMode == 3) |