PDA

View Full Version : Ray Tracing, Lighting, and Materials



dangerfan
01-09-2005, 03:50 PM
Hello,

I'm currently attempting to write a Ray Tracer using OpenGL. I have been reading the Red Book, as well as other sources to help me figure this all out. I'm a little confused though. I've defined a spotlight to use, and I'm using Specular lighting to simulate a shiney material. What I'm confused about is whether or not I should be using Diffuse or Ambient light as well. I've been trying out various combinations, but I can't seem to come up with anything that gives me the really shiney results I'm looking for. Also, does OpenGL do the calculation of the reflections for you? Or do you have to specify the ray and determine the color yourself? Any help is appreciated!

Jan
01-10-2005, 01:47 AM
OpenGL won´t do any raytracing for you, it uses rasterization.

Jan.

dangerfan
01-10-2005, 02:20 PM
So are you saying it's impossible to do ray tracing with OpenGL (highly doubtful)? Or are you just saying that OpenGL will not handle the calculations for me and I have to write functions to do all that work?

I didn't think OpenGL would do that, I was just looking for some clarification.

Thanks!

ZbuffeR
01-10-2005, 03:25 PM
You need some more info about 3d computer graphics.

Raytracing is :
- a way to simulate real light by using reverse path of the light (from observer to lights, bouncing on surfaces and going through deep semi opaque materials such as fog)
- each pixel of the scene become a single 'reverse photon', tests for every surface it can bounce on, then is reflected, then loop until going to the void or hitting some iteration limit.
- scene complexity is more linked to number of pixels and number of reflections than number of graphic primitives
- the type of computations involved is not well suited to hardware acceleration (only hardware example I am aware of : Art Render Pure (http://www.art-render.com/products.ihtml?page=pureoverview) )

OpengGL is NOT raytracing. It is scanline rendering. Much more suited to hardware pipeline parallelism.
- each triangle is drawn on screen. No reverse ligthpath, it is more like painting.

A more in-depth comparison of rendering techniques (http://www.daylongraphics.com/products/leveller/render/techniques.htm) .

Of course, you can do some part in OpenGL and some in software ( example (http://www.xl3d.com/xl3d/raytracing.htm) ), or even do some super-simple raytracing (http://www.geocities.com/vmelkon/glsl_raytracing.html) thanks to GL Shading Language.
Most of the time the best way is still to fake raytrcing, thanks to shadow mapping/stencil shadows and using cubemapped reflections : example here, news dated 31.12.04, have a look at the video :
http://frustum.org/3d/

I hope I made all that clearer.

dangerfan
01-10-2005, 04:14 PM
*CLICK!* Thanks guys, you've clarified things for me.