A patch to the Window's version of the CDROM software

Rama Hoetzlein provided the following information to fix errors and omissions in the Window’s component of the CDROM software.

This patch was tested on Windows XP using Visual Studio 2008.

  1. Install mental ray as instructed by the CDROM.
  2. Download the file rama_hoetzlein_wmrs_win_patch.zip, copy it to your “mentalray” folder, and then extract the files from it by running “unzip” or an equivalent program. (You will know this was done properly if you see a new “lib” folder in the “mentalray” folder.)
  3. In the “mentalray” folder, modify the “set_variables.bat” and “rayrc” files to point to your install locations. For example, if installed into “C:\mental_ray”, the important lines to change are:

    In file “set_variables.bat”:
       set MRAY_PATH="C:\mental_ray" 
       set WMRS_SHADERS="C:\mental_ray\wmrs" 
    
    In file “rayrc”:
       registry "{MI_DIR}" value "C:\mental_ray" end registry 
       registry "{CLASS_DIR}" value "C:\mental_ray\wmrs" end registry 
    
  4. Run the “install.bat” batch file. (Ignore the warnings, they are expected.)
  5. On completion, the last two lines after install should read:
       116 file(s) copied. 
       ******** Done 
    
    This indicates the book shader .dlls were copied into your mental ray shader library path.
  6. The run_examples.bat is provided to render all the example scenes in the book (after all shaders are compiled)

This patch supplements the Writing mental ray Shaders CDROM in the following ways:

  1. Provided file “vcvars32.bat”, from Visual Studio 2008, which sets the correct environmental variables. Without this, the batch scripts complain that “mt” and “cl” compiler commmands are not found. To the average non-C++ programmer, it is not obvious what is missing. This fix is run automatically by the new install.bat (see below).
  2. Added the “lib” folder and the “shader.lib” file to the mentalray path. The required “shader.lib” file exists on the CD but is not copied over by the mentalray installer for Windows.
  3. Added the following files to the “include” folder:
       mi_shader_if.h 
       unistd.h 
       getopt.h 
    
    These files are not found on the distributed CDROM but are necessary to get the Windows build to work for the “miaux.obj”, “matrix.obj” and “mrpoly.obj” object files needed to compile shaders.
  4. Modified the “set_variables.bat” file as follows. The notable changes are that the include for “/LIBPATH” now points to the required “shader.lib”, and the “MRAY_PATH” and “WMRS_SHADERS” are used by the new “install.bat” file.
       set MRAY_PATH="C:\mental_ray" 
       set WMRS_SHADERS="C:\mental_ray\wmrs" 
       set WMRS_C_FLAGS=/c /O2 /MD /nologo /W3 -DWIN_NT 
       set WMRS_CPP_FLAGS=/TP /c /O2 /MD /nologo /W3 /EHsc -DWIN_NT 
       set WMRS_INCLUDE_FLAGS=/I%MRAY_PATH%\include 
       set WMRS_LINK_FLAGS=/nologo /nodefaultlib:LIBC.LIB /OPT:NOREF /INCREMENTAL:NO /DLL /LIBPATH:%MRAY_PATH%\lib 
       set WMRS_MT_FLAGS=-nologo -manifest 
    
  5. Provided a new “install.bat” file at top-level which performs all the necessary steps properly for Windows. This installer also automatically copies the compiled .dll files into the mental ray shader path so they are ready to go.
  6. The above “install.bat” file works under Windows, but produces many warning. So as to not scare the user, the install_out.txt is provided to show a sample of the expected output during installation.
  7. The “run_examples.bat” file can be used to render all the WMRS examples after install.
22 January 2010 16:58:51