diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
6 files changed, 32 insertions, 13 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index f49f274de0..d11b81d2d3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -194,6 +194,8 @@ void main() float final_alpha = diff.a; #endif + vec3 gamma_diff = diff.rgb; + diff.rgb = srgb_to_linear(diff.rgb); vec3 sunlit; @@ -239,10 +241,12 @@ vec3 post_sunlight = color.rgb; vec3 post_diffuse = color.rgb; //color.rgb = mix(diff.rgb, color.rgb, final_alpha); - - color.rgb = atmosFragLighting(color.rgb, additive, atten) * 2.0; + + color.rgb = atmosFragLighting(color.rgb, additive, atten); color.rgb = scaleSoftClipFrag(color.rgb); + //color.rgb = srgb_to_linear(color.rgb); + vec4 light = vec4(0,0,0,0); #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diff.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w * 0.5); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl index e68b082d43..e4d96a0028 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl @@ -29,13 +29,12 @@ ATTRIBUTE vec3 position; ATTRIBUTE vec3 normal; ATTRIBUTE vec2 texcoord0; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); void calcAtmospherics(vec3 inPositionEye); float calcDirectionalLight(vec3 n, vec3 l); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); VARYING vec3 vary_position; @@ -128,7 +127,7 @@ void main() col.rgb = vec3(0,0,0); // Add windlight lights - col.rgb = atmosAmbient(vec3(0.)); + col.rgb = atmosAmbient(); vary_ambient = col.rgb*color.rgb; vary_directional = color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl index 7fec3e03e7..5e4f08b017 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl @@ -34,7 +34,7 @@ ATTRIBUTE vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); VARYING vec4 vertex_color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index 816bd0bf3e..bdf3546aa5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); #ifdef WATER_FOG diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index b3d9b1e9c5..f21b7644bb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -75,6 +75,7 @@ VARYING vec2 vary_fragcoord; VARYING vec3 vary_position; +uniform mat4 proj_mat; uniform mat4 inv_proj; uniform vec2 screen_res; @@ -97,6 +98,17 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe vec3 col = vec3(0,0,0); + vec4 proj_tc = proj_mat * lp; + + if (proj_tc.z < 0 + || proj_tc.x < 0 + || proj_tc.z > 1 + || proj_tc.y < 0 + || proj_tc.y > 1) + { + return col; + } + if (d > 0.0) { //normalize light vector @@ -381,6 +393,8 @@ vec3 post_env = col.rgb; vec3 post_atmo = col.rgb; + //col.rgb = srgb_to_linear(col.rgb); + #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w * 0.5); LIGHT_LOOP(1) @@ -393,7 +407,7 @@ vec3 post_atmo = col.rgb; vec3 light_linear = light.rgb; - col.rgb += light_linear; + col.rgb += light_linear; vec3 postlight_linear = col.rgb; @@ -406,7 +420,7 @@ vec3 postlight_linear = col.rgb; al = temp.a; #endif -//col.rgb = light_linear; +//col.rgb = post_atmo; col.rgb = linear_to_srgb(col.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 83006c8916..e0fe6cfae1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -74,6 +74,8 @@ float getAmbientClamp(); void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); vec3 scaleSoftClipFrag(vec3 l); +vec3 srgb_to_linear(vec3 c); +vec3 linear_to_srgb(vec3 c); vec4 getPositionWithDepth(vec2 pos_screen, float depth); @@ -96,7 +98,9 @@ void main() final_da = clamp(final_da, 0.0, 1.0); //final_da = pow(final_da, light_gamma); - vec4 diffuse = texture2DRect(diffuseRect, tc); + vec4 gamma_diff = texture2DRect(diffuseRect, tc); + vec4 diffuse = gamma_diff; + diffuse.rgb = srgb_to_linear(gamma_diff.rgb); vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec3 col; @@ -126,7 +130,7 @@ vec3 post_ambient = col.rgb; vec3 post_sunlight = col.rgb; - col.rgb *= diffuse.rgb; + col.rgb *= gamma_diff.rgb; vec3 post_diffuse = col.rgb; @@ -177,8 +181,6 @@ vec3 post_diffuse = col.rgb; col = fogged.rgb; bloom = fogged.a; #endif - -//col.rgb = vec3(final_da); } frag_color.rgb = col.rgb; |