Removed TT_RECT_TEXTURE and removed unnecessary shaders.
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* @file eyeballV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2007, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat3 normal_matrix;
|
||||
uniform mat4 texture_matrix0;
|
||||
uniform mat4 modelview_matrix;
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec3 normal;
|
||||
ATTRIBUTE vec2 texcoord0;
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
|
||||
vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
|
||||
void calcAtmospherics(vec3 inPositionEye);
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
|
||||
vec3 norm = normalize(normal_matrix * normal);
|
||||
|
||||
calcAtmospherics(pos.xyz);
|
||||
|
||||
// vec4 specular = specularColor;
|
||||
vec4 specular = vec4(1.0);
|
||||
vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));
|
||||
|
||||
vertex_color = color;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D normalMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2D lightMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform sampler2D projectionMap;
|
||||
uniform sampler2D lightFunc;
|
||||
@@ -60,15 +60,32 @@ uniform int proj_shadow_idx;
|
||||
uniform float shadow_fade;
|
||||
|
||||
uniform vec3 center;
|
||||
uniform float size;
|
||||
uniform vec3 color;
|
||||
uniform float falloff;
|
||||
uniform float size;
|
||||
|
||||
VARYING vec4 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs)
|
||||
{
|
||||
vec3 low_range = cs / vec3(12.92);
|
||||
@@ -87,32 +104,10 @@ vec3 srgb_to_linear(vec3 cs)
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
vec4 correctWithGamma(vec4 col)
|
||||
{
|
||||
return vec4(srgb_to_linear(col.rgb), col.a);
|
||||
}
|
||||
|
||||
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret = correctWithGamma(ret);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
||||
@@ -128,7 +123,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
|
||||
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret = correctWithGamma(ret);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
||||
@@ -146,7 +141,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
|
||||
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
ret = correctWithGamma(ret);
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
||||
@@ -160,9 +155,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc /= screen_res;
|
||||
sc -= vec2(1.0,1.0);
|
||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
||||
vec4 pos = inv_proj * ndc;
|
||||
@@ -176,7 +170,6 @@ void main()
|
||||
vec4 frag = vary_fragcoord;
|
||||
frag.xyz /= frag.w;
|
||||
frag.xyz = frag.xyz*0.5+0.5;
|
||||
frag.xy *= screen_res;
|
||||
|
||||
vec3 pos = getPosition(frag.xy).xyz;
|
||||
vec3 lv = center.xyz-pos.xyz;
|
||||
@@ -191,14 +184,14 @@ void main()
|
||||
|
||||
if (proj_shadow_idx >= 0)
|
||||
{
|
||||
vec4 shd = texture2DRect(lightMap, frag.xy);
|
||||
vec4 shd = texture2D(lightMap, frag.xy);
|
||||
float sh[2];
|
||||
sh[0] = shd.b;
|
||||
sh[1] = shd.a;
|
||||
shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0);
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
vec3 norm = texture2D(normalMap, frag.xy).xyz;
|
||||
|
||||
float envIntensity = norm.z;
|
||||
|
||||
@@ -219,6 +212,7 @@ void main()
|
||||
float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
dist_atten *= 2.0;
|
||||
|
||||
if (dist_atten <= 0.0)
|
||||
{
|
||||
discard;
|
||||
@@ -230,10 +224,7 @@ void main()
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
|
||||
vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
@@ -243,12 +234,11 @@ void main()
|
||||
proj_tc.x > 0.0 &&
|
||||
proj_tc.y > 0.0)
|
||||
{
|
||||
float amb_da = proj_ambiance;
|
||||
float lit = 0.0;
|
||||
float amb_da = proj_ambiance;
|
||||
|
||||
if (da > 0.0)
|
||||
{
|
||||
lit = da * dist_atten * noise;
|
||||
|
||||
float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
|
||||
float lod = diff * proj_lod;
|
||||
@@ -257,6 +247,8 @@ void main()
|
||||
|
||||
dlit = color.rgb * plcol.rgb * plcol.a;
|
||||
|
||||
lit = da * dist_atten * noise;
|
||||
|
||||
col = dlit*lit*diff_tex*shadow;
|
||||
amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance;
|
||||
}
|
||||
@@ -270,14 +262,17 @@ void main()
|
||||
|
||||
amb_da = min(amb_da, 1.0-lit);
|
||||
|
||||
col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
|
||||
col += amb_da*color.rgb*diff_tex*amb_plcol.rgb*amb_plcol.a;
|
||||
}
|
||||
|
||||
|
||||
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
vec3 npos = -normalize(pos);
|
||||
dlit *= min(da*6.0, 1.0) * dist_atten;
|
||||
|
||||
vec3 npos = -normalize(pos);
|
||||
|
||||
//vec3 ref = dot(pos+lv, norm);
|
||||
vec3 h = normalize(lv+npos);
|
||||
@@ -297,10 +292,6 @@ void main()
|
||||
//col += spec.rgb;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (envIntensity > 0.0)
|
||||
{
|
||||
|
||||
@@ -31,11 +31,11 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2D lightMap;
|
||||
uniform sampler2D depthMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D lightFunc;
|
||||
|
||||
@@ -76,7 +76,6 @@ vec3 vary_AdditiveColor;
|
||||
vec3 vary_AtmosAttenuation;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs)
|
||||
{
|
||||
@@ -135,7 +134,6 @@ vec3 decode_normal (vec2 enc)
|
||||
vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||
{
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc /= screen_res;
|
||||
sc -= vec2(1.0,1.0);
|
||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
||||
vec4 pos = inv_proj * ndc;
|
||||
@@ -146,7 +144,7 @@ vec4 getPosition_d(vec2 pos_screen, float depth)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{ //get position in screen space (world units) given window coordinate and depth map
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
||||
return getPosition_d(pos_screen, depth);
|
||||
}
|
||||
|
||||
@@ -196,6 +194,52 @@ void setAtmosAttenuation(vec3 v)
|
||||
vary_AtmosAttenuation = v;
|
||||
}
|
||||
|
||||
#ifdef WATER_FOG
|
||||
uniform vec4 waterPlane;
|
||||
uniform vec4 waterFogColor;
|
||||
uniform float waterFogDensity;
|
||||
uniform float waterFogKS;
|
||||
|
||||
vec4 applyWaterFogDeferred(vec3 pos, vec4 color)
|
||||
{
|
||||
//normalize view vector
|
||||
vec3 view = normalize(pos);
|
||||
float es = -(dot(view, waterPlane.xyz));
|
||||
|
||||
//find intersection point with water plane and eye vector
|
||||
|
||||
//get eye depth
|
||||
float e0 = max(-waterPlane.w, 0.0);
|
||||
|
||||
vec3 int_v = waterPlane.w > 0.0 ? view * waterPlane.w/es : vec3(0.0, 0.0, 0.0);
|
||||
|
||||
//get object depth
|
||||
float depth = length(pos - int_v);
|
||||
|
||||
//get "thickness" of water
|
||||
float l = max(depth, 0.1);
|
||||
|
||||
float kd = waterFogDensity;
|
||||
float ks = waterFogKS;
|
||||
vec4 kc = waterFogColor;
|
||||
|
||||
float F = 0.98;
|
||||
|
||||
float t1 = -kd * pow(F, ks * e0);
|
||||
float t2 = kd + ks * es;
|
||||
float t3 = pow(F, t2*l) - 1.0;
|
||||
|
||||
float L = min(t1/t2*t3, 1.0);
|
||||
|
||||
float D = pow(0.98, l*kd);
|
||||
|
||||
color.rgb = color.rgb * D + kc.rgb * L;
|
||||
color.a = kc.a + color.a;
|
||||
|
||||
return color;
|
||||
}
|
||||
#endif
|
||||
|
||||
void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
|
||||
|
||||
vec3 P = inPositionEye;
|
||||
@@ -276,52 +320,6 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
|
||||
setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
|
||||
}
|
||||
|
||||
#ifdef WATER_FOG
|
||||
uniform vec4 waterPlane;
|
||||
uniform vec4 waterFogColor;
|
||||
uniform float waterFogDensity;
|
||||
uniform float waterFogKS;
|
||||
|
||||
vec4 applyWaterFogDeferred(vec3 pos, vec4 color)
|
||||
{
|
||||
//normalize view vector
|
||||
vec3 view = normalize(pos);
|
||||
float es = -(dot(view, waterPlane.xyz));
|
||||
|
||||
//find intersection point with water plane and eye vector
|
||||
|
||||
//get eye depth
|
||||
float e0 = max(-waterPlane.w, 0.0);
|
||||
|
||||
vec3 int_v = waterPlane.w > 0.0 ? view * waterPlane.w/es : vec3(0.0, 0.0, 0.0);
|
||||
|
||||
//get object depth
|
||||
float depth = length(pos - int_v);
|
||||
|
||||
//get "thickness" of water
|
||||
float l = max(depth, 0.1);
|
||||
|
||||
float kd = waterFogDensity;
|
||||
float ks = waterFogKS;
|
||||
vec4 kc = waterFogColor;
|
||||
|
||||
float F = 0.98;
|
||||
|
||||
float t1 = -kd * pow(F, ks * e0);
|
||||
float t2 = kd + ks * es;
|
||||
float t3 = pow(F, t2*l) - 1.0;
|
||||
|
||||
float L = min(t1/t2*t3, 1.0);
|
||||
|
||||
float D = pow(0.98, l*kd);
|
||||
|
||||
color.rgb = color.rgb * D + kc.rgb * L;
|
||||
color.a = kc.a + color.a;
|
||||
|
||||
return color;
|
||||
}
|
||||
#endif
|
||||
|
||||
vec3 atmosLighting(vec3 light)
|
||||
{
|
||||
light *= getAtmosAttenuation().r;
|
||||
@@ -394,13 +392,13 @@ float luminance(vec3 color)
|
||||
void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
float depth = texture2DRect(depthMap, tc.xy).r;
|
||||
float depth = texture2D(depthMap, tc.xy).r;
|
||||
vec3 pos = getPosition_d(tc, depth).xyz;
|
||||
vec4 norm = texture2DRect(normalMap, tc);
|
||||
vec4 norm = texture2D(normalMap, tc);
|
||||
float envIntensity = norm.z;
|
||||
norm.xyz = decode_normal(norm.xy); // unpack norm
|
||||
|
||||
vec4 diffuse = texture2DRect(diffuseRect, tc);
|
||||
vec4 diffuse = texture2D(diffuseRect, tc);
|
||||
|
||||
//convert to gamma space
|
||||
diffuse.rgb = linear_to_srgb(diffuse.rgb);
|
||||
@@ -408,7 +406,7 @@ void main()
|
||||
vec3 col;
|
||||
float bloom = 0.0;
|
||||
{
|
||||
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
|
||||
vec4 spec = texture2D(specularRect, vary_fragcoord.xy);
|
||||
bloom = spec.r*norm.w;
|
||||
|
||||
if (norm.w < 0.5)
|
||||
@@ -419,7 +417,7 @@ void main()
|
||||
float light_gamma = 1.0/1.3;
|
||||
da = pow(da, light_gamma);
|
||||
|
||||
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
|
||||
vec2 scol_ambocc = texture2D(lightMap, vary_fragcoord.xy).rg;
|
||||
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
|
||||
|
||||
float scol = max(scol_ambocc.r, diffuse.a);
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/**
|
||||
* @file softenLightF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2007, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
gl_Position = pos;
|
||||
|
||||
|
||||
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
|
||||
}
|
||||
@@ -32,12 +32,12 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D normalMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2D lightMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform sampler2D projectionMap;
|
||||
uniform sampler2D lightFunc;
|
||||
@@ -65,7 +65,6 @@ uniform float falloff;
|
||||
|
||||
VARYING vec3 trans_center;
|
||||
VARYING vec4 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
@@ -160,9 +159,8 @@ vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc /= screen_res;
|
||||
sc -= vec2(1.0,1.0);
|
||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
||||
vec4 pos = inv_proj * ndc;
|
||||
@@ -176,7 +174,6 @@ void main()
|
||||
vec4 frag = vary_fragcoord;
|
||||
frag.xyz /= frag.w;
|
||||
frag.xyz = frag.xyz*0.5+0.5;
|
||||
frag.xy *= screen_res;
|
||||
|
||||
vec3 pos = getPosition(frag.xy).xyz;
|
||||
vec3 lv = trans_center.xyz-pos.xyz;
|
||||
@@ -191,14 +188,14 @@ void main()
|
||||
|
||||
if (proj_shadow_idx >= 0)
|
||||
{
|
||||
vec4 shd = texture2DRect(lightMap, frag.xy);
|
||||
vec4 shd = texture2D(lightMap, frag.xy);
|
||||
float sh[2];
|
||||
sh[0] = shd.b;
|
||||
sh[1] = shd.a;
|
||||
shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0);
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
vec3 norm = texture2D(normalMap, frag.xy).xyz;
|
||||
float envIntensity = norm.z;
|
||||
norm = decode_normal(norm.xy);
|
||||
|
||||
@@ -229,13 +226,13 @@ void main()
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb;
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
if (proj_tc.z > 0.0 &&
|
||||
proj_tc.x < 1.0 &&
|
||||
proj_tc.y < 1.0 &&
|
||||
|
||||
@@ -33,8 +33,8 @@ out vec4 frag_color;
|
||||
|
||||
//class 2, shadows, no SSAO
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2DShadow shadowMap0;
|
||||
uniform sampler2DShadow shadowMap1;
|
||||
uniform sampler2DShadow shadowMap2;
|
||||
@@ -54,7 +54,6 @@ uniform float ssao_factor_inv;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
uniform vec2 proj_shadow_res;
|
||||
uniform vec3 sun_dir;
|
||||
|
||||
@@ -84,9 +83,8 @@ vec3 decode_normal (vec2 enc)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc /= screen_res;
|
||||
sc -= vec2(1.0,1.0);
|
||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
||||
vec4 pos = inv_proj * ndc;
|
||||
@@ -145,7 +143,7 @@ void main()
|
||||
|
||||
vec4 pos = getPosition(pos_screen);
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
|
||||
vec3 norm = texture2D(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
|
||||
|
||||
@@ -32,9 +32,9 @@ out vec4 frag_color;
|
||||
|
||||
//class 2 -- shadows and SSAO
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2DShadow shadowMap0;
|
||||
uniform sampler2DShadow shadowMap1;
|
||||
uniform sampler2DShadow shadowMap2;
|
||||
@@ -51,7 +51,6 @@ uniform vec4 shadow_clip;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
uniform vec2 proj_shadow_res;
|
||||
uniform vec3 sun_dir;
|
||||
|
||||
@@ -63,8 +62,6 @@ uniform float shadow_offset;
|
||||
uniform float spot_shadow_bias;
|
||||
uniform float spot_shadow_offset;
|
||||
|
||||
uniform float downsampled_depth_scale;
|
||||
|
||||
vec2 encode_normal(vec3 n)
|
||||
{
|
||||
float f = sqrt(8 * n.z + 8);
|
||||
@@ -84,9 +81,8 @@ vec3 decode_normal (vec2 enc)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc /= screen_res;
|
||||
sc -= vec2(1.0,1.0);
|
||||
vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
||||
vec4 pos = inv_proj * ndc;
|
||||
@@ -144,7 +140,7 @@ void main()
|
||||
|
||||
vec4 pos = getPosition(pos_screen);
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, pos_screen).xyz;
|
||||
vec3 norm = texture2D(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
|
||||
@@ -245,7 +241,7 @@ void main()
|
||||
}
|
||||
|
||||
frag_color[0] = shadow;
|
||||
frag_color[1] = texture2DRect(diffuseRect,vary_fragcoord*downsampled_depth_scale).r;
|
||||
frag_color[1] = texture2D(diffuseRect,vary_fragcoord).r;
|
||||
|
||||
spos = vec4(shadow_pos+norm*spot_shadow_offset, 1.0);
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* @file sunLightV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2007, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
gl_Position = pos;
|
||||
|
||||
vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @file sumLightsV.glsl
|
||||
* @file sumLightsSpecularV.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2005&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
|
||||
Reference in New Issue
Block a user