From bf6182daa8b4d7cea79310547f71d7a3155e17b0 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 29 Mar 2013 07:50:08 -0700 Subject: Update Mac and Windows breakpad builds to latest --- indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl (limited to 'indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl') diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl old mode 100644 new mode 100755 -- cgit v1.2.3 From 8da8e05964710bea633af2bee36a7aa89f3a8656 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 2 Apr 2013 01:47:12 -0500 Subject: NORSPEC-58 Followup -- put back blinn phong, and do gamma correction approximation in light curves. Fix fresnel math. --- indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl') diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 890486c4b1..147fb4562e 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -138,6 +138,7 @@ void main() float shadow = 0.0; float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz)); + dp_directional_light = pow(dp_directional_light, 0.7); vec3 shadow_pos = pos.xyz + displace*norm; vec3 offset = sun_dir.xyz * (1.0-dp_directional_light); -- cgit v1.2.3 From 27fbf5efc9192813e5109443c60bfc26f99716ee Mon Sep 17 00:00:00 2001 From: Geenz Date: Tue, 9 Apr 2013 11:46:52 -0400 Subject: Re-added RGB10_A2 normal buffer, this time encoded with a sphere map transform so we can store the environment intensity in the blue channel. --- .../app_settings/shaders/class2/deferred/sunLightF.glsl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl') diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 147fb4562e..1e835ae49e 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -65,6 +65,17 @@ uniform float shadow_offset; uniform float spot_shadow_bias; uniform float spot_shadow_offset; +vec3 decode_normal (vec2 enc) +{ + vec2 fenc = enc*4-2; + float f = dot(fenc,fenc); + float g = sqrt(1-f/4); + vec3 n; + n.xy = fenc*g; + n.z = 1-f/2; + return n; +} + vec4 getPosition(vec2 pos_screen) { float depth = texture2DRect(depthMap, pos_screen.xy).r; @@ -126,7 +137,7 @@ void main() vec4 pos = getPosition(pos_screen); vec4 nmap4 = texture2DRect(normalMap, pos_screen); - nmap4 = vec4((nmap4.xyz-0.5)*2.0,nmap4.w); // unpack norm + nmap4 = vec4(decode_normal(nmap4.xy),nmap4.w); // unpack norm float displace = nmap4.w; vec3 norm = nmap4.xyz; -- cgit v1.2.3 From b5ecd3865728e048be8bf394fc8d1a06a317d88f Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 7 May 2013 17:11:47 -0500 Subject: Fix for bad light map generation/sampling. --- .../app_settings/shaders/class2/deferred/sunLightF.glsl | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl') diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 1e835ae49e..fa2f415e15 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -136,11 +136,9 @@ void main() vec4 pos = getPosition(pos_screen); - vec4 nmap4 = texture2DRect(normalMap, pos_screen); - nmap4 = vec4(decode_normal(nmap4.xy),nmap4.w); // unpack norm - float displace = nmap4.w; - vec3 norm = nmap4.xyz; - + vec3 norm = texture2DRect(normalMap, pos_screen).xyz; + norm = decode_normal(norm.xy); // unpack norm + /*if (pos.z == 0.0) // do nothing for sky *FIX: REMOVE THIS IF/WHEN THE POSITION MAP IS BEING USED AS A STENCIL { frag_color = vec4(0.0); // doesn't matter @@ -149,9 +147,8 @@ void main() float shadow = 0.0; float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz)); - dp_directional_light = pow(dp_directional_light, 0.7); - - vec3 shadow_pos = pos.xyz + displace*norm; + + vec3 shadow_pos = pos.xyz; vec3 offset = sun_dir.xyz * (1.0-dp_directional_light); vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); -- cgit v1.2.3 From c120feb18d2b98abf6071846d2806da16b710632 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sun, 9 Jun 2013 06:12:11 -0700 Subject: NORSPEC-246 WIP fix handling of encoded normals with single FP only cards --- .../shaders/class2/deferred/sunLightF.glsl | 46 +++++++++++++++++----- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl') diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index fa2f415e15..640701572d 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -65,16 +65,42 @@ uniform float shadow_offset; uniform float spot_shadow_bias; uniform float spot_shadow_offset; -vec3 decode_normal (vec2 enc) -{ - vec2 fenc = enc*4-2; - float f = dot(fenc,fenc); - float g = sqrt(1-f/4); - vec3 n; - n.xy = fenc*g; - n.z = 1-f/2; - return n; -} +#ifdef SINGLE_FP_ONLY +vec2 encode_normal(vec3 n) +{ + float f = sqrt(2 * n.z + 2); + return (n.xy / vec2(f)) + vec2(0.5f); +} + +vec3 decode_normal (vec2 enc) +{ + vec2 fenc = enc - 0.5f; + float f = dot(fenc,fenc); + f = clamp(f,0.0f,1.0f); + float g = sqrt(1-f); + vec3 n; + n.xy = fenc*g; + n.z = 1.0f - (f * 0.5f); + return normalize(n); +} +#else +vec2 encode_normal(vec3 n) +{ + float f = sqrt(8 * n.z + 8); + return n.xy / f + 0.5; +} + +vec3 decode_normal (vec2 enc) +{ + vec2 fenc = enc*4-2; + float f = dot(fenc,fenc); + float g = sqrt(1-f/4); + vec3 n; + n.xy = fenc*g; + n.z = 1-f/2; + return n; +} +#endif vec4 getPosition(vec2 pos_screen) { -- cgit v1.2.3 From 33a2608da5a85b01acbfcced10128a2c42760928 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sun, 9 Jun 2013 20:55:02 -0700 Subject: NORSPEC-246 fix issues with normal encoding on precision-deprived hardware and remove haxors --- .../app_settings/shaders/class2/deferred/sunLightF.glsl | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl') diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 640701572d..c1ed32f7e7 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -68,20 +68,16 @@ uniform float spot_shadow_offset; #ifdef SINGLE_FP_ONLY vec2 encode_normal(vec3 n) { - float f = sqrt(2 * n.z + 2); - return (n.xy / vec2(f)) + vec2(0.5f); + vec2 sn; + sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); } vec3 decode_normal (vec2 enc) { - vec2 fenc = enc - 0.5f; - float f = dot(fenc,fenc); - f = clamp(f,0.0f,1.0f); - float g = sqrt(1-f); - vec3 n; - n.xy = fenc*g; - n.z = 1.0f - (f * 0.5f); - return normalize(n); + vec3 n; + n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); + n.z = sqrt(1.0f - dot(n.xy,n.xy)); + return n; } #else vec2 encode_normal(vec3 n) -- cgit v1.2.3 From df3df9de4fb47cf00f51f5bcaab82ac4ca48bf74 Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Sun, 9 Jun 2013 21:12:40 -0700 Subject: NORSPEC-246 fix shader compile errors from missing return --- indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl') diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index c1ed32f7e7..334baad8b4 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -70,6 +70,7 @@ vec2 encode_normal(vec3 n) { vec2 sn; sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); + return sn; } vec3 decode_normal (vec2 enc) -- cgit v1.2.3 From 1f2125cc1263bda3352e195654f963777d9926a6 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 13 Jun 2013 11:45:54 -0400 Subject: correct DOS line endings --- .../shaders/class2/deferred/sunLightF.glsl | 64 +++++++++++----------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl') diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 334baad8b4..7b09dd29dd 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -65,38 +65,38 @@ uniform float shadow_offset; uniform float spot_shadow_bias; uniform float spot_shadow_offset; -#ifdef SINGLE_FP_ONLY -vec2 encode_normal(vec3 n) -{ - vec2 sn; - sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); - return sn; -} - -vec3 decode_normal (vec2 enc) -{ - vec3 n; - n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); - n.z = sqrt(1.0f - dot(n.xy,n.xy)); - return n; -} -#else -vec2 encode_normal(vec3 n) -{ - float f = sqrt(8 * n.z + 8); - return n.xy / f + 0.5; -} - -vec3 decode_normal (vec2 enc) -{ - vec2 fenc = enc*4-2; - float f = dot(fenc,fenc); - float g = sqrt(1-f/4); - vec3 n; - n.xy = fenc*g; - n.z = 1-f/2; - return n; -} +#ifdef SINGLE_FP_ONLY +vec2 encode_normal(vec3 n) +{ + vec2 sn; + sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); + return sn; +} + +vec3 decode_normal (vec2 enc) +{ + vec3 n; + n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); + n.z = sqrt(1.0f - dot(n.xy,n.xy)); + return n; +} +#else +vec2 encode_normal(vec3 n) +{ + float f = sqrt(8 * n.z + 8); + return n.xy / f + 0.5; +} + +vec3 decode_normal (vec2 enc) +{ + vec2 fenc = enc*4-2; + float f = dot(fenc,fenc); + float g = sqrt(1-f/4); + vec3 n; + n.xy = fenc*g; + n.z = 1-f/2; + return n; +} #endif vec4 getPosition(vec2 pos_screen) -- cgit v1.2.3