On Mar 13, 2008, at 4:12 PM, René Dudfield wrote:
Hello,
I found some things to improve the quality of the shadow mapping, and
written in more comments.
http://rene.f0o.com/~rene/stuff/shadows_rd.zip
It also by default uses a polygon as a floor, and a teapot from GLUT.
There's a constant at the top of demoShadows.py which changes this.
However the objects you draw are a very simple part of this demo, they
could be anything really. The complexity comes from the other code.
I think maybe the glPolygonOffset call may have something to do with
it... but haven't managed to get the call to do anything. I tried
glScale, and glTranslate, but that seems to be wrong - and in one
paper it says you can't use translate/scale but have to use
glPolygonOffset.
The main thing which improved quality for me was to use
GL_DEPTH_COMPONENT32 instead of GL_DEPTH_COMPONENT with the
glTexImage2D call. GL_DEPTH_COMPONENT lets the driver pick the
resolution (which for this Imac as only 8 bit).
I haven't managed to increase the resolution of the shadow map
successfully.
I believe you can use FBOs for that since they can have a higher res
than the screen. Basically you render the shadow as a high-res texture
and apply to the scene.
If you want real-time soft shadows (i.e., blurred) then you best bet
is probably a custom shader, though you might be able to get a decent
approximation by applying a rendered texture multiple times at
different scales and opacities. With a shader you'll have ultimate
control, however.
-Casey