Notifications
Clear all
[Closed] Maxscript Render to texture doesn't save file
Mar 18, 2015 3:19 pm
Hey everyone !
I’d like to do a script wich render 4 render to texture passes.
I wrote this piece of code. Everything seems to work fine except for the rendering.
If i launch the render within the render to texture dialog it does exactly what i want but with the “render rendertype:#bakeSelected” function nothing seems to be saved…I don’t understand ! :banghead: :banghead: :banghead: HEEELllllppp
MyObj = $
global Objbakeproperties = MyObj.INodeBakeProperties
global Prjbakeproperties = MyObj.INodeBakeProjProperties
--FUNCTION TO CREATE BAKE ELEMENT
fn Bake_3lp obj size mapType Mapname fullfilename =
(
Objbakeproperties.bakeEnabled = true -- autorise baking
Objbakeproperties.bakeChannel = 1 -- uv channel to bake
Objbakeproperties.nDilations = 2 -- pading
fPath = getFilenamePath fullfilename
fName = getFilenameFile fullfilename
fType = getFilenameType fullfilename
BakeElem = mapType
BakeElem.elementname = Mapname
BakeElem.enabled = true
BakeElem.outputSzX = size
BakeElem.outputSzY = size
BakeElem.filterOn = true
BakeElem.filenameUnique = True
BakeElem.filename = fPath+fName+".exr"
BakeElem.fileType = ".exr"
Objbakeproperties.addBakeElement BakeElem
)
Objbakeproperties.removeAllBakeElements() --clear all to be safe and clean
--CREATE BAKE ELEMENT
RenderSize = 128
Bake_3lp MyObj RenderSize (VRayCompleteMap ()) "VRayCompleteMap" "C:\\Complete.exr"
Bake_3lp MyObj RenderSize (VRayDiffuseFilterMap ()) "Diffuse" "C:\\Diffuse.exr"
Bake_3lp MyObj RenderSize (VRayMtlReflectGlossinessBake ()) "Reflect" "C:\\Reflect.exr"
Bake_3lp MyObj RenderSize (VRayNormalsMap ()) "Normal" "C:\\Normal.exr"
--RENDER
select MyObj
try(destroyDialog gTextureBakeDialog)catch()
macros.run "Render" "BakeDialog"
render rendertype:#bakeSelected vfb:false progressBar:true outputSize:[RenderSize,RenderSize]