I saw some people asking about how to do shadows in Java3D
well, how about we take some ideas from ray tracing?

you have all of your objects in the scene
what you could do is take the geometries of all of your objects (the vertices
and such)
and trace rays back to your light sources and see if anything intersects on the
way
if it does, then you shadow.

that is quite a slow way to do it =)

for other ways, you can precompute where shadows are supposed to lie by using
shadow maps.
This is where you all ready know where you lights are, and your static objects,
so find those shadows
(e.g.)
you have a scene that is in a mall.  about 500 of the objects are static and do
not move. about 50 other objects are not static and move
you can precompute the shadows for the 500 objects and store those, or color the
vertices of where they would shadow
say, a bench on the floor.  You would color the floor in certain places with the
shadow color.  You can use the same ray tracing ideas of getting all of the
vertices of your floor and tracing them to the light source, when you intersect,
you shadow. You can then interpolate colors between vertices, or whatever.
then, for the 50 objects that are not static, cast shadow rays for them each
time you render.  You could speed this up by checking to see what objects
actually move, and if they need to shadow. things like that
good books for doing raytracing

Glassner, Intro to Ray Tracing

or, do a web search, there is a lot out there on doing ray tracing techniques.
Just rememebr, you are not tracing the whole scene, just those objects.  For
most of those objects, doing the intersections will be quite fast, especially
with bounding boxes or spheres

with a scene of 550 objects, and testing an intersection (just an intersection,
no other calculations) would be pretty fast

Hope that helps a little
Scott


Scott Decker
Research Scientist
Pacific Northwest National Labs
[EMAIL PROTECTED]

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to