If some people think it will be useful, I will upload it.
There is a chance that I will be baking some radiosity into all my textures for the next project. This script does this:
Select your object
It clones it, hides the original
Takes the clone and breaks it up into objects based on the material ID (so I would get head, uppoer and lower for the models i have been building)
It imports a file "C:/temp/lights.max" (you can create your own, mine has 90 target spots to fake radiosity and a few other key lights)
At the minute it doesn't call the render to texture directly, just the dialogue box. Cos I haven't figured out how to do that.
Replies
-- It clones the mesh and breaks it into new objects by materialID
-- It loads a lighting rig
-- Rick Stirling February 2005
-- Get the model
originalObj=$
-- Clone it
myclone = copy originalObj --copy the original object
-- Hide original
select originalObj
hide $
-- Load the lightrig
fobj_names = getmaxfileobjectnames "c:/temp/lights.max"
mergeMAXFile "c:/temp/lights.max" fobj_names
-- Set scene lighting
lightTintColor = color 255 255 255
lightLevel = 1
ambientColor = color 100 100 100
-- Select clone
select myclone
$.name = "CLONE"
-- Go to epoly mode
macros.run "Modifier Stack" "Convert_to_Poly"
-- Split into the material groups
-- Go into face mode
subobjectLevel = 4
-- Get each material id and detach to CLONE# where #is id
mcnt = $.material.numsubs
for i =1 to mcnt do
(
facelist=#()
$.EditablePoly.selectByMaterial i
facelist = getFaceSelection $
nameend = i as string
objname = "CLONE" + nameend
polyop.detachFaces $ facelist asNode:true name:objname
)
-- Delete clone mesh
delete myclone
-- Select the new clone objects
select $CLONE*
macros.run "Render" "BakeDialog"
I'll upload the lights.max at some point, but you can easily create one - its got about 100 target spots with shadows on, 4 keys spots and 8 key omnis.
To run, best thing to do is hide everything except your model. Select the model, run the script. When the RTT dialogue comes up, make sure autounwrap is off (I think you only have to do this once in max 7). Hit Add, select CompleteMap, then pick the texture size and hit render.