Render to texture used maxscript issuse

Render to texture used maxscript issuse

Anonymous
Not applicable
1,149 Views
2 Replies
Message 1 of 3

Render to texture used maxscript issuse

Anonymous
Not applicable

Hey guys.

I got a trouble in save the baked diffuseMap used maxscript ,

Max had a bug maybe, that is in the vfb(virtual frame buffer) the texture looks wrong and saved texture is currect.

Now the issue is when I used maxscript to render the diffuse to save a texture ,the  resault is the texture in the vfb , the wrong texture.

I used max9 ,but I try it in max 2016 the problem also exist.

So I think, if have some method to save the currect texture.

here is my code

 

		fn func_renderTex obj i_size outputFile= 
	(
		bitm = bitmap i_size i_size 
		bakeMap = diffusemap()
		bakeMap.outputSzX = i_size
		bakeMap.outputSzY = i_size
		bakeMap.fileType = ".tif"
		bakeMap.filterOn = true
		bakeMap.shadowsOn =off
		bakeMap.lightingon = off
		bakeMap.targetMapSlotName = "Diffuse"
		bakeMap.enabled = true 

		obj.INodeBakeProperties.addBakeElement bakeMap 
		obj.INodeBakeProperties.bakeEnabled = on
		obj.INodeBakeProperties.flags = 1
		obj.INodeBakeProperties.bakeChannel = 1
		obj.INodeBakeProperties.nDilations = 100

		render rendertype:#bakeSelected vfb:off progressBar:true outputFile:( outputFile + ".tif") outputSize:[i_size,i_size] to:bitm
		obj.iNodeBakeProperties.removeAllBakeElements() 
		

	) 
0 Likes
Accepted solutions (2)
1,150 Views
2 Replies
Replies (2)
Message 2 of 3

Swordslayer
Advisor
Advisor
Accepted solution
You are saving the image in the vfb - you should instead specify the filepath inside the fileType parameter of the map you are adding. Yeah, it's counterintuitive and fileType is a confusing name when it should more fittingly be named filePath... So delete the outputFile: parameter of the render command, switch the .tif in bakeMap.fileType = ".tif" for the complete path and you're good to go.
0 Likes
Message 3 of 3

Anonymous
Not applicable
Accepted solution

thank you Swordslayer ,

I just solved this, just saved diffusemap().bipmap its ok

maybe the rendered buffer in diffusemap() is currect

 

		fn func_renderTex obj i_size outputFile= 
	(
		bakeMap = diffusemap()
		bakeMap.outputSzX = i_size
		bakeMap.outputSzY = i_size
		bakeMap.fileType = ".dds"
		bakeMap.filterOn = true
		bakeMap.shadowsOn =off
		bakeMap.lightingon = off
		bakeMap.targetMapSlotName = "Diffuse"
		bakeMap.enabled = true 

		obj.INodeBakeProperties.addBakeElement bakeMap 
		obj.INodeBakeProperties.bakeEnabled = on
		obj.INodeBakeProperties.flags = 1
		obj.INodeBakeProperties.bakeChannel = 1
		obj.INodeBakeProperties.nDilations = 500

		render rendertype:#bakeSelected vfb:off progressBar:true outputSize:[i_size,i_size ] 
		obj.iNodeBakeProperties.removeAllBakeElements() 

		b_temp = bakeMap.bitmap
		b_temp.filename = ( outputFile + ".dds")
		save b_temp
	) 
0 Likes