diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
5 files changed, 34 insertions, 10 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index e0e97bb938..f6870c3ff0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -110,7 +110,7 @@ void main() // Combine vec3 color; color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient); - color.rgb= max(vec3(0), color.rgb); + color.rgb = clamp(color.rgb, vec3(0), vec3(1)); color.rgb *= 2.0; /// Gamma correct for WL (soft clip effect). diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index cc4c3b5dce..9d9ba49d82 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -84,6 +84,7 @@ void main() color.rgb += rainbow(optic_d); color.rgb += halo_22; color.rgb *= 2.; + color.rgb = clamp(color.rgb, vec3(0), vec3(5)); frag_data[0] = vec4(0); frag_data[1] = vec4(0); diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl index 7a5e14566b..b5437d43d2 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl @@ -28,6 +28,10 @@ out vec4 frag_color; uniform sampler2D diffuseMap; +#if HAS_NOISE +uniform sampler2D glowNoiseMap; +uniform vec2 screen_res; +#endif uniform float minLuminance; uniform float maxExtractAlpha; uniform vec3 lumWeights; @@ -44,7 +48,16 @@ void main() float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) ); float warmth = smoothstep(minLuminance, minLuminance+1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) ); - frag_color.rgb = col.rgb; +#if HAS_NOISE + float TRUE_NOISE_RES = 128; // See mTrueNoiseMap + // *NOTE: Usually this is vary_fragcoord not vary_texcoord0, but glow extraction is in screen space + vec3 glow_noise = texture(glowNoiseMap, vary_texcoord0.xy * (screen_res / TRUE_NOISE_RES)).xyz; + // Dithering. Reduces banding effects in the reduced precision glow buffer. + float NOISE_DEPTH = 64.0; + col.rgb += glow_noise / NOISE_DEPTH; + col.rgb = max(col.rgb, vec3(0)); +#endif + frag_color.rgb = col.rgb; frag_color.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha); } diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl index b474a5803f..f51b0f4d9e 100644 --- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -25,7 +25,6 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; -uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; in vec3 position; @@ -54,14 +53,27 @@ float calcDirectionalLight(vec3 n, vec3 l) //==================================================================================================== +#ifdef HAS_SKIN +mat4 getObjectSkinnedTransform(); +uniform mat4 modelview_matrix; +uniform mat4 projection_matrix; +#endif + void main() { - //transform vertex - vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + vec3 norm; +#ifdef HAS_SKIN + mat4 mat = getObjectSkinnedTransform(); + mat = modelview_matrix * mat; + vec4 pos = mat * vec4(position.xyz, 1.0); + gl_Position = projection_matrix * pos; + norm = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz); +#else + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + norm = normalize(normal_matrix * normal); +#endif + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - vec3 norm = normalize(normal_matrix * normal); vec4 col = vec4(0,0,0,1); diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl index 48cf234aa0..41a848a14f 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl @@ -36,8 +36,6 @@ vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) { light *= atten.r; additive = srgb_to_linear(additive*2.0); - // magic 1.25 here is to match the default RenderSkyHDRScale -- this parameter needs to be plumbed into sky settings or something - // so it's available to all shaders that call atmosFragLighting instead of just softenLightF.glsl additive *= sky_hdr_scale; light += additive; return light; |