Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#ActualErik Rufelt

Posted 05 May 2013 - 06:04 PM

Pretty much did exactly what you said. Definitely fixes the self shadowing issue. However, the shadow shrinking produces a shadow with a jagged, per-polygon edge. So ironically it really just moves the same jagged artifacts off the self-shadows and puts them on the regular shadows. :\

 

Removing lighting from any edges that touches the shadow instead is an alternative, to grow the shaded part on the caster instead of shrinking the volume, but it's usually a bit more expensive to implement, depending on what rendering techniques you use..

 

For convex models like the sphere the easiest alternative is of course to not use self-shadowing on the caster, but that won't work on concave models where you want self-shadowing.

 

Another alternative, since the problem only occurs on the shadow caster, is to fix it by adding the lighting on edge polys on the caster, emulating shrinking the volume only on the caster. Run an extra lighting-pass on the polygons that are at the shadow edge, selected using the same algorithm as when constructing the shadow volumes (geometry-shader?).

So basically draw the model triangles for the caster, as for a lighting-pass, but without stencil test, and with a geometry shader that only outputs the triangles where the triangle-normal faces away from the light, and at least one vertex-normal faces the light. This will discard all polys except those that you know are in the shadow volume but have at least one normal that is facing the light. Should be relatively cheap.

 

It all depends on what artifacts or deviations from "correct" shadows are acceptable. The problem with smooth normals and exact silhouette shadows is that the silhouette is an approximation of a smooth surface, and the interpolated normals attempts to hide that fact. For perfectly hard shadows, the jagged edge on the sphere caster is actually correct.

Another way that might solve some things is by shrinking the silhouette inwards by moving the vertices toward the center instead of removing vertices, which in some circumstances can probably solve the problem, but of course has the potential to bring new artifacts.


#1Erik Rufelt

Posted 05 May 2013 - 05:56 PM

Pretty much did exactly what you said. Definitely fixes the self shadowing issue. However, the shadow shrinking produces a shadow with a jagged, per-polygon edge. So ironically it really just moves the same jagged artifacts off the self-shadows and puts them on the regular shadows. :\

 

Removing lighting from any edges that touches the shadow instead is an alternative, to grow the shaded part on the caster instead of shrinking the volume, but it's usually a bit more expensive to implement, depending on what rendering techniques you use..

 

For convex models like the sphere the easiest alternative is of course to not use self-shadowing on the caster, but that won't work on concave models where you want self-shadowing.

 

Another alternative, since the problem only occurs on the shadow caster, is to fix it by adding the lighting on edge polys on the caster, emulating shrinking the volume only on the caster. Run an extra lighting-pass on the polygons that are at the shadow edge, selected using the same algorithm as when constructing the shadow volumes (geometry-shader?).

So basically draw the model triangles for the caster, as for a lighting-pass, but without stencil test, and with a geometry shader that only outputs the triangles where the triangle-normal faces away from the light, and at least one vertex-normal faces the light.

So basically discard all polys in the geometry-shader except those that you know are in the shadow volume but have at least one normal that is facing the light. Should be relatively cheap.


PARTNERS