Skip to main content
GameDev.net gamedev.net
🔒 Locked

Shadows

Started by Poltras Sep 7, 2000 at 3:27 PM 2 replies 300+ views
Original Post
Poltras
Poltras
Is there good algorithm to make shadows from objects to objects? By good I mean fast and effective, I don''t mean simple. I''m working with GL, as some may know, but I''m still open to DirectX code since I''m mainly seeking algos...
Programming is:
A.The art of debugging a blank sheet of paper (or an empty file).
B.A pastime similar to banging one's head against a wall, but with fewer opportunities for reward.
C.The most fun you can have with your clothes on (although clothes are not mandatory).
Now I know what I'm made of, and I'm afraid of it...
Eric
Eric
Here''s a method that uses the stencil-buffer:

Shadow Volumes
Friday13
Friday13
I''m not sure if anyone''s still interested, but,
anyway, just a thought (for D3D):
1. suppose you color-code each triangle (or each object - depends on your needs) with a distinctive color;
2. then you render all ''to the light'' (i.e. you put your camera at your light source) flat-shaded with these color-code values;
3. then you render all flat and color-coded to ''normal'' view using this light-view image (from the previous pass) as a projective texture (you will have to calc tex.coords accordingly (or use appropriate DX7 features) with D3DTOP_SUBTRACT operation. Thus, all parts ''visible'' to the light source get zero color, and all invisible ones get some non-zero value. In other words, all non-zero pixels will belong to the image of your shadow.
4. Then, there''s a number of ways how to bring this multi-colored shadow image to a single color (dark gray, preferrably). This maybe either color-keying of a color-space (which is not supported by Nvidia chips, unfortunately) or you may do some
tricks blitting the whole thing directly to Z-buffer, in which case the blue components get directly to its (z-buffer''s) stencil part (this is weird, I know, but it works on my GeForce2)

Sorry for giving just a raw idea, haven''t had no time recently to code it up :-(

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.