OpenGL and Qt: part III Ray casting

An update. I found that the camera doesnt really act the way I wanted it to; it seems to just rotate objects around the y-axis regardless of where i pan and ive been stuck for a week now trying to implement a camera that works the way I want it to.

codeyunowork.jpg

I have connected up the viewer to the raytracer so you can just move the camera into place and press a render button to render the scene with the current view, it is on a separate thread so it doesnt block the GUI.

Also, I have implemented ray casting which is usually used for selecting things. It works pretty much like when shooting rays out from the camera in ray tracing. Its useful for debugging the bounding volume hierarchy data structure you can press keys to change the depth at which to draw the bounding boxes and to check that the intersection routines actually work.

You can see below the red dot representing the intersection point and the green line the ray. The blue boxes are the bounding volumes for the mesh.

 

viewport-raycasting.png
Ray casting

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s