SH-2244 Fix for artifacts with L&S enabled when using core profile.

meow-7.2.2
Dave Parks 2011-09-22 00:33:27 -05:00
parent a2d08a6d80
commit e7b743d80b
14 changed files with 14 additions and 16 deletions

View File

@ -126,7 +126,7 @@ void main()
if (sa > 0.0)
{
sa = texture2D(lightFunc,vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
sa = texture2D(lightFunc,vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0);
sa *= noise;
col += da*sa*light_col[i].rgb*spec.rgb;
}

View File

@ -37,7 +37,6 @@ uniform sampler2DRect depthMap;
uniform sampler2DRect normalMap;
uniform samplerCube environmentMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2D projectionMap;
uniform mat4 proj_mat; //screen space to light space

View File

@ -107,7 +107,7 @@ void main()
float sa = dot(normalize(lv-normalize(pos)),norm);
if (sa > 0.0)
{
sa = texture2D(lightFunc, vec2(sa, spec.a)).a * min(dist_atten*4.0, 1.0);
sa = texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0);
sa *= noise;
col += da*sa*color.rgb*spec.rgb;
}

View File

@ -307,7 +307,7 @@ void main()
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
float sa = dot(refnormpersp, sun_dir.xyz);
vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).a;
vec3 dumbshiny = vary_SunlitColor*texture2D(lightFunc, vec2(sa, spec.a)).r;
// add the two types of shiny together
vec3 spec_contrib = dumbshiny * spec.rgb;

View File

@ -35,7 +35,6 @@ uniform sampler2DRect specularRect;
uniform sampler2DRect depthMap;
uniform sampler2DRect normalMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2D projectionMap;
uniform mat4 proj_mat; //screen space to light space

View File

@ -36,7 +36,6 @@ uniform sampler2DRect normalMap;
uniform samplerCube environmentMap;
uniform sampler2DRect lightMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2D projectionMap;
uniform mat4 proj_mat; //screen space to light space

View File

@ -38,7 +38,6 @@ uniform sampler2DMS depthMap;
uniform sampler2DMS normalMap;
uniform sampler2DRect lightMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2D projectionMap;
uniform mat4 proj_mat; //screen space to light space

View File

@ -313,7 +313,7 @@ void main()
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
float sa = dot(refnormpersp, sun_dir.xyz);
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).r;
// add the two types of shiny together
vec3 spec_contrib = dumbshiny * spec.rgb;

View File

@ -314,7 +314,7 @@ void main()
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
float sa = dot(refnormpersp, vary_light.xyz);
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a;
vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).r;
// add the two types of shiny together
vec3 spec_contrib = dumbshiny * spec.rgb;

View File

@ -38,7 +38,6 @@ uniform sampler2DRect normalMap;
uniform samplerCube environmentMap;
uniform sampler2DRect lightMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2D projectionMap;
uniform mat4 proj_mat; //screen space to light space

View File

@ -38,7 +38,6 @@ uniform sampler2DMS depthMap;
uniform sampler2DMS normalMap;
uniform sampler2DRect lightMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2D projectionMap;
uniform mat4 proj_mat; //screen space to light space

View File

@ -156,7 +156,7 @@ vec3 giAmbient(vec3 pos, vec3 norm)
if (spec.a > 0.0)
{
float sa = dot(ha,lnorm);
da = texture2D(lightFunc, vec2(sa, spec.a)).a;
da = texture2D(lightFunc, vec2(sa, spec.a)).r;
}
else
{
@ -171,7 +171,7 @@ vec3 giAmbient(vec3 pos, vec3 norm)
if (c_spec.a > 0.0)
{
float sa = dot(ha, gi_norm);
da = dist_atten*texture2D(lightFunc, vec2(sa, c_spec.a)).a;
da = dist_atten*texture2D(lightFunc, vec2(sa, c_spec.a)).r;
}
else
{

View File

@ -295,7 +295,7 @@ void main()
{
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
da = texture2D(lightFunc, vec2(da, 0.0)).a;
da = texture2D(lightFunc, vec2(da, 0.0)).r;
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
float scol = max(scol_ambocc.r, diffuse.a);
@ -314,7 +314,7 @@ void main()
//
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
float sa = dot(refnormpersp, vary_light.xyz);
vec3 dumbshiny = vary_SunlitColor*scol*texture2D(lightFunc, vec2(sa, spec.a)).a;
vec3 dumbshiny = vary_SunlitColor*scol*texture2D(lightFunc, vec2(sa, spec.a)).r;
// add the two types of shiny together
vec3 spec_contrib = dumbshiny * spec.rgb;

View File

@ -7472,6 +7472,7 @@ void LLPipeline::renderDeferredLighting()
//correspond to their axis facing, with bit position 3,2,1 matching
//axis facing x,y,z, bit set meaning positive facing, bit clear
//meaning negative facing
mDeferredVB->getVertexStrider(vert);
v[0].set(c[0]-s,c[1]-s,c[2]-s); // 0 - 0000
v[1].set(c[0]-s,c[1]-s,c[2]+s); // 1 - 0001
v[2].set(c[0]-s,c[1]+s,c[2]-s); // 2 - 0010
@ -7506,6 +7507,7 @@ void LLPipeline::renderDeferredLighting()
gDeferredLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f);
//gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f);
gGL.syncMatrices();
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center));
stop_glerror();
@ -7562,6 +7564,7 @@ void LLPipeline::renderDeferredLighting()
//correspond to their axis facing, with bit position 3,2,1 matching
//axis facing x,y,z, bit set meaning positive facing, bit clear
//meaning negative facing
mDeferredVB->getVertexStrider(vert);
v[0].set(c[0]-s,c[1]-s,c[2]-s); // 0 - 0000
v[1].set(c[0]-s,c[1]-s,c[2]+s); // 1 - 0001
v[2].set(c[0]-s,c[1]+s,c[2]-s); // 2 - 0010
@ -7577,6 +7580,7 @@ void LLPipeline::renderDeferredLighting()
gDeferredSpotLightProgram.uniform3fv("color", 1, col.mV);
gDeferredSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f);
gGL.syncMatrices();
mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8,
GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center));
}
@ -7585,6 +7589,7 @@ void LLPipeline::renderDeferredLighting()
}
//reset mDeferredVB to fullscreen triangle
mDeferredVB->getVertexStrider(vert);
vert[0].set(-1,1,0);
vert[1].set(-1,-3,0);
vert[2].set(3,1,0);
@ -7632,7 +7637,6 @@ void LLPipeline::renderDeferredLighting()
gDeferredMultiLightProgram.uniform1f("far_z", far_z);
far_z = 0.f;
count = 0;
mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3);
}
}