PDA

View Full Version : Render Lightmap Script ALWAYS bakes completemap!


gtjuggler
12-03-2009, 05:36 PM
Hi all,

I have a script that renders a lightmap at 1024x1024 on channel 3. It works fine and renders to disk just like I ask it to but it doesnt seem to be paying attention to my map render choice. This line: beInstance=LightingMap() should dictate the map output type but I will always get the same output: A pre-multiplied lightmap + diffusemap , aka a CompleteMap. I'm beating my head against the wall here and have relinquished this to the community. Any help would be extremely appreciated!

Below is the renderLightmap function, and everything is basically hardcoded inside of the function (channel, size, maptype, etc) so this should be the only relevant code:

fn renderLightmap obj fullFileName virtualFrameBufferState =
(
obj.iNodeBakeProperties.removeAllBakeElements()
beInstance=LightingMap()
channel = 3;
Xsize = 1024;
Ysize = 1024;
fPath=getFilenamePath fullFileName
fName=getFilenameFile fullFileName
fType=getFilenameType fullFileName
beInstance.outputSzX=Xsize
beInstance.outputSzY=Ysize
beInstance.filename=fName
beInstance.fileType=fType
beInstance.filterOn = true
beInstance.shadowsOn = true
beInstance.directOn = true
beInstance.indirectOn = true
beInstance.enabled = true
obj.INodeBakeProperties.addBakeElement beInstance
obj.INodeBakeProperties.bakeChannel=channel
obj.INodeBakeProperties.bakeEnabled = true
select obj
render rendertype:#bakeSelected outputwidth:Xsize outputheight:Ysize outputfile:(fPath+fName+fType) progressBar:true vfb:virtualFrameBufferState
obj.INodeBakeProperties.removeAllBakeElements()
obj.INodeBakeProperties.bakeEnabled = false
format "rendering node:% channel:%\n" obj.name obj.INodeBakeProperties.bakeChannel
)

gtjuggler
12-03-2009, 05:58 PM
After doing some more searching, I found people saying that changing fileName to fileType fixes their issues, but this doesnt seem to be the case here. If it is the case, what exact changes would I need to make?

This guy has the same exact issue as me: http://forums.cgsociety.org/showthread.php?f=98&t=669288 but even using his exact code, I'm not getting correct output.

Does anyone have a solution? (Max 2010)

MerlinEl
12-03-2009, 06:03 PM
good evening :)

try this :

sceneRadiosity.radiosity = Light_Tracer()
sceneRadiosity.radiosity.bounces = 2
sceneRadiosity.radiosity.rays = 500

gtjuggler
12-03-2009, 06:17 PM
Hi Merlin, that will enable bounced lighting, which is a cool option to have, but I'm still not getting a lightmap. I'm still getting a completemap output.

AkramParvez
12-04-2009, 06:45 AM
there are two issues with the function:-
1. The map channel 3 is not available in the model
2. changing the filename to filetype.

Try this:

fn renderLightmap obj fullFileName virtualFrameBufferState =
(
obj.iNodeBakeProperties.removeAllBakeElements()
beInstance=LightingMap()
channel = 1 --Changed it from 3
Xsize = 1024;
Ysize = 1024;
fPath=getFilenamePath fullFileName
fName=getFilenameFile fullFileName
fType=getFilenameType fullFileName
beInstance.outputSzX=Xsize
beInstance.outputSzY=Ysize
-- removed this beInstance.filename=fName
beInstance.fileType= fullFileName -- Changed
beInstance.filterOn = true
beInstance.shadowsOn = true
beInstance.directOn = true
beInstance.indirectOn = true
beInstance.enabled = true
obj.INodeBakeProperties.addBakeElement beInstance
obj.INodeBakeProperties.bakeChannel=channel
obj.INodeBakeProperties.bakeEnabled = true
select obj
render rendertype:#bakeSelected outputwidth:Xsize outputheight:Ysize outputfile:(fPath+fName+fType) progressBar:true vfb:virtualFrameBufferState
obj.INodeBakeProperties.removeAllBakeElements()
obj.INodeBakeProperties.bakeEnabled = false
format "rendering node:% channel:%\n" obj.name obj.INodeBakeProperties.bakeChannel
)


I have changed the channel to 1 or you can do a uvw unwrap with channel 3 manually and have the channel as 3. This will also work.

gtjuggler
12-04-2009, 07:15 AM
Hi Akiram,

I do a unwrap on channel 3 before running the lightmap function. Also, I tried changing filename to filetype to no avail already.

How would changing filename to filetype actually change how the file output *looks* ? Wouldnt it only control where and if the file is saved to disk?

AkramParvez
12-04-2009, 08:53 AM
just remove the outputfile:(fPath+fName+fType) form render command this was just overwriting the actual lightmap generated with the framebuffer render which renders a complete map..

render rendertype:#bakeSelected outputwidth:Xsize outputheight:Ysize progressBar:true vfb:virtualFrameBufferState -- change this line in the above code

gtjuggler
12-04-2009, 07:49 PM
You rock, by the way!

It was the render line that overwrites my good render with what was in the vfp. Somehow I didnt catch that.

Thanks so much.

CGTalk Moderation
12-04-2009, 07:49 PM
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.