Jump to content
  • Advertisement

Archived

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

lekki

camera

This topic is 5286 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

Hey I write my own raytracer and i think how to calculate ray direction vector from calcuted projection matrix i model view matrix. i use opengl to calculate these matrix. P = [x, y, z, 1]T P’ = [x’, y’, z’, 1]T = Mmodelview*P. P” = [x”, y”, 1]T = Mprojection*P’. i use glGet() to obtain these matrix. Give me a hint how to find a ray direction for given point (x, y). lekki

Share this post


Link to post
Share on other sites
Advertisement
Look into the gluUnproject(...) function. If you give it a viewport coordinate, such as [0,0] it will return the location of that point in the scene. From there you can calculate the direction of the ray by making it travel along the vector formed by subtracting the eye point from the newly unprojected point.

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!