PDA

View Full Version : Vector through poly intersection...



AmzBee
05-31-2011, 06:23 PM
Hi, after getting light mapping to work correctly, I looked at shadow mapping, and thought to myself, surely if I already have the location of each lumel, then perhaps I could do some collision detection to see if the lumel is obstructed by any of the polygons too to give a nice shadowing effect.

Does anyone know if this method is possible, and if so, how would i check to see if a line from a lumel to a single light intersects with a polygon.

Thanks in advance.

Aimee.

yoyonel
06-01-2011, 01:42 AM
Hi :)

"could do some collision detection to see if the lumel is obstructed by any of the polygons" it's already happen with depth shadow map.
The problem is not the intersection himself but what the lumel represent.
Lumel is just a frustum of light or shadow who say: "my center is obstructed by a polygon" but we don't know a this time what kind of polygon intersect and more precisely the edges of this polygon.
The shadow-edges are the most important information for a good shadow effect. Maximise this information it's the way (not the only but a good :-)) to have a nice shadow rendering.

YoYooOoOOo

ps: sorry for my english :-D

AmzBee
06-01-2011, 08:38 AM
I don't really understand. I guess what I'm going have to end up doing is projecting a ray, and do some testing to see weather it intersects with any polygon in the scene, though I want to try and avoid full blown ray-tracing if possible.

Does anyone have any other ideas on the subject?

http://xpod.be/ray_intersect.jpg

Aimee.

AmzBee
06-09-2011, 04:23 PM
Please, if anyone else has any thoughts on the matter, I'd really appreciate it.

Aimee.

_arts_
06-10-2011, 01:02 AM
What you're trying to do is some kind of shadow ray-tracer. It will be very slow. Shadow mapping is based on such thoughts but do not do it pixel per pixel. Instead it renders the scene from light view, then camera view, and do some comparisons to quickly know what fragments are lit or not.
Google "opengl shadow mapping" for example.

AmzBee
06-10-2011, 02:24 AM
How about a more straight forward problem then, how would I tell if a face is looking at a light (perhaps even without knowing the winding order of the vertices)?

Alfonse Reinheart
06-10-2011, 12:45 PM
perhaps even without knowing the winding order of the vertices

Without a winding order, then you don't know what the front of the face is. That effectively means that the face is always facing the light. Or that it is never facing the light. Or that the face doesn't exist, because it has no orientation.

If you have a normal, then the face does have an orientation. And the test is simply N dot L: if this is negative, it's facing away from the light.