Archived

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

dummy ramy

ray tracing for a sphere

Recommended Posts

i''ve created a sphere in openGL code. i want it to reflect the scene using ray tracing (not mapping). if somebody knows a good tutorial (with code examples preferred) i will be grateful. dummy ramy :}

Share this post


Link to post
Share on other sites
opengl cannot raytrace => you have to do it yourself, without opengl, or with some very complicated work, tons of expirience, newest hw, newest extensions, etc, and you get rich.. well, not you, as you''re the inventor, but some rich dude above you who claims to be the inventor of what you did:D

nope, no real simple way..

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
Most likely your sphere is going to be tessellated, so you'll have tons of little polygons that look like a sphere. Be aware that raytracing is inherently slow (it shoots a ray for every pixel in your window 1024x768 = 786432 pixels). Also be aware that 1.) Raytracing is not for newbies (there's a lot of complicated math depending on which illumination model you use, not to mention the actual ray walking algorithm) and 2.) Raytracing is meant to create single high quality images, not for real time (i.e. CG cut scenes rather than actual gameplay).

davepermen was correct in saying OpenGL does not do raytracing. The only thing OGL will do for you is display the image on the screen after you've rendered it. For this topic, I always suggest a course site from a class I took in college. This course has lectures and labs on raytracing (NOTE: this is a university course website, so the content may not be available all the time when the course is in session).



---
K-1 Productions: Come visit us
here.

[edited by - K-1 on July 8, 2003 7:26:45 AM]

Share this post


Link to post
Share on other sites
first, i want to thank you for answering me.
second, in what way can i reflect the scene with my bubble or bubbles in opengl, in a way that the bubbles will reflect also the other bubbles in the scene or other objects?

Share this post


Link to post
Share on other sites
There really is no easy way to do this. And any way that is figured out will probably be very slow (multiple rendering passes). You could render the scene from each bubble''s perspective, at the angle of a reflected ray from your current camera position/direction. The problem with this is bubbles early in the rendering process will not see the reflections of bubbles later in the process. I think you''d be better off just skipping the reflection stuff.

---
K-1 Productions: Come visit us here.

Share this post


Link to post
Share on other sites
Umm actually there is a pretty fast way to do it. (Not raytracing) In "Game Programming Gems II," theres an article called, "Rendering Distance Scenery With Skyboxes." Don''t let the name fool you, it actually uses a cubemap and renders the scene onto an object. If you make the cubemap texture an enviroment texture and add some alpha to it, it should produce what you are after.

-UltimaX-

"You wished for a white christmas... Now go shovel your wishes!"

Share this post


Link to post
Share on other sites