Modeler Setup, Version 1.1

Download and unzip this updated version of the modeler DLL. Set your MODELER environment variable to point to this new version.

In your models, you have to make two minor changes to Model_RedrawCmd.

  1. When you call draw_mode_setup(), you now need to check the return value (it used to return void). If it is not TCL_OK, return TCL_ERROR immediately.

    Replace this line:

    draw_mode_setup();
    
    with this one:
    if ( draw_mode_setup() != TCL_OK ) return TCL_ERROR;
    
  2. Instead of returning TCL_OK from your drawing function, call the new function draw_mode_finish() and return what it returned.

    Replace this line:

    return TCL_OK;
    
    with this one:
    return draw_mode_finish();
    
These two changes are all that should be required to get your model working with the updated modeler DLL. The changes visible in the user interface are:
  1. The ray tracer output command.
  2. The animation time no longer resets when you start or stop animations. This allows you to pause an animation in progress, write a raytrace file with the current scene, and continue.

Creating a ray tracer input file

The new modeler.tcl adds an option "Write raytrace file..." to the File menu. This menu item will write out a text file with the current model, in the currently displayed pose.

This conversion is not perfect. The raytraced image will not look exactly like the OpenGL-rendered version. The file is meant to be a starting point, which contains all the geometry and funky transform matrices, but which you edit to customize shading parameters and so forth.

The conversion does not faithfully reproduce:

  1. Specular highlights and the "shininess" parameter. All objects are output as a matte surface, using only the ambient and diffuse parameters. Some of the example ray files that come with the skeleton code (notably "tentacles.cpp") were made with an early version of the converter that attempted to reproduce the shading more precisely, and consequently have odd-looking highlights.

  2. Camera position and settings. The raytracer's camera corresponds to a perspective transform, at the origin, looking down the -z axis, with a FOV of 30 degrees. This is the default camera given in the project 2 howto document; it should match unless you've changed the Model_ResizeCmd function to do a different projection.

  3. Light positions or settings. The converter places a single directional light in the scene it outputs.

A screenshot from modeler.

The scene as rendered by the ray tracer sample solution.