auto baking script won't work

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  03 March 2012
Question auto baking script won't work

Hi

I assembled a script that should output me for each frame and each object a lightmap bake and a rendering in which the object is alone:

fn renderLightmap obj currentMapType Xsize Ysize channel fullFileName =
(
	fPath=getFilenamePath fullFileName
	fName=getFilenameFile fullFileName
	fType=getFilenameType fullFileName
	bi = obj.INodeBakeProperties
	currentMapType.outputSzX=Xsize
	currentMapType.outputSzY=Ysize
	currentMapType.filename=fName
	currentMapType.fileType=fType
	bi.addBakeElement currentMapType
	bi.bakeChannel=channel
	bi.bakeEnabled = true
	bi.nDilations = 12
	
	g=1.0/2.2
	bm = bitmap Xsize Ysize gamma:g filename:(fPath+fName+fType)
	
	render rendertype:#bakeSelected outputwidth:Xsize outputheight:Ysize vfb:false to:bm
	
	save bm
	close bm
	
	bi.removeAllBakeElements()
	bi.bakeEnabled = false

	format "rendering node:% channel:%\n" obj.name bi.bakeChannel
)

fn renderAlone obj Xsize Ysize fullFileName =
(
	fPath=getFilenamePath fullFileName
	fName=getFilenameFile fullFileName
	fType=getFilenameType fullFileName
	
	allObjects = Geometry
	allObjects.primaryVisibility = False
	obj.primaryVisibility = True
	
	g=1.0/2.2
	bm = bitmap Xsize Ysize gamma:g filename:(fPath+fName+fType)
	
	render outputwidth:Xsize outputheight:Ysize vfb:false to:bm
	
	save bm
	close bm
	
	allObjects.primaryVisibility = True
)

macroScript bakeSelected category: "AutoRender"
(
	t = sliderTime
	 
	--bake map
		print ("baking "+selection[1].name)
		alightMap = LightingMap()
		renderLightmap selection[1] alightMap 128 128 1 ("C:\\tmp\\"+selection[1].name+"_unwrap_f"+(t as string)+".tga")

	 print "finished baking"
	--render object alone
		print ("rendering "+selection[1].name)
		renderAlone selection[1] 640 480 ("C:\\tmp\\"+selection[1].name+"_single_f"+(t as string)+".tga")
)

macroScript bakeAll category: "AutoRender"
(
	 for t = animationrange.start to animationrange.end do
	 (
			sliderTime = t
			 
		    --bake map
			for obj in Geometry do(
				print ("baking "+obj.name)
				alightMap = LightingMap()
				renderLightmap obj alightMap 128 128 1 ("C:\\tmp\\"+obj.name+"_unwrap_f"+(t as string)+".tga")
			)
	 )
	 
	 print "finished baking"
	 
	for t = animationrange.start to animationrange.end do
	(
			--render object alone
			for obj in Geometry do(
				print ("rendering "+obj.name)
				renderAlone obj 640 480 ("C:\\tmp\\"+obj.name+"_single_f"+(t as string)+".tga")
			)
	)
)



now - the strange thing is, bakeSelected works fine - but bakeAll outputs only black images. any idea why??
 
  03 March 2012
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:39 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.