[Closed] Material Baking in Maxscript
Hey guys,
I’m hoping someone can help me on this.
I’m busy writing a script that will rely on the Render To Texture capabilities of max but I’ve discovered that there is little to no documentation on the subject in the manual, except for the Bake Elements section. I tried reverse engeneering the Render to Texture dialog and discovered how you actually render to a texture, but when I do it gives me an “Error creating bitmap” message.
Here is my sample code:
(
local obj = geosphere()
obj.material = standard()
-- Bake Material
local bm = bitmap 256 256 filename:"C:\bitmap.png"
local be = diffuseMap()
local bi = obj.INodeBakeProperties
bi.bakeChannel = 1
bi.addBakeElement be
select obj
render rendertype:#bakeSelected frame:slidertime to:bm vfb:on
display bm
-- Bake Material End
)
Any and all help will be appreciated guys, thanks.
This is strange. I tried using the outputfile: instead of to:
[size=2]render rendertype:#bakeSelected frame:slidertime outputSize:[256,256] outputfile:bm.fileName vfb:on
[/size]
[size=2][/size]
[size=2]I still got the error, but the bitmap is created and looks okay. Weird.[/size]
[size=2][/size]
[size=2]Stev
[/size]
Thanks stev, but that still doesn’t give me the correct results, ie. If I use a normal map it just saves the image as rendered in the VFB…
This is an odd and really annoying thing… I’m calling virtually identical code as used in the RTT Dialog and it’s still giving me errors.
ARGH!!