[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] shadow demo



On Fri, Mar 14, 2008 at 11:06 AM, Ian Mallett <geometrian@xxxxxxxxx> wrote:
> On Thu, Mar 13, 2008 at 4:12 PM, René Dudfield <renesd@xxxxxxxxx> wrote:
>
> > 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.
> >
> Cool!  This is a lot clearer.  I noticed, however, that the shadows were
> completely opaque and, in the landscape mode, the landscape looked solid
> except that the triangle sides looked like wireframe...
>

Ah ok.

try changing these lines:


        #render all-----------------------------------
        # we disable culling so the objects can be drawn correctly.
        if not LOAD_MESHES:
            glDisable(GL_CULL_FACE)

        renderObj(objID,incrObjRotY)
        renderFloor(floorID)
        if floorID2:
            renderFloor(floorID2)

        # reenable culling.
        if not LOAD_MESHES:
            glEnable(GL_CULL_FACE)
            glCullFace(GL_BACK)
        #render all-----------------------------------


I found out that the glutTeapot actually has a bug (mentioned on the
man page)!  The polygons are wound backwards to how opengl does it by
default.  So disabling the culling is only needed for the teapot.

Does that fix it for the terrain?
http://rene.f0o.com/~rene/stuff/shadows_rd.zip

Notice how when the shadows grow long they are really blocky?  That's
the main problem with the shadow mapping technique, that higher res
shadow maps will help with... but will never really solve completely.
Still they are pretty quick, and easy to use :)

Also have a look with the wire frame tea pot :)  it shows lots of gaps
in the shadow.  Not a very good tea pot... it would never work for
making tea - too many holes.