Archived

This topic is now archived and is closed to further replies.

lekki

gluUnProject & ray together

Recommended Posts

hello What do you think about my idea? i write raytracer, so i need to find ray direction for point (x,y). My plan is a) use gluUnProject to obtain v= (x'', y'', z'') coordinates for (x, y) b) create ray vector direction ( v - eye ) c) v.Normalize() So, send me some suggests, If you know that will not work, TELL ME! lekki

Share this post


Link to post
Share on other sites
What some ray-tracers do in order to optimize "first ray intersection" is to render the whole scene to depth buffer, then fetch from it z values and some id of hit triangle - this way you know what each "screen pixel ray" intersects first.
This doesn't work however with objects like spheres, b-splines etc...
Also, this method won't speed up second or higher intersection.

What you are proposing could work, but is rather not wise idea, since gluUnProject costs a lot.

[edited by - MickeyMouse on April 6, 2004 5:31:02 AM]

Share this post


Link to post
Share on other sites
Hi

I dont want to use glUnProject after gl raytracing, i need it before to calculate camera and world setting. I wrote my own intersection.


lekki

Share this post


Link to post
Share on other sites
It''s still not best idea to make OpenGL handle your matrices (in OpenGL pojection and modelview ones) but do the whole remaining thing on your own. You better do it all by yourself. OpenGL won''t speed you up at all that case anyway.

Share this post


Link to post
Share on other sites