summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl31
1 files changed, 5 insertions, 26 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
index a6b09ad3ad..90445cb0ef 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl
@@ -81,6 +81,8 @@ void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float
bool clipProjectedLightVars(vec3 center, vec3 pos, out float dist, out float l_dist, out vec3 lv, out vec4 proj_tc );
vec3 getLightIntensitySpot(vec3 lightColor, float lightRange, float lightDistance, vec3 v);
vec4 getNormalEnvIntensityFlags(vec2 screenpos, out vec3 n, out float envIntensity);
+vec3 getProjectedLightDiffuseColor(float light_distance, vec2 projected_uv );
+vec3 getProjectedLightSpecularColor(vec3 pos, vec3 n);
vec2 getScreenXY(vec4 clip);
void initMaterial( vec3 diffuse, vec3 packedORM, out float alphaRough, out vec3 c_diff, out vec3 reflect0, out vec3 reflect90, out float specWeight );
vec3 srgb_to_linear(vec3 cs);
@@ -104,24 +106,6 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
return ret;
}
-vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
-{
- vec4 ret = texture2DLod(projectionMap, tc, lod);
- ret.rgb = srgb_to_linear(ret.rgb);
-
- vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
-
- float det = min(lod/(proj_lod*0.5), 1.0);
-
- float d = min(dist.x, dist.y);
-
- float edge = 0.25*det;
-
- ret *= clamp(d/edge, 0.0, 1.0);
-
- return ret;
-}
-
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
@@ -186,6 +170,7 @@ void main()
vec3 diffuse = texture2DRect(diffuseRect, tc).rgb;
vec4 spec = texture2DRect(specularRect, tc);
vec3 dlit = vec3(0, 0, 0);
+ vec3 slit = vec3(0, 0, 0);
if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))
{
@@ -216,13 +201,8 @@ void main()
{
lit = nl * dist_atten * noise;
- float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
- float lod = diff * proj_lod;
-
- vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
-
- dlit = color.rgb * plcol.rgb * plcol.a;
-
+ dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
+
final_color = dlit*lit*diffuse*shadow;
// unshadowed for consistency between forward and deferred?
@@ -240,7 +220,6 @@ void main()
final_color += amb_da*color.rgb*diffuse.rgb*amb_plcol.rgb*amb_plcol.a;
}
-
if (spec.a > 0.0)
{
dlit *= min(nl*6.0, 1.0) * dist_atten;