swapBitmapToMap

5 votes
Version: 
1.0
Date Updated: 
04/20/2008

The script switches any texture file to use a Mental Ray .MAP file instead, but only during rendering. This seems to help with big texture memory consumption.

Since 3ds MAX does not support Mental Ray .MAP, the script temporarily changes the file name to the .MAP file only during rendering and then change it back when rendering is ready.

IF:

  1. Mental Ray is the selected renderer
  2. "Mental Ray Map Manager" is turned on (Render dialog, Processing tabb)
  3. "Conserve Memory" is turned on (Render dialog, Processing tabb)

THEN For any texture, in a pre-render callback:

  1. check if texture name + ".x.map" exists.
  2. if it does, use that file during rendering
  3. if it does NOT exist, check if file is larger than 1000 x 1000 pixel
  4. if it is, call the "imf_copy" DOS command line tool to convert the file

AFTER rendering is completed

  1. For any texture that ends in ".x.map", set back to original name (without ".x.map")

To convert manually, use Mental Images Command line tool like this

imf_copy -vrp some_file.jpg some_file.jpg.x.map map

This tool does not ship with 3ds MAX, but with other Mental Ray programs like Maya. Ask a friend! :D

The script always searches for file with same name plus ".x.map" at end. They dont even need to be same texture, could be simple placeholder used in max, with only real big texture in ".x.map" version. (I chose ".x.map" as addition becaus it is easy to find for resetting at the end of the render. You can change this in the script if you like.)

The script is very simple. You can put it in your Startup script folder, i.e:

c:\program files\Autodesk\3ds max 2009\scripts\Startup

You can also edit as you like for fun. For exampel choice of automatically convert for anything bigger than 1000 pixel is arbitrary, you can change yourself easy.

Script is public domain.

Version Requirement: 
3ds Max 2009
Other Software Required: 
Needs the Mental Images command line tool 'imf_copy', which does not ship with 3ds, but ships with Maya and XSI
Video URL: 
AttachmentSize
swapBitmapToMap.ms2.24 KB