Here's an image from my latest ray tracing project. The model reflects its surrounding environment via recursive ray reflections. Im going to add refraction if i have time so the model will look like glass.
Here's an image from my latest ray tracing project. The model reflects its surrounding environment via recursive ray reflections. Im going to add refraction if i have time so the model will look like glass.
very awesome anywhere where we can download a demo to see it in action?
Looks good....I bet that takes quite a bit of time to compute.
Im actually just handing it in today and it looks like about %50 of the class couldent build a ray tracer , so posting source right now is a little risky. Perhaps after ive received a mark for itOriginally Posted by jverkoey
Also, there is no input file or anything yet. It just takes a model name as a command line arg and all the lights, postitions, camera. etc. is hard coded (dont ask why, they wanted it that way). If i have time i'll change it so the user can specify a param file with any number of models and lights.
yup, over a minute to render that model (~3300 polys, 3 lights) on my lap top. Thats with pretty much no optimization though (just not enough time for something that wasnt required) The only thing im doing to speed it up is dividing the space into 2 half spaces and only checking rays against polys in that half space.Originally Posted by Bubba
Thanx for the feedback guys. =]
Hey wow, this has not received enough replies. Good friggin work man, it's aesthetically pleasing, and a difficult undertaking.
Keep it up. i'd love to see the source, because to be honest I have no clue where I'd even begin in writing something like that, because my graphics rendering knowledge is not that advanced.
EDIT:
so, like, what's the paradigm here? Are you using an API like OpenGL? If so, are you doing this with fragment programs (erm, pixel/vertex shaders, im not totally sure on the correct terminology here). I'd just like to get a better idea of how you did the project.
thanks.Originally Posted by Silvercord
I am using OpenGL to simply render the raw data after it has been calculated (pixel data) then i save the image to a .ppm file. As far as the actual ray tracing goes, everything is written from scratch, no lib's or api's.
The idea is to cast a ray (define a vector) from the camera/eye position through each pixel on the raster plane. Then i find where that ray (vector) intersects the model. I then define a new ray (vector) from that point in the reflection direction (vertex normals are interpolated across the triangle and a reflection formula based on actual physics is used). This is done recursuvely until the ray intersects the surrounding evironment. The texture pixel color of intersection is then used as the ambient lighting term in the phong lighting calculation. Phong shading is calculated for each pixel based on the reflected ambient term and the diffuse and specular terms from the light sources (3 in this example).
Heres a good overview if your interested in some of the finer details of ray tracing.
http://www.siggraph.org/education/ma...ce/rtrace0.htm
Awesome - good work. I'd like to see the source too, when those classmates of yours are done failing .
Do not make direct eye contact with me.
How are the interactions handled when a ray hits a surface in your program? are they simply reflected, or does your program take into account a loss of energy or something like that?
How long did it take to write, and what program are you in in school? A computer science major?
There is no energy associated with the rays, they just keep on traveling untill they hit something. What your suggesting with the energy is something called "Radiosity" which is the best way to get a realistic render though it is exceptionally slow. In Ray tracing there are constants defined to weight the ambient, diffuse, and specular components. So basically, ray tracing will "fake" that part of the physics.Originally Posted by Silvercord
Unfortunaltley i only had a few days (about 5 in total) to write it which means the code is ugly with minimal documentation. Also i realized i basically did the entire thing backwards (kinda hard to explain but Im essentially negating and inverting everything then rendering the image from bottom up to get the same effect as doing it properly) This happend due to a common approach taken in comp. sci. known as the "Crap, i have no time, i just need to make it work..." approach.
Im a Comp. Sci. major in my third year, though this graphics course is a 4th year course.
Here's another ray trace of a crappy model i made with an amazing modeling program called "Teddy". Im gonna post something in the GD forum about teddy so everyone can enjoy so check it out there.
Radiosity isn't yet truly realtime though, is it?Originally Posted by Perspective
Do not make direct eye contact with me.
No, there isnt fast enough hardware to support realtime radiosity rendering. The resulting images are pretty impressive though.Originally Posted by Lurker
Very true.Originally Posted by Perspective
Do not make direct eye contact with me.
Can I see one? :d
Dude, don't bump ancient posts.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie