POV Ray Tracer
- I want to take a quick look at a ray tracer.
- Angel describes ray tracing as
- "a logical extension to rendering with a local lighitng model".
- In lighting we discussed how our lighthing model was "cheap and easy" but not realistic.
- In ray tracing we attempt to produce "photorealistic" images by tracing rays from a camera through the view plane to objects, and eventually to light sources.
-
- for each pixel in the scene
- Cast a ray from the camera through the pixel into the scene.
- If the ray intersects with an object
- Cast a ray from the intersection point to each light
- If there are no intersecting obejcts, coupute the light using a lighting equation.
- If the surface is "shiny", cast another ray along the angle of reflection
- If the object is transparent or translucient allow the ray to travel through the object.
- Object ray instersection computations are the major expense
- Essentually every ray needs to check for an intersection with every object.
- This is expensive
- It is made faster by bounding box tests
- My choice is povray
- It has been around forever
- It is free and open source
- LOOK at the pictures.
- It uses a scene description language to create images
- Almost everything we have learned in graphics applies
- Transformations
- Camera deteail/ projectioni
- lighting details
- Ray tracing is parallelizable and pov supports parallelism.
- The language is turing-complete - it is a "real" programming language.
- It is cross platofrm (Macs, Windows, Linux,) and open source.
- A quick look:
- I stole this file from wikipedia.
- But I have messed with it.
- // and /* */ comments
- There are a number of include files.
- #include <stones.inc>
- ls /usr/share/povray-3.7/include
- Only ten levels deep!
- Objects are declared and properties are set.
- Every scene needs a camera object.
- Coordinates as opengl but positive z goes into the screen.
- There are many different built in projectsions
- Orthographic
- Perspective
- fisheye