Submitted by , posted on 30 May 2001



Image Description, by


I started work on this raytracer project a while ago, but just recently purchased 'Computer Graphics -Principles and Practice' - stonking good book (if not slightly overwhelming!!) But I had heard that raytracers were easy to program and looked nice, so I dove in. The book had the intersection formulas for a couple primitives (plane+sphere+polygon) and so I coded those in.

Lighting is just basic phong lighting (N dot D + specular) and in the big purple picture you can see and example of a bug I was experiencing, in which the negative values (Resulting from the phong equation) were creating a very bright bump in the centre, which was odd, because I only had two lights!! But I solved the problem, and the picture looked good, so I saved it. Lights can have linear, quadratic, and constant attenuation...(although wrong values of linear+quadratic attenuation cause wierd colors alongside the border of the attenuation area)

Shadows are calculated using normal raytracing prodcedures (no shadow volumes or maps, although I would like to use shadow maps for softer shadows) The only interesting feature is a 'soft shadow sphere' feature, which creates a group of lights with low intensities to fake area lights.

There is reflection- no refraction. (need more time to wrap my head around it!) And support for basic surfaces, using perlin noise (which I am currently doing very wrong... the noise is not band limited!) as well as a checker function.

Looking at the POV- source has been very helpful, at least in terms of structuring the program....

Output is just to RAW files, it also outputs a depth map channel, based on T from the ray equation, I'm not sure if this is more, or less accurate for making stereograms then basic Z-buffers. (can someone who knows tell me?)

Anyway, if you have any questions, just ask!



[prev]
Image of the Day Gallery
www.flipcode.com

[next]


 


Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.