gluUnProject & ray together

Started by
2 comments, last by lekki 20 years ago
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
lekki
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]
Maciej Sawitus
my blog | my games
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
lekki
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.
Maciej Sawitus
my blog | my games

This topic is closed to new replies.

Advertisement