Cleanup, correcly filter unimportant shadow silhouettes
This commit is contained in:
@@ -54,16 +54,16 @@ void main()
|
||||
vec3 n1 = cross(p0.xyz - p1.xyz, n1a - p1.xyz);
|
||||
vec3 lightDir = p0.xyz - lightPos.xyz;
|
||||
vec3 lightDir2 = p1.xyz - lightPos.xyz;
|
||||
vec4 p2 = shiftNear(p0);
|
||||
vec4 p3 = shiftNear(p1);
|
||||
// test if the edge is part of the silhouette
|
||||
// that is, if the slopes of the faces connected to the edge are in
|
||||
// that is, if the normals of the faces connected to the edge are in
|
||||
// "different directions" wrt the light direction
|
||||
if (dot(n0, lightDir) * dot(n1, lightDir) <= 0 &&
|
||||
if (p0.w==1 && dot(n0, lightDir) * dot(n1, lightDir) <= 0 &&
|
||||
(dot(lightDir, lightDir) < ru2 || dot(lightDir2, lightDir2) < ru2))
|
||||
// using <= rather than < seems to get rid of overlapping shadow
|
||||
// artefacts
|
||||
{
|
||||
vec4 p2 = shiftNear(p0);
|
||||
vec4 p3 = shiftNear(p1);
|
||||
if (dot(n0, lightDir) < 0)
|
||||
{
|
||||
vec4 sp[4] = {p1,p0,p3,p2};
|
||||
|
||||
Reference in New Issue
Block a user