The Render to Texture feature provides the ability to render out various elements from a standard render, for example light maps and specular maps. It works in conjunction with the new UVW Unwrap modifier, which can now flatten texture coordinates. Please see the user guide for a more detailed description.
This new feature now creates certain maps that do not fit into any particular material map slot for example, a light map. However 3rd party materials may exist that support extended features. BakeTextureMappings.ini file allows developers to add support for new materials. This provides the mapping between the different baked elements and the map slots in the material.
An example INI file can be seen below.
[DeclareFileMappings] DeclareFileMapping1=SaveAll DeclareFileMapping2=CompleteOnly DeclareFileMapping3= DeclareFileMapping4= DeclareFileMapping5= DeclareFileMapping6= DeclareFileMapping7= DeclareFileMapping8= DeclareFileMapping9= DeclareFileMapping10= [CompleteOnly] shaderName = blinn ambientMap= diffuseMap = CompleteMap specularMap= diffuseLevelMap= specularLevelMap= glossinessMap= selfIllumMap= opacityMap= filterMap= bumpMap= reflectionMap= refractionMap= displacementMap= diffuseRoughnessMap= anisotropyMap= orientationMap= glossinessMap2= anisotropyMap2= orientationMap2= [SaveAll] shaderName= oren-nayar-blinn ambientMap= CompleteMap diffuseMap= DiffuseMap diffuseLevelMap= ShadowsMap specularLevelMap=SpecularMap bumpMap= NormalsMap opacityMap= AlphaMap selfIllumMap= LightingMap displacementMap= BlendMap
The first section of the file is used to populate the drop down list in the RTT dialog box. For each entry there must be a subsequent entry defining the mapping. In the save all section all the supported baked elements are mapped to a standard material. This provides a method of viewing all the maps created, not necessarily to produce the correct rendering
The names, on the left hand side are the supported MAXScript names for the parameters that have been defined in the ParamBlockDesc2 of the material. The name on the right is the actual baked element name used in the RTT. This mapping and naming needs to be accurate as it can cause a run time error in the RTT macro script
The Render To Texture script has been written to use the ViewportManager to handle viewport shaders. Internally it supports the Metal Bump and Light Map shaders. The script can be found in the 3ds Max installation folder at \UI\Macroscripts\Macro_BakeTextures.mcr. In the function called UpdateMaterial, there is a section that provides additional Viewport vhader support. The script lists all available shaders, so all that is needed is for the developer to supply the correct setup for the shader. Examples can be found in the function setupLightMapShader.