Project 5

Here is a brief overview of the modifications:

  • Cloth simulation

  • Object selection/picking

  • Capability of writing out depth maps

  • Partial Cartoon rendering pipeline

  • Batch Rendering

  • extension to Vim3D's OBJ parser

    • now includes MTL file parsing

      • write and read MTL files

    • polygon groups

      • write and read OBJ files with mtl libraries and groups

      • OpenGL

        • per-polygon texture mapping

        • per-polygon group display lists

      • Raytracing

        • per-polygon textures and normals maps

There was a lot of effort put into KDTrees and path tracing. We want to mention that we did spend a lot of time on this although they did not work out in the time allocated for this project.


Cloth was created using vertical, horizontal, diagonal and skip springs. Positions and velocities were found using 4th degree Runge-Kutta (RK4). Wind was added using a 3d perlin-noise function to animate the cloth.
red_cloth.png -

Click on the video below to start the playback at frame 0. We have applied a random wind to give a better effect.

Polygon Groups

Polygon groups allow a user to have different material properties and texture maps for any set of faces on an object. To create polygon groups, the best way is to import a file from a 3D software that uses OBJS and groups. However, you can create groups with the command line in vim3D using the poly command:
poly group texture <begin> <end> <map>
Where begin and end refer to the face indices, and map is a texture map. Here is an example file:
add cube
poly centroid
poly scale 2
ambient 1 1 1 1
poly meld
compute smooth
poly group texture 0 1 images/vim.ppm
poly group texture 2 3 images/wood.ppm
poly group texture 4 5 images/tex/window.ppm
poly group texture 6 6 images/tex/wood.ppm
load scene1

Project 5 -

Project 5 -

Integration of MTL and OBJ files

The reason for polygon groups was to conform to the OBJ and MTL standards. Thus, our program can read and write material files in addition to obj files now.

Lets look at an example. The OBJ and MTL were generated with Vim3D. Here is the material:
newmtl first                                            
map_Ka images/tex/wood.ppm                              
newmtl second                                           
map_Ka images/vim.ppm                                   
newmtl third                                            
map_Ka images/world.ppm    
Here is the output OBJ file:
# generated by vim3D (Dan Lynch and Barry Martin)
mtllib materials/cube.mtl
v -10.000000 -10.000000 -10.000000
vt 1.000000 0.000000 0.000000
usemtl first
f 1/1 2/2/1 3/3/2 4/4/3
f 5/5/4 6/6/5 7/7/6 8/8/7
usemtl second
f 1/9 2/10/1 5/11/4 6/12/5
f 7/13/6 8/14/7 3/15/2 4/16/3
usemtl third
f 1/17 6/18/5 7/19/6 4/20/3
f 2/21/1 5/22/4 8/23/7 3/24/2

Depth Maps

depth_maps.png -

We allow a user to export a depth map in addition to a raytraced image. This can be done using the render command, using 1 or 0 to turn this feature on or off.
render depthmap 1

Project 5 -

Project 5 -

Cartoon Rendering

depthcartoon.png -

Although this process is not entirely stream-lined within vim3D, it gives you a good head start. First kick of a render using the cartoon flag:
render cartoon 1
Then make sure to enable depth map rendering:
render depthmap 1
Then, outside of vim3D, perform an edge detection on the depth map, and screen overlay it with the cartoon render.

Project 5 -

Batch Rendering

We now allow for users to specify frame ranges and control batch renders. This can all be done using the render command:
render frames 0 100
render raytrace 1
You can either render the OpenGL display or a raytrace. Do render the OpenGL window, use:
render display 1
render set 1