? Consuming light rays after striking a surface...

I’m trying to learn the very basics of lighting now, and I have a diffuse light in one corner of a room, a large sphere in the middle of the room, and another object in the corner oposite the light source. The last object should not be getting any direct light from the source due to the sphere blocking it, but it seems to come right through and light the other object anyway. Besides this, the scene looks fine.

Thanks, as usual :slight_smile:

OpenGL doesn’t light with “rays”, hence there is no blocking. What actually happens is each vertex on the geometry is evaluated against the lights in the scene and coloured approriately.

Hence, both the sphehe and the other shape are being illuminated, because they are both evaluated.

Shadow Volumes (google for it) seems to one way people are getting round this (see Xith3D). I imagine there are several otherways.

Anyone else have any suggestion on how this can be done?

The two current favorite methods of doing shadows are shadow volumes and shadow mapping. Both of which eat fillrate like crazy and require various bits of voodoo to make them robust.

You can find detailed explainations all over the net, try starting with nVidia’s website.

http://developer.nvidia.com/object/robust_shadow_volumes.html

http://developer.nvidia.com/object/hwshadowmap_paper.html

Are shadows the only way to accomplish what my original question asks? I’m playing Gothic 2 right now, and they don’t have fancy shadows in the game, yet, when there is a lamp out in the street it doesn’t shine through the walls of the shops and into the interiors.

Judging from screenshots, Gothic uses lightmaps for most of its lighting. Theses are usually pre-calculated at level compile time which means you can do lighting based on ray casting or whatever fancy method you want (like radiosity). The downside being that they’re totally static so neither the lights or the geometry can change.