diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
5 files changed, 71 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index ad50690c02..c11298aadd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -110,14 +110,18 @@ void main() { lv = normalize(lv); da = dot(norm, lv); - + float fa = light_col[i].a+1.0; float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + dist_atten *= noise; float lit = da * dist_atten; - + + lit = pow(lit,0.7); + vec3 col = light_col[i].rgb*lit*diff; + //vec3 col = vec3(dist2, light_col[i].a, lit); if (spec.a > 0.0) @@ -128,15 +132,16 @@ void main() float nv = dot(norm, npos); float vh = dot(npos, h); float sa = nh; - vec3 fres = spec.rgb + pow(1 - dot(h, npos), 5) * (1 - spec.rgb); + float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; + float gtdenom = 2 * nh; float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - - if (sa > 0.0) + + if (nh > 0.0) { - vec3 scol = (fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt) / (nh * da); - col += lit*scol*light_col[i].rgb; + 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; } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index bff87cb6aa..09d23db096 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -40,6 +40,7 @@ uniform sampler2DRect normalMap; uniform samplerCube environmentMap; uniform sampler2D noiseMap; uniform sampler2D projectionMap; +uniform sampler2D lightFunc; uniform mat4 proj_mat; //screen space to light space uniform float proj_near; //near clip for projection @@ -142,7 +143,7 @@ void main() } vec3 norm = texture2DRect(normalMap, frag.xy).xyz; - norm = vec3((norm.xy-0.5)*2.0, norm.z); + norm = norm = (norm.xyz-0.5)*2.0; norm = normalize(norm); float l_dist = -dot(lv, proj_n); @@ -190,6 +191,8 @@ void main() vec3 lcol = color.rgb * plcol.rgb * plcol.a; lit = da * dist_atten * noise; + + lit = pow(lit, 0.7); col = lcol*lit*diff_tex; amb_da += (da*0.5)*proj_ambiance; @@ -236,8 +239,28 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb; + + vec3 npos = -normalize(pos); + lv = pfinal-pos.xyz; + lv = normalize(lv); + + vec3 h = normalize(lv+npos); + float nh = dot(norm, h); + float nv = dot(norm, npos); + float vh = dot(npos, h); + float sa = nh; + float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; + float gtdenom = 2 * nh; + float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh))); + + if (sa > 0.0) + { + float scol = fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt / (nh * da); + col += scol*color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod).rgb*spec.rgb; + } + + //vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); + //col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb; } } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index 03b036375b..e99329bbf2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -102,6 +102,8 @@ void main() float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); float lit = da * dist_atten * noise; + lit = pow(lit, 0.7); + col = color.rgb*lit*col; vec4 spec = texture2DRect(specularRect, frag.xy); @@ -113,14 +115,14 @@ void main() float nv = dot(norm, npos); float vh = dot(npos, h); float sa = nh; - vec3 fres = spec.rgb + pow(1 - dot(h, npos), 5) * (1 - spec.rgb); + float fres = pow(1 - dot(h, npos), 5) * 0.4+0.5; float gtdenom = 2 * nh; float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh))); - if (sa > 0.0) + if (nh > 0.0) { - vec3 scol = (fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt) / (nh * da); - col += lit*scol*color.rgb; + float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); + col += lit*scol*color.rgb*spec.rgb; } } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index f50935c1a8..437a06320e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -280,6 +280,8 @@ void main() float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); + da = pow(da, 0.7); + vec4 diffuse = texture2DRect(diffuseRect, tc); vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); @@ -300,7 +302,7 @@ void main() // vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); float sa = dot(refnormpersp, sun_dir.xyz); - vec3 dumbshiny = vary_SunlitColor*(6 * texture2D(lightFunc, vec2(sa, spec.a)).r); + vec3 dumbshiny = vary_SunlitColor*(texture2D(lightFunc, vec2(sa, spec.a)).r); // add the two types of shiny together vec3 spec_contrib = dumbshiny * spec.rgb; diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index cca63872de..2f18e1a13d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -41,6 +41,8 @@ uniform sampler2DRect normalMap; uniform samplerCube environmentMap; uniform sampler2D noiseMap; uniform sampler2D projectionMap; +uniform sampler2D lightFunc; + uniform mat4 proj_mat; //screen space to light space uniform float proj_near; //near clip for projection @@ -193,6 +195,8 @@ void main() lit = da * dist_atten * noise; + lit = pow(lit, 0.7); + col = lcol*lit*diff_tex; amb_da += (da*0.5)*proj_ambiance; } @@ -238,8 +242,25 @@ void main() stc.x > 0.0 && stc.y > 0.0) { - vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb; + vec3 npos = -normalize(pos); + lv = pfinal-pos.xyz; + lv = normalize(lv); + + vec3 h = normalize(lv+npos); + float nh = dot(norm, h); + float nv = dot(norm, npos); + float vh = dot(npos, h); + float sa = nh; + float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; + + 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 += scol*color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod).rgb*spec.rgb; + } } } } |