RayTracer Assignment
RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

Vim3D's Raytracer

This page is for the raytracer assignment for CS184 at UC Berkeley.

The raytracer renders spheres, triangles, and quads with point, directional, and area lights. The vim3D obj parser can read any geometry file, however, at this time we are able to render geometry that has faces with 3-4 vertices. Polygonal hit detection with vertices greater than 4 will be added later.

On this page, you will find information about these elements of the raytracer:

  • Reflections

  • Refractions

  • Normals

  • textures

  • transformations

    • object groups

  • Bounding Volume Hierarchies

  • anti-aliasing

    • regular

    • jittering

  • area lights and soft shadows

  • normal maps



You may also wish to navigate to the Rendering Documentation or the raytracer gallery.

Reflections

Reflection is implemented using the reflection command, which specifies the reflectivity of each color component:
reflection 0.7 0.7 0.7
Click here for information on reflection
RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

Refractions

Refractions are implemented. You can specify this using the refraction command:
refraction 1.5
Click here for information on refraction
RayTracer Assignment - www.vim3d.com

Normals

We have implemented a way to "meld" vertices of an arbitrary geometry and smooth the normals. Below show two renders, one with regular normals, and the other with smooth normals. Click here for more information on normals and computing smooth normals
RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

Textures

Click here for information on texturing
RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

Transformations

Below we have demonstrated how transforms can be used to instantiate objects. The first is the original geometry, and the second image contains copies with various transformations. You can do this using the copy, translate, rotate, and scale commands:
copy tv
translate 0 10 0
rotate 45 0 0 1
These can be applied in a hierarchical fashion, using object groups. The object group command will create an entirely new geometry object that you can animate or modify. The matrix of the new object will affect all children.
obj group <obj1> <obj2> ... <objn>

obj child <parentObj> <childObj>

Click here for more information on hierarchies
RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

Bounding Volume Hierarchy for Acceleration

We implemented hierarchical, oriented, bounding-box structures to accelerate the raytracer.
RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

Anti-aliasing

Anti-aliasing is achieved through regular sampling. Of the two images below, the first has aliased edges, and the second is anti-aliased. This can be achieved with the following:
render samples 1
raytrace noanti.ppm 3 320 240
render samples 3
raytrace anti.ppm 3 320 240

RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

Jitter

The default is set to use regular sampling. However, you can use random sampling, and in particular, jittering or stratified sampling if you specify
render jitter 1
to set it back to regular, simply set it to 0. The images below were produced with
raytrace first.ppm 3 480 320
render jitter 1
render samples 4
raytrace second.ppm 3 480 320

RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

Area lights and Soft Shadows

We implemented area lights and soft shadows. This can be achieved using the light command:
add light
light area 3 3

RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

Normal Maps

Using the normalmap command, you can apply normal maps:
normalmap <filename>
Below is a normal map courtesy of nvidia.com. We used this as an image to displace the normals in this example:


RayTracer Assignment - www.vim3d.com

RayTracer Assignment - www.vim3d.com

Test Scenes

We converted the test scenes to our scene description language: Test Scenes

Also there is a raytracer gallery.

The source below will compile on all platforms, however, windows may require a .dll file or so. Mac OSX and Linux compile and run fine.



Downloads:
Download: proj4.zip 67.2 MB