Notifications
Clear all

[Closed] save to Bitmap Vray

So from this wonderful forum I found some great maxscript that copied the image from the render frame to a file.
That works great in scanline/mental ray but it is giving me an undefined result with Vray.
Can anybody shed some light on this for me?

Thanks!

bakeMap = VRay_CompleteMap()
			bakeMap.outputSzX = Rsize
			bakeMap.outputSzY = Rsize
			bakeMap.fileType = ".jpg"
			bakeMap.enabled = true 
			obj.INodeBakeProperties.addBakeElement bakeMap 
			obj.INodeBakeProperties.bakeEnabled = on
			obj.INodeBakeProperties.flags = 1
			obj.INodeBakeProperties.bakeChannel = 5
			obj.INodeBakeProperties.nDilations = 1
		--This chunk renders out the bitmap
			render rendertype:#bakeSelected vfb:off progressBar:true outputSize:[Rsize,Rsize]
			rendPath = (maxfilepath + occlusionFile + ".jpg")
			tempBitmap = bitmap rsize rsize filename:rendPath
			copy bakemap.bitmap tempBitmap
			save tempBitmap
			obj.iNodeBakeProperties.removeAllBakeElements()
			gc light:true 									-- must call this to clear the bakeMap.bitmap otherwise the first render will always get pasted in the tempBitmap

The red text initiates the render, and if I turn vfb:on the render window displays the correct information, but it returns “undefined” in the listener and then creates a black image in the next three lines of code.

2 Replies

For those interested: I came up with a solution.
I changed this section:

render rendertype:#bakeSelected vfb:off progressBar:true outputSize:[Rsize,Rsize]
rendPath = (maxfilepath + occlusionFile + ".jpg")
tempBitmap = bitmap rsize rsize filename:rendPath
copy bakemap.bitmap tempBitmap
save tempBitmap

to:

tempBitmap = bitmap rsize rsize filename:rendPath
render rendertype:#bakeSelected vfb:off disableBitmapProxies:true outputSize:[Rsize,Rsize] to:tempBitmap			
save tempBitmap

Cool, thank you!