Advertisement

OpenGL Shadows

Started by March 09, 2002 12:06 PM
11 comments, last by NasMan 22 years, 11 months ago
Hello, I''ve been playing with OpenGL for a while. I''ve never really looked at doing shadows before. I''m trying to figure out how to implement a shadow of a sphere. I''ve looked at several different examples of doing shadowing, and it seems fairly straight forward...but I''m still confused on how to do it with spheres. I''ve found not example code of shadowing spheres. Does anyone know of any such examples (code)? Thanks
Shadowing a sphere is the same problem as shadowing a cube or a torus or an aircraft or whatever geometry.
once you understood the algorithm, it''s up to you to project the geometry.

btw, what kind of shadow are you talking about ? (there exist many algorithms)
Advertisement
nVidia''s Developer Site has got just about every technique out there listed (source code + docs included) for shadowing.
I''ve got a planet with a moon. I want to have the moon shadow move across the planet...
For sphere-to-sphere shadows, if spheres do not intersect I'd recommend projective shadows.

It's fast, it's easy, it does not need the stencil buffer (thus being HW accelerated on 100% of graphic cards), it includes smooth shadowing, and it works whatever the light is (eg works both with point lights or directional lights) wherever the viewpoint is (which is a big problem with stencil volume shadows).

So, what are you waiting for ?!

Edited by - vincoof on March 11, 2002 10:37:08 AM
quote:
Original post by vincoof
For sphere-to-sphere shadows, if spheres do not intersect I''d recommend projective shadows.

It''s fast, it''s easy, it does not need the stencil buffer (thus being HW accelerated on 100% of graphic cards), it includes smooth shadowing, and it works whatever the light is (eg works both with point lights or directional lights) wherever the viewpoint is (which is a big problem with stencil volume shadows).

So, what are you waiting for ?!



Umm... please, could you give some URL or some reference to information how the projective shadows are done?

Have a nice day,



---
Never trust a Troglotroll.
---Never trust a Troglotroll.
Advertisement
http://projectfy.cfxweb.net

We got one tutorial on the topic....
Just check under files....comes with source!

Take Care!

- -- ---[XaOs]--- -- -

[ project fy ]
- -- ---[XaOs]--- -- -[ Project fy ||| CyberTux ]
XaOs: which tutorial please ?

navigator: I''m sorry but all my links are broken
For your case, I would recommend stencil volumes. While it is very complex to do good stencil volumes for arbitrary geometry, it is extremly easy to do them for a sphere. What a nice coincidence you have a planet
Yann: stencil volumes gives problems depending on the point of view, and more important it needs to have hardware stenciling (which is unfortunately _not_ implemented on all cards, and not on any color depth).
Even though I admit it''s easier with spheres, it''s still (i) harder and (ii) slower than projective shadows.
And it does not include smooth shadowing (which is very important to show penombras on eclipses).

Mind me, I love stencil shadows. I''m using them for my game. But that''s not the right choice for NasMan''s application.

This topic is closed to new replies.

Advertisement