|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
|
Autodesk® Entertainment Creation Suite Ultimate®
|
| [solved] Baking Self-Exclusive Ambient Occlusion to Texture Map
|
|
|
Hey guys,
I’m trying to bake my ambient occlusion as a texture map file, exactly like “Batch Bake (mental ray)” does, except excluding itself, just like “Id Nonself” does on a “mib_amb_occlusion” node.
However the command associated with “Batch Bake” seems to be using a “textureBakeSet” node which does not have any “self excluding” option.
Any ideas?
Thanks,
Kim.
|
|
|
|
Got it, using “Light and Color” as “Color Mode” in the “Mental Ray Baking Options”, instead of “Occlusion” which uses some other temporary ambient occlusion shader.
I had a “Error: Invalid Color Mode” at one point but restarting Maya seems to a have fixed that. Also my ambient occlusion shader is highlighted red as if hinting that it is not working, but that didn’t matter—I am guessing this is just a warning for MentalRay nodes used in MayaSoftware render layers.
Since I’m feeling kind of foolish, here is a relevant code snipet, used to automatically generate an ambient occlusion texture file using a bake preset and a mib occlusion preset:
#
# create shading nodes
lMaterialNode = cmds.shadingNode( "surfaceShader", asShader = True ) lOcclusionNode = cmds.shadingNode( "mib_amb_occlusion", asShader = True )
# assign shading nodes cmds.select( lDstMesh, replace = True ) mel.eval( "hyperShade -assign %s;" %( lMaterialNode ) ) cmds.connectAttr( lOcclusionNode +".outValue", lMaterialNode +".outColor" )
# load presets on shading nodes mel.eval( "applyAttrPreset \"%s\" \"%s\" %s;" %( lOcclusionNode, "mib_amb_occlusion", 1.0 ) ) mel.eval( "optionVar -iv useBakeSetOverride 1;" )
mel.eval( "optionVar -intValue textureBakeBakeAlpha 0;" )
mel.eval( "optionVar -intValue v_mrBakeShadows 1;" )
mel.eval( "applyPresetToNode \"\" \"convertBakeSetOptionVarToNode()\" \"convertNodeToOptionVarAndDeleteNode\" \"textureBakeSet\" 1;" )
# get pre-bake lightmap project output folder file name list lOutputFolderPath = cmds.workspace( q = True, dir = True ) +"lightMap\\" lFileNameList = os.listdir( lOutputFolderPath )
# bake lightmap lBakeSet = mel.eval( "$tmp = convertBakeSetOptionVarToNode()" ) mel.eval( "convertLightmapSetup -camera persp -sh -bakeSetOverride " +lBakeSet +" -ignoreDefaultBakeSet -showcpv;" )
# get post-bake lightmap project output folder file name list lFileNameList = [lFileName for lFileName in os.listdir( lOutputFolderPath ) if not lFileNameList.count( lFileName )]
lFileName = lFileNameList[0]
lFilePath = lOutputFolderPath +lFileName
# get lightmap file path print "lFilePath == %s (%s)" %( lFilePath, os.path.exists( lFilePath ) )
|
|
|
|
|
|