Removed TT_RECT_TEXTURE and removed unnecessary shaders.
This commit is contained in:
@@ -33,18 +33,16 @@ out vec4 frag_color;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform sampler2DRect depthMapDownsampled;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D depthMapDownsampled;
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2D noiseMap;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
uniform float downsampled_depth_scale;
|
||||
|
||||
uniform float ssao_radius;
|
||||
uniform float ssao_max_radius;
|
||||
uniform float ssao_factor;
|
||||
uniform vec2 kern_scale;
|
||||
|
||||
vec3 decode_normal (vec2 enc)
|
||||
{
|
||||
@@ -59,9 +57,8 @@ vec3 decode_normal (vec2 enc)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMapDownsampled, pos_screen.xy*downsampled_depth_scale).r;
|
||||
float depth = texture2D(depthMapDownsampled, 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;
|
||||
@@ -90,7 +87,7 @@ vec2 getKern(int i)
|
||||
float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
{
|
||||
vec2 pos_screen = vary_fragcoord.xy;
|
||||
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy/128.0).xy;
|
||||
vec2 noise_reflect = texture2D(noiseMap, vary_fragcoord.xy / kern_scale / 128).xy;
|
||||
|
||||
// We treat the first sample as the origin, which definitely doesn't obscure itself thanks to being visible for sampling in the first place.
|
||||
float points = 1.0;
|
||||
@@ -98,13 +95,13 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
|
||||
// use a kernel scale that diminishes with distance.
|
||||
// a scale of less than 32 is just wasting good samples, though.
|
||||
float scale = max(32.0, min(ssao_radius / -pos.z, ssao_max_radius));
|
||||
vec2 scale = max(32.0, min(ssao_radius / -pos.z, ssao_max_radius)) * kern_scale;
|
||||
|
||||
// it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?)
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
vec2 samppos_screen = pos_screen + scale * reflect(getKern(i), noise_reflect);
|
||||
vec3 samppos_world = getPosition(samppos_screen).xyz;
|
||||
vec3 samppos_world = getPosition(samppos_screen).xyz;
|
||||
|
||||
vec3 diff = samppos_world - pos.xyz;
|
||||
|
||||
@@ -119,8 +116,9 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm)
|
||||
points += 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
angle_hidden /= points;
|
||||
|
||||
float rtn = (1.0 - angle_hidden);
|
||||
return (rtn * rtn) * (rtn * rtn); //Pow2 to increase darkness to match previous behavior.
|
||||
}
|
||||
@@ -133,7 +131,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);
|
||||
|
||||
frag_color = vec4(calcAmbientOcclusion(pos,norm),0,0,0);
|
||||
|
||||
@@ -93,7 +93,6 @@ vec3 vary_AdditiveColor;
|
||||
vec3 vary_AtmosAttenuation;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform vec4 light_position[8];
|
||||
uniform vec3 light_direction[8];
|
||||
@@ -486,7 +485,6 @@ void main()
|
||||
|
||||
#if HAS_SHADOW
|
||||
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
|
||||
frag *= screen_res;
|
||||
vec4 spos = pos;
|
||||
|
||||
if (spos.z > -shadow_clip.w)
|
||||
|
||||
@@ -31,20 +31,18 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2D lightMap;
|
||||
|
||||
uniform float dist_factor;
|
||||
uniform float blur_size;
|
||||
uniform vec2 delta;
|
||||
//uniform vec3 kern[4];
|
||||
uniform float kern_scale;
|
||||
uniform vec2 kern_scale;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
vec2 getKern(int i)
|
||||
{
|
||||
@@ -59,9 +57,8 @@ vec2 getKern(int i)
|
||||
|
||||
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;
|
||||
@@ -90,13 +87,13 @@ vec3 decode_normal (vec2 enc)
|
||||
void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
vec3 norm = texture2DRect(normalMap, tc).xyz;
|
||||
vec3 norm = texture2D(normalMap, tc).xyz;
|
||||
norm = decode_normal(norm.xy); // unpack norm
|
||||
|
||||
vec3 pos = getPosition(tc).xyz;
|
||||
vec4 ccol = texture2DRect(lightMap, tc).rgba;
|
||||
|
||||
vec2 dlt = kern_scale * delta / (vec2(1.0)+norm.xy*norm.xy);
|
||||
vec4 ccol = texture2D(lightMap, tc).rgba;
|
||||
|
||||
vec2 dlt = delta / (vec2(1.0)+norm.xy*norm.xy);
|
||||
dlt /= max(-pos.z*dist_factor, 1.0);
|
||||
|
||||
vec2 defined_weight = getKern(0).xy; // special case the first (centre) sample's weight in the blur; we have to sample it anyway so we get it for 'free'
|
||||
@@ -106,9 +103,9 @@ void main()
|
||||
float pointplanedist_tolerance_pow2 = pos.z*-0.001;
|
||||
|
||||
// perturb sampling origin slightly in screen-space to hide edge-ghosting artifacts where smoothing radius is quite large
|
||||
vec2 tc_v = fract(0.5 * tc.xy); // we now have floor(mod(tc,2.0))*0.5
|
||||
vec2 tc_v = fract(0.5 * tc.xy / kern_scale); // we now have floor(mod(tc,2.0))*0.5
|
||||
float tc_mod = 2.0 * abs(tc_v.x - tc_v.y); // diff of x,y makes checkerboard
|
||||
tc += ( (tc_mod - 0.5) * dlt * 0.5 );
|
||||
tc += ( (tc_mod - 0.5) * dlt * 0.5 ) * kern_scale;
|
||||
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
@@ -119,7 +116,7 @@ void main()
|
||||
if (d*d <= pointplanedist_tolerance_pow2)
|
||||
{
|
||||
vec4 weight = getKern(i).xyxx;
|
||||
col += texture2DRect(lightMap, samptc)*weight;
|
||||
col += texture2D(lightMap, samptc)*weight;
|
||||
defined_weight += weight.xy;
|
||||
}
|
||||
}
|
||||
@@ -132,7 +129,7 @@ void main()
|
||||
if (d*d <= pointplanedist_tolerance_pow2)
|
||||
{
|
||||
vec4 weight = getKern(i).xyxx;
|
||||
col += texture2DRect(lightMap, samptc)*weight;
|
||||
col += texture2D(lightMap, samptc)*weight;
|
||||
defined_weight += weight.xy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file blurLightF.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;
|
||||
}
|
||||
@@ -31,8 +31,8 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D bloomMap;
|
||||
|
||||
uniform float depth_cutoff;
|
||||
@@ -44,13 +44,12 @@ uniform float magnification;
|
||||
uniform float max_cof;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
float getDepth(vec2 pos_screen)
|
||||
{
|
||||
float z = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
float z = texture2D(depthMap, pos_screen.xy).r;
|
||||
z = z*2.0-1.0;
|
||||
vec4 ndc = vec4(0.0, 0.0, z, 1.0);
|
||||
vec4 p = inv_proj*ndc;
|
||||
@@ -78,13 +77,13 @@ void main()
|
||||
|
||||
float depth = getDepth(tc);
|
||||
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
|
||||
vec4 diff = texture2D(diffuseRect, vary_fragcoord.xy);
|
||||
|
||||
float sc = calc_cof(depth);
|
||||
sc = min(sc, max_cof);
|
||||
sc = max(sc, -max_cof);
|
||||
|
||||
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
|
||||
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy);
|
||||
frag_color.rgb = diff.rgb + bloom.rgb;
|
||||
frag_color.a = sc/max_cof*0.5+0.5;
|
||||
}
|
||||
|
||||
@@ -31,11 +31,10 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect lightMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D lightMap;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform float max_cof;
|
||||
uniform float res_scale;
|
||||
@@ -44,12 +43,12 @@ uniform float dof_height;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
vec4 dofSample(sampler2DRect tex, vec2 tc)
|
||||
vec4 dofSample(sampler2D tex, vec2 tc)
|
||||
{
|
||||
tc.x = min(tc.x, dof_width);
|
||||
tc.y = min(tc.y, dof_height);
|
||||
|
||||
return texture2DRect(tex, tc);
|
||||
return texture2D(tex, tc);
|
||||
}
|
||||
|
||||
void main()
|
||||
@@ -58,7 +57,7 @@ void main()
|
||||
|
||||
vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale);
|
||||
|
||||
vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy);
|
||||
vec4 diff = texture2D(lightMap, vary_fragcoord.xy);
|
||||
|
||||
float a = min(abs(diff.a*2.0-1.0) * max_cof*res_scale*res_scale, 1.0);
|
||||
|
||||
@@ -67,10 +66,10 @@ void main()
|
||||
float sc = a/res_scale;
|
||||
|
||||
vec4 col;
|
||||
col = texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,sc));
|
||||
col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,sc));
|
||||
col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,-sc));
|
||||
col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,-sc));
|
||||
col = texture2D(lightMap, vary_fragcoord.xy+vec2(sc,sc));
|
||||
col += texture2D(lightMap, vary_fragcoord.xy+vec2(-sc,sc));
|
||||
col += texture2D(lightMap, vary_fragcoord.xy+vec2(sc,-sc));
|
||||
col += texture2D(lightMap, vary_fragcoord.xy+vec2(-sc,-sc));
|
||||
|
||||
diff = mix(diff, col*0.25, a);
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D depthMap;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragDepth = texture2DRect(depthMap, vary_fragcoord.xy).r;
|
||||
gl_FragDepth = texture2D(depthMap, vary_fragcoord.xy).r;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,9 @@ out vec4 frag_color;
|
||||
|
||||
#define FXAA_PC 1
|
||||
//#define FXAA_GLSL_130 1
|
||||
#ifndef FXAA_QUALITY_M_PRESET
|
||||
#define FXAA_QUALITY_M_PRESET 12
|
||||
#endif
|
||||
|
||||
/*============================================================================
|
||||
|
||||
@@ -2109,11 +2111,10 @@ uniform vec2 rcp_screen_res;
|
||||
uniform vec4 rcp_frame_opt;
|
||||
uniform vec4 rcp_frame_opt2;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
VARYING vec2 vary_tc;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 diff = FxaaPixelShader(vary_tc, //pos
|
||||
vec4 diff = FxaaPixelShader(vary_fragcoord, //pos
|
||||
vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos
|
||||
diffuseMap, //tex
|
||||
diffuseMap,
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* @file luminanceF.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 sampler2DRect diffuseMap;
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
#else
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = texture2DRect(diffuseMap, vary_fragcoord.xy);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* @file giV.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;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
VARYING vec4 vertex_color;
|
||||
|
||||
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;
|
||||
|
||||
vertex_color = diffuse_color;
|
||||
}
|
||||
@@ -147,7 +147,6 @@ vec3 vary_AdditiveColor;
|
||||
vec3 vary_AtmosAttenuation;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform vec4 light_position[8];
|
||||
uniform vec3 light_direction[8];
|
||||
@@ -276,7 +275,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
|
||||
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;
|
||||
|
||||
@@ -46,7 +46,6 @@ uniform mat4 modelview_matrix;
|
||||
VARYING vec3 vary_position;
|
||||
#if HAS_SUN_SHADOW
|
||||
VARYING vec2 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -144,7 +143,7 @@ vary_normal = n;
|
||||
vary_position = pos;
|
||||
#endif
|
||||
#if HAS_SUN_SHADOW
|
||||
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
|
||||
vary_fragcoord = (pos.xy*0.5+0.5);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D normalMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform sampler2D lightFunc;
|
||||
@@ -49,7 +49,6 @@ uniform vec4 light[LIGHT_COUNT];
|
||||
uniform vec4 light_col[LIGHT_COUNT];
|
||||
|
||||
VARYING vec4 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform float far_z;
|
||||
|
||||
@@ -74,9 +73,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;
|
||||
@@ -87,18 +85,18 @@ vec4 getPosition(vec2 pos_screen)
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 frag = (vary_fragcoord.xy*0.5+0.5)*screen_res;
|
||||
vec2 frag = (vary_fragcoord.xy*0.5+0.5);
|
||||
vec3 pos = getPosition(frag.xy).xyz;
|
||||
if (pos.z < far_z)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
vec3 norm = texture2D(normalMap, frag.xy).xyz;
|
||||
norm = decode_normal(norm.xy); // unpack norm
|
||||
norm = normalize(norm);
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
vec3 diff = texture2D(diffuseRect, frag.xy).rgb;
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
vec3 out_col = vec3(0,0,0);
|
||||
|
||||
@@ -34,10 +34,10 @@ out vec4 frag_color;
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
//#extension GL_ARB_shader_texture_lod : enable
|
||||
|
||||
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 sampler2D noiseMap;
|
||||
uniform sampler2D projectionMap;
|
||||
@@ -64,7 +64,6 @@ uniform float falloff;
|
||||
uniform float size;
|
||||
|
||||
VARYING vec4 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
@@ -153,9 +152,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;
|
||||
@@ -169,7 +167,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;
|
||||
@@ -180,7 +177,7 @@ void main()
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
vec3 norm = texture2D(normalMap, frag.xy).xyz;
|
||||
float envIntensity = norm.z;
|
||||
|
||||
norm = decode_normal(norm.xy);
|
||||
@@ -212,7 +209,7 @@ void main()
|
||||
|
||||
vec3 col = vec3(0,0,0);
|
||||
|
||||
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb;
|
||||
vec3 dlit = vec3(0, 0, 0);
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
@@ -251,7 +248,7 @@ void main()
|
||||
}
|
||||
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
|
||||
@@ -31,13 +31,13 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect normalMap;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D normalMap;
|
||||
uniform samplerCube environmentMap;
|
||||
uniform sampler2D noiseMap;
|
||||
uniform sampler2D lightFunc;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D depthMap;
|
||||
|
||||
uniform vec3 env_mat[3];
|
||||
uniform float sun_wash;
|
||||
@@ -49,8 +49,6 @@ uniform float size;
|
||||
VARYING vec4 vary_fragcoord;
|
||||
VARYING vec3 trans_center;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec4 viewport;
|
||||
|
||||
@@ -73,9 +71,8 @@ vec3 decode_normal (vec2 enc)
|
||||
|
||||
vec4 getPosition(vec2 pos_screen)
|
||||
{
|
||||
float depth = texture2DRect(depthMap, pos_screen.xy).r;
|
||||
vec2 sc = (pos_screen.xy-viewport.xy)*2.0;
|
||||
sc /= viewport.zw;
|
||||
float depth = texture2D(depthMap, pos_screen.xy).r;
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
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;
|
||||
@@ -89,7 +86,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;
|
||||
@@ -100,7 +96,7 @@ void main()
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
vec3 norm = texture2D(normalMap, frag.xy).xyz;
|
||||
norm = decode_normal(norm.xy); // unpack norm
|
||||
float da = dot(norm, lv);
|
||||
if (da < 0.0)
|
||||
@@ -114,7 +110,7 @@ void main()
|
||||
|
||||
float noise = texture2D(noiseMap, frag.xy/128.0).b;
|
||||
|
||||
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
|
||||
vec3 col = texture2D(diffuseRect, frag.xy).rgb;
|
||||
float fa = falloff+1.0;
|
||||
float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0);
|
||||
dist_atten *= dist_atten;
|
||||
@@ -124,7 +120,7 @@ void main()
|
||||
|
||||
col = color.rgb*lit*col;
|
||||
|
||||
vec4 spec = texture2DRect(specularRect, frag.xy);
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
if (spec.a > 0.0)
|
||||
{
|
||||
lit = min(da*6.0, 1.0) * dist_atten;
|
||||
|
||||
@@ -31,10 +31,9 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2D diffuseRect;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
uniform float max_cof;
|
||||
uniform float res_scale;
|
||||
|
||||
@@ -42,7 +41,7 @@ VARYING vec2 vary_fragcoord;
|
||||
|
||||
void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc)
|
||||
{
|
||||
vec4 s = texture2DRect(diffuseRect, tc);
|
||||
vec4 s = texture2D(diffuseRect, tc);
|
||||
|
||||
float sc = abs(s.a*2.0-1.0)*max_cof;
|
||||
|
||||
@@ -61,7 +60,7 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc)
|
||||
|
||||
void dofSampleNear(inout vec4 diff, inout float w, float min_sc, vec2 tc)
|
||||
{
|
||||
vec4 s = texture2DRect(diffuseRect, tc);
|
||||
vec4 s = texture2D(diffuseRect, tc);
|
||||
|
||||
float wg = 0.25;
|
||||
|
||||
@@ -77,7 +76,7 @@ void main()
|
||||
{
|
||||
vec2 tc = vary_fragcoord.xy;
|
||||
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
|
||||
vec4 diff = texture2D(diffuseRect, vary_fragcoord.xy);
|
||||
|
||||
{
|
||||
float w = 1.0;
|
||||
|
||||
@@ -31,9 +31,8 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2D diffuseRect;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
//uniform float display_gamma;
|
||||
@@ -60,7 +59,7 @@ vec3 linear_to_srgb(vec3 cl)
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
|
||||
vec4 diff = texture2D(diffuseRect, vary_fragcoord);
|
||||
diff.rgb = linear_to_srgb(diff.rgb);
|
||||
frag_color = diff;
|
||||
}
|
||||
@@ -31,17 +31,16 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D bloomMap;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy);
|
||||
vec4 diff = texture2D(diffuseRect, vary_fragcoord.xy);
|
||||
|
||||
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
|
||||
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy);
|
||||
frag_color = diff + bloom;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,10 @@ 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;
|
||||
vary_fragcoord = (pos.xy*0.5+0.5);
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/**
|
||||
* @file postDeferredV.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;
|
||||
VARYING vec2 vary_tc;
|
||||
|
||||
uniform vec2 tc_scale;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
gl_Position = pos;
|
||||
vary_tc = (pos.xy*0.5+0.5)*tc_scale;
|
||||
vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
|
||||
}
|
||||
@@ -32,12 +32,11 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2DRect specularRect;
|
||||
uniform sampler2DRect positionMap;
|
||||
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 +75,6 @@ vec3 vary_AdditiveColor;
|
||||
vec3 vary_AtmosAttenuation;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs)
|
||||
{
|
||||
@@ -129,7 +127,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;
|
||||
@@ -140,7 +137,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).a;
|
||||
float depth = texture2D(depthMap, pos_screen.xy).a;
|
||||
return getPosition_d(pos_screen, depth);
|
||||
}
|
||||
|
||||
@@ -381,13 +378,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);
|
||||
@@ -395,7 +392,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)
|
||||
{
|
||||
@@ -470,7 +467,7 @@ void main()
|
||||
//col.g = envIntensity;
|
||||
}
|
||||
|
||||
frag_color.rgb = col.rgb;
|
||||
frag_color.rgb = col;
|
||||
|
||||
frag_color.a = bloom;
|
||||
}
|
||||
|
||||
@@ -1,40 +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;
|
||||
}
|
||||
@@ -34,10 +34,10 @@ out vec4 frag_color;
|
||||
|
||||
//class 1 -- no shadows
|
||||
|
||||
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 sampler2D noiseMap;
|
||||
uniform sampler2D projectionMap;
|
||||
@@ -64,7 +64,6 @@ uniform float falloff;
|
||||
|
||||
VARYING vec3 trans_center;
|
||||
VARYING vec4 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform mat4 inv_proj;
|
||||
|
||||
@@ -159,9 +158,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;
|
||||
@@ -175,7 +173,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;
|
||||
@@ -187,7 +184,7 @@ void main()
|
||||
}
|
||||
|
||||
|
||||
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
|
||||
vec3 norm = texture2D(normalMap, frag.xy).xyz;
|
||||
float envIntensity = norm.z;
|
||||
norm = decode_normal(norm.xy);
|
||||
|
||||
@@ -218,9 +215,9 @@ 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);
|
||||
vec4 spec = texture2D(specularRect, frag.xy);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -27,8 +27,6 @@ uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
|
||||
@@ -33,17 +33,15 @@ out vec4 frag_color;
|
||||
|
||||
VARYING vec2 vary_fragcoord;
|
||||
|
||||
uniform sampler2DRect depthMapDownsampled;
|
||||
uniform sampler2DRect depthMap;
|
||||
uniform sampler2D depthMapDownsampled;
|
||||
uniform sampler2D depthMap;
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform float downsampled_depth_scale;
|
||||
uniform vec2 screen_res;
|
||||
uniform sampler2D diffuseRect;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color[0] = 1.0;
|
||||
frag_color[1] = texture2DRect(diffuseRect,vary_fragcoord.xy*downsampled_depth_scale).r;
|
||||
frag_color[1] = texture2D(diffuseRect,vary_fragcoord.xy).r;
|
||||
frag_color[2] = 1.0;
|
||||
frag_color[3] = 1.0;
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* @file sunLightF.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;
|
||||
}
|
||||
@@ -58,7 +58,6 @@ uniform vec3 normScale;
|
||||
uniform float fresnelScale;
|
||||
uniform float fresnelOffset;
|
||||
uniform float blurMultiplier;
|
||||
uniform vec2 screen_res;
|
||||
uniform mat4 norm_mat; //region space to screen space
|
||||
|
||||
//bigWave is (refCoord.w, view.w);
|
||||
|
||||
@@ -13,11 +13,10 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect tex0;
|
||||
uniform sampler2DRect tex1;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform mat4 inv_proj;
|
||||
uniform mat4 prev_proj;
|
||||
uniform vec2 screen_res;
|
||||
uniform int blur_strength;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
@@ -26,9 +25,8 @@ VARYING vec2 vary_texcoord0;
|
||||
|
||||
vec4 getPosition(vec2 pos_screen, out vec4 ndc)
|
||||
{
|
||||
float depth = texture2DRect(tex1, pos_screen.xy).r;
|
||||
float depth = texture2D(tex1, pos_screen.xy).r;
|
||||
vec2 sc = pos_screen.xy*2.0;
|
||||
sc /= screen_res;
|
||||
sc -= vec2(1.0,1.0);
|
||||
ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
|
||||
vec4 pos = inv_proj * ndc;
|
||||
@@ -44,14 +42,14 @@ void main(void)
|
||||
vec4 prev_pos = prev_proj * pos;
|
||||
prev_pos/=prev_pos.w;
|
||||
prev_pos.w = 1.0;
|
||||
vec2 vel = ((ndc.xy-prev_pos.xy) * .5) * screen_res * .01 * blur_strength * 1.0/SAMPLE_COUNT;
|
||||
vec2 vel = ((ndc.xy-prev_pos.xy) * .5) * .01 * blur_strength * 1.0/SAMPLE_COUNT;
|
||||
float len = length(vel);
|
||||
vel = normalize(vel) * min(len, 50);
|
||||
vec3 color = texture2DRect(tex0, vary_texcoord0.st).rgb;
|
||||
vec3 color = texture2D(tex0, vary_texcoord0.st).rgb;
|
||||
vec2 texcoord = vary_texcoord0 + vel;
|
||||
for(int i = 1; i < SAMPLE_COUNT; ++i, texcoord += vel)
|
||||
{
|
||||
color += texture2DRect(tex0, texcoord.st).rgb;
|
||||
color += texture2D(tex0, texcoord.st).rgb;
|
||||
}
|
||||
frag_color = vec4(color / SAMPLE_COUNT, 1.0);
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect tex0;
|
||||
uniform sampler2D tex0;
|
||||
uniform int layerCount;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 color = pow(floor(pow(vec3(texture2DRect(tex0, vary_texcoord0.st)),vec3(.6)) * layerCount)/layerCount,vec3(1.66666));
|
||||
vec3 color = pow(floor(pow(vec3(texture2D(tex0, vary_texcoord0.st)),vec3(.6)) * layerCount)/layerCount,vec3(1.66666));
|
||||
frag_color = vec4(color, 1.0);
|
||||
}
|
||||
|
||||
@@ -13,13 +13,12 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect tex0;
|
||||
uniform sampler2D tex0;
|
||||
uniform float vignette_strength; //0 - 1
|
||||
uniform float vignette_radius; //0 - 8
|
||||
uniform float vignette_darkness; //0 - 1
|
||||
uniform float vignette_desaturation; //0 - 10
|
||||
uniform float vignette_chromatic_aberration; //0 - .1
|
||||
uniform vec2 screen_res;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
@@ -32,16 +31,15 @@ float luminance(vec3 color)
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 color = texture2DRect(tex0, vary_texcoord0).rgb;
|
||||
vec2 norm_texcood = (vary_texcoord0/screen_res);
|
||||
vec2 offset = norm_texcood-vec2(.5);
|
||||
vec3 color = texture2D(tex0, vary_texcoord0).rgb;
|
||||
vec2 offset = vary_texcoord0-vec2(.5);
|
||||
float vignette = clamp(pow(1 - dot(offset,offset),vignette_radius) + 1-vignette_strength, 0.0, 1.0);
|
||||
float inv_vignette = 1-vignette;
|
||||
|
||||
//vignette chromatic aberration (g
|
||||
vec2 shift = screen_res * offset * vignette_chromatic_aberration * inv_vignette;
|
||||
float g = texture2DRect(tex0,vary_texcoord0-shift).g;
|
||||
float b = texture2DRect(tex0,vary_texcoord0-2*shift).b;
|
||||
vec2 shift = offset * vignette_chromatic_aberration * inv_vignette;
|
||||
float g = texture2D(tex0,vary_texcoord0-shift).g;
|
||||
float b = texture2D(tex0,vary_texcoord0-2*shift).b;
|
||||
color.gb = vec2(g,b);
|
||||
|
||||
//vignette 'black' overlay.
|
||||
|
||||
@@ -14,7 +14,7 @@ out vec4 frag_color;
|
||||
#endif
|
||||
|
||||
|
||||
uniform sampler2DRect tex0;
|
||||
uniform sampler2D tex0;
|
||||
uniform float brightness;
|
||||
uniform float contrast;
|
||||
uniform vec3 contrastBase;
|
||||
@@ -34,7 +34,7 @@ float luminance(vec3 color)
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 color = vec3(texture2DRect(tex0, vary_texcoord0.st));
|
||||
vec3 color = vec3(texture2D(tex0, vary_texcoord0.st));
|
||||
|
||||
/// Apply gamma
|
||||
color = pow(color, vec3(1.0/gamma));
|
||||
|
||||
@@ -6,32 +6,22 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect tex0;
|
||||
uniform sampler2D tex0;
|
||||
uniform int horizontalPass;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
vec2 offset = vec2( 1.3846153846, 3.2307692308 );
|
||||
uniform vec4 kern[2];
|
||||
vec3 weight = vec3( 0.2270270270, 0.3162162162, 0.0702702703 );
|
||||
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 color = vec3(texture2DRect(tex0, vary_texcoord0))*weight.x;
|
||||
vec3 color = vec3(texture2D(tex0, vary_texcoord0))*weight.x;
|
||||
|
||||
if(horizontalPass == 1)
|
||||
{
|
||||
color += weight.y * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s+offset.s,vary_texcoord0.t)));
|
||||
color += weight.y * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s-offset.s,vary_texcoord0.t)));
|
||||
color += weight.z * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s+offset.t,vary_texcoord0.t)));
|
||||
color += weight.z * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s-offset.t,vary_texcoord0.t)));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
color += weight.y * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s,vary_texcoord0.t+offset.s)));
|
||||
color += weight.y * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s,vary_texcoord0.t-offset.s)));
|
||||
color += weight.z * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s,vary_texcoord0.t+offset.t)));
|
||||
color += weight.z * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s,vary_texcoord0.t-offset.t)));
|
||||
}
|
||||
color += weight.y * vec3(texture2D(tex0, vec2(vary_texcoord0.s+kern[horizontalPass%2].s,vary_texcoord0.t+kern[horizontalPass].s)));
|
||||
color += weight.y * vec3(texture2D(tex0, vec2(vary_texcoord0.s-kern[horizontalPass%2].s,vary_texcoord0.t-kern[horizontalPass].s)));
|
||||
color += weight.z * vec3(texture2D(tex0, vec2(vary_texcoord0.s+kern[horizontalPass%2].t,vary_texcoord0.t+kern[horizontalPass].t)));
|
||||
color += weight.z * vec3(texture2D(tex0, vec2(vary_texcoord0.s-kern[horizontalPass%2].t,vary_texcoord0.t-kern[horizontalPass].t)));
|
||||
|
||||
frag_color = vec4(color.xyz,1.0);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseMap;
|
||||
uniform sampler2D diffuseMap;
|
||||
uniform float minLuminance;
|
||||
uniform float maxExtractAlpha;
|
||||
uniform vec3 lumWeights;
|
||||
@@ -42,7 +42,7 @@ VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 col = texture2DRect(diffuseMap, vary_texcoord0.xy);
|
||||
vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
/// CALCULATING LUMINANCE (Using NTSC lum weights)
|
||||
/// http://en.wikipedia.org/wiki/Luma_%28video%29
|
||||
float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) );
|
||||
|
||||
@@ -13,7 +13,7 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect tex0;
|
||||
uniform sampler2D tex0;
|
||||
uniform sampler2D tex1;
|
||||
uniform float brightMult;
|
||||
uniform float noiseStrength;
|
||||
@@ -32,7 +32,7 @@ float luminance(vec3 color)
|
||||
void main(void)
|
||||
{
|
||||
/// Get scene color
|
||||
vec3 color = vec3(texture2DRect(tex0, vary_texcoord0));
|
||||
vec3 color = vec3(texture2D(tex0, vary_texcoord0));
|
||||
|
||||
/// Extract luminance and scale up by night vision brightness
|
||||
float lum = luminance(color) * brightMult;
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* @file debugF.glsl
|
||||
*
|
||||
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2011, 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$
|
||||
*/
|
||||
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
#else
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect depthMap;
|
||||
|
||||
VARYING vec2 tc0;
|
||||
VARYING vec2 tc1;
|
||||
VARYING vec2 tc2;
|
||||
VARYING vec2 tc3;
|
||||
VARYING vec2 tc4;
|
||||
VARYING vec2 tc5;
|
||||
VARYING vec2 tc6;
|
||||
VARYING vec2 tc7;
|
||||
VARYING vec2 tc8;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 depth1 =
|
||||
vec4(texture2DRect(depthMap, tc0).r,
|
||||
texture2DRect(depthMap, tc1).r,
|
||||
texture2DRect(depthMap, tc2).r,
|
||||
texture2DRect(depthMap, tc3).r);
|
||||
|
||||
vec4 depth2 =
|
||||
vec4(texture2DRect(depthMap, tc4).r,
|
||||
texture2DRect(depthMap, tc5).r,
|
||||
texture2DRect(depthMap, tc6).r,
|
||||
texture2DRect(depthMap, tc7).r);
|
||||
|
||||
depth1 = min(depth1, depth2);
|
||||
float depth = min(depth1.x, depth1.y);
|
||||
depth = min(depth, depth1.z);
|
||||
depth = min(depth, depth1.w);
|
||||
depth = min(depth, texture2DRect(depthMap, tc8).r);
|
||||
|
||||
gl_FragDepth = depth;
|
||||
}
|
||||
@@ -27,8 +27,6 @@ uniform mat4 modelview_projection_matrix;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
|
||||
uniform vec2 delta;
|
||||
|
||||
VARYING vec2 tc0;
|
||||
@@ -45,7 +43,7 @@ void main()
|
||||
{
|
||||
gl_Position = vec4(position, 1.0);
|
||||
|
||||
vec2 tc = (position.xy*0.5+0.5)*screen_res;
|
||||
vec2 tc = (position.xy*0.5+0.5);
|
||||
tc0 = tc+vec2(-delta.x,-delta.y);
|
||||
tc1 = tc+vec2(0,-delta.y);
|
||||
tc2 = tc+vec2(delta.x,-delta.y);
|
||||
|
||||
@@ -32,7 +32,7 @@ out vec4 frag_color;
|
||||
//#extension GL_ARB_texture_rectangle : enable
|
||||
|
||||
uniform sampler2D glowMap;
|
||||
uniform sampler2DRect screenMap;
|
||||
uniform sampler2D screenMap;
|
||||
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 vary_texcoord1;
|
||||
@@ -40,5 +40,5 @@ VARYING vec2 vary_texcoord1;
|
||||
void main()
|
||||
{
|
||||
frag_color = texture2D(glowMap, vary_texcoord1.xy) +
|
||||
texture2DRect(screenMap, vary_texcoord0.xy);
|
||||
texture2D(screenMap, vary_texcoord0.xy);
|
||||
}
|
||||
|
||||
@@ -31,14 +31,13 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect diffuseRect;
|
||||
uniform sampler2D diffuseRect;
|
||||
|
||||
uniform vec2 screen_res;
|
||||
VARYING vec2 vary_tc;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 col = texture2DRect(diffuseRect, vary_tc*screen_res).rgb;
|
||||
vec3 col = texture2D(diffuseRect, vary_tc).rgb;
|
||||
|
||||
frag_color = vec4(col.rgb, dot(col.rgb, vec3(0.299, 0.587, 0.144)));
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ out vec4 frag_color;
|
||||
#define frag_color gl_FragColor
|
||||
#endif
|
||||
|
||||
uniform sampler2DRect screenMap;
|
||||
uniform sampler2D screenMap;
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = texture2DRect(screenMap, vary_texcoord0.xy) * vertex_color;
|
||||
frag_color = texture2D(screenMap, vary_texcoord0.xy) * vertex_color;
|
||||
}
|
||||
|
||||
@@ -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