Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Lars Birkemose, posted on May 17, 2001

Image Description, by Lars Birkemose

Heres a very rough demo I made a couple of years ago, showing realtime shadows. This is old, and parts of the code might be ugly or just plain buggy :)

The demo uses tesselation to calculate the shadows. I was in the progress of writing a simpler (and much faster) tesselation than what OpenGL supplies, as the tesselation takes much of the rendering time, but I never got time for it.

The dark shadows from the internal light is only partially calculated, ie no shadow is cast on the wall. And no shadows are calculated from the light in the corner.

The EXE and sourcecode (250KB) for BCB5 can be downloaded from

To navigate and alter settings

Cursor Move around
+/- Sun intensity
L Toggle lights
S Toggle shadows
Z/X Sidested
F Toggle fog

Shift+Cursor Move slowly around
Shift +/- Light intensity

Ctrl+Cursor Head tilt and height

Alt+Cursor Time of day
Alt +/- Texture offset

Hope this is of some interrest


Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

May 17, 2001, 03:11 PM

Nice pic, it does show its' age a little, still very nice.



May 17, 2001, 03:15 PM

I don't really see the point of this image either ..just kidding :)

Does this work for arbitrary geometry or is it just with planar rectangles? I am assuming you are projecting the geometry. But, can you maybe tell us more about how you do it?

This is good work.. Shadow casting is definitely one of the harder problems to solve in computer graphics (the general case anyway). I know because I am working on a shadow algorithm for terrain.

Also, how did you calculate the ephemeris (sp?) model for changing your current time of day. The path of the sun seems to be accurate.

Nice job!


May 17, 2001, 03:34 PM

Det ser godt ud! (in english: Nice pic =)

How do you clip the projected shadow polygons to the other geometry (floor etc)?


May 17, 2001, 04:47 PM


Nice work, I think it would look nice in a game. One where you could speed up time and see the shadows of buildings move around. A simulator of some sort.

The light cast on the two wooden thingies in the demo is also vissible on the backside, shouldn't it be possible to just check if they are back facing?

The Wolf

May 17, 2001, 06:37 PM


Lars Birkemose

May 18, 2001, 04:36 AM

The original idea was to make a shadow/lighting system fast enough to work in a game, ala that Blade of xxxx game that just has been released.
This was when P200 and Voodoo2 was real hot ;o)
Shadows and light works by projecting triangles onto a plane, so it basicly supports any geometry. By means of OGL tesselation, the projected quads are added or subtracted, and finally clipped to the outline of the receiving plane.
Thats basicly it.
Obviously a lot of optimization could be done, especially the OGL tesselation is slow.

If the sun moves in a "real way", its pure luck... taken from my own livingroom....

What I like about this myself, is that I find the balance between CPU and graphics adaptor load pretty good, ie the system will not cloak up the graphics pipeline, where most games have their bottlenecks.



May 18, 2001, 09:47 AM

228mb? tror du vi alle har adsl?

nå, guitaren er nu meget pæn :)


May 18, 2001, 11:17 AM

Hey, man... cool shadow demo
Of couse, tesselation could be a bit slow on today's computers, and you could probably get much better results with projective textures and shadow mapping anyway. But for software it's very good :-)

Hey, is it just my computer or do the shades of the wall make it loko "dirty"? Why is that? Was this in 256-color mode?


This thread contains 8 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.