Jump to content
  • Advertisement

Archived

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

lekki

gluUnProject & ray together

This topic is 5217 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!