diff options
| author | Ptolemy <ptolemy@lindenlab.com> | 2022-09-12 01:22:47 -0700 | 
|---|---|---|
| committer | Ptolemy <ptolemy@lindenlab.com> | 2022-09-12 01:22:47 -0700 | 
| commit | 03df9545092cc3917e1c3f947ce2270d0ba31134 (patch) | |
| tree | c0d8ec5bfab8c968aa025882d9b1ca92eac7a580 | |
| parent | b0a9044240df88df613dcf134bfb080912864e9f (diff) | |
SL-17701: PBR: Tweak lighting in alpha blending
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl | 8 | ||||
| -rw-r--r-- | indra/newview/lldrawpoolalpha.cpp | 8 | ||||
| -rw-r--r-- | indra/newview/llviewershadermgr.cpp | 1 | 
3 files changed, 13 insertions, 4 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl index 1533d1dcb0..bde015d109 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl @@ -105,7 +105,7 @@ uniform float minimum_alpha; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlpha  // See: LLRender::syncLightState()  uniform vec4 light_position[8];  uniform vec3 light_direction[8]; // spot direction -uniform vec4 light_attenuation[8]; // linear, quadratic, ?, ? +uniform vec4 light_attenuation[8]; // linear, quadratic, is omni, unused, See: LLPipeline::setupHWLights() and syncLightState()  uniform vec3 light_diffuse[8];  vec2 encode_normal(vec3 n); @@ -128,8 +128,9 @@ void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, inout vec3 l  vec3 hue_to_rgb(float hue);  // lp = light position -// la = light radius +// la = linear attenuation, light radius  // fa = falloff +// See: LLRender::syncLightState()  vec3 calcPointLightOrSpotLight(vec3 reflect0, vec3 c_diff,      vec3 lightColor, vec3 diffuse, vec3 v, vec3 n, vec4 lp, vec3 ln,      float la, float fa, float is_pointlight, float ambiance) @@ -309,11 +310,10 @@ irradiance = vec3(amblit);  #endif          }      vec3 col = colorDiffuse + colorEmissive + colorSpec; -      vec3 light = vec3(0);      // Punctual lights -#define LIGHT_LOOP(i) light += scol * calcPointLightOrSpotLight( reflect0, c_diff, srgb_to_linear(light_diffuse[i].rgb), albedo.rgb, pos.xyz, n, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w ); +#define LIGHT_LOOP(i) light += srgb_to_linear(vec3(scol)) * calcPointLightOrSpotLight( reflect0, c_diff, srgb_to_linear(2.2*light_diffuse[i].rgb), albedo.rgb, pos.xyz, n, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w );      LIGHT_LOOP(1)      LIGHT_LOOP(2) diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 3d456d069f..ee085a65c2 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -83,6 +83,11 @@ void LLDrawPoolAlpha::prerender()      // TODO: is this even necessay?  These are probably set to never discard      LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(1024.f*1024.f);      LLViewerFetchedTexture::sWhiteImagep->addTextureStats(1024.f * 1024.f); + +    if (LLPipeline::sRenderPBR) +    { +        gPipeline.setupHWLights(NULL); +    }  }  S32 LLDrawPoolAlpha::getNumPostDeferredPasses()  @@ -657,6 +662,9 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)                      target_shader->uniform1f(LLShaderMgr::ROUGHNESS_FACTOR, params.mGLTFMaterial->mRoughnessFactor);                      target_shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, params.mGLTFMaterial->mMetallicFactor);                      target_shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, params.mGLTFMaterial->mEmissiveColor.mV); + +                    target_shader->mLightHash = 0; +                    gGL.syncLightState(); // Set light uniforms                  }                  else                  { diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 142d929188..391cfab5c0 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1688,6 +1688,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()              llassert(success);              // Alpha Shader Hack +            // See: LLRender::syncMatrices()              shader->mFeatures.calculatesLighting = true;              shader->mFeatures.hasLighting = true;          } | 
