// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // Procedure : generateLightMaps // // Description: // Generate a set of light maps for a set of // geometry. // // Arguments: // useThisShader : use the shader passed in versus shader // associated with each object // postFix : string to stick on to end of light map file texture name // allMeshes : all poly geometry // shadows : compute shadows // antiAlias : anti-alias light map images // rx, ry : resolution of light map in x and y // // Last Updated : 08/23/00 // // // Create a set of dummy shaders for light mapping only // global proc handleDummyLightMapShaders(int $deleteIt) { global string $fakeShaders[]; int $numFake = size($fakeShaders); for ($i=0; $i<$numFake; $i++) { catch ( `delete $fakeShaders[$i]` ); } if ($deleteIt) { return; } // Create a dummy lambert shader + shading group string $newss = `shadingNode -name _fakeSS_lambert_ -asShader lambert`; string $sgName = ($newss + "SG"); $sgName = `sets -renderable true -noSurfaceShader true -empty -name $sgName`; eval ("connectAttr -f " + $newss+".outColor " + $sgName+".surfaceShader"); eval ("setAttr -type float3 " + $newss+".color 1.0 1.0 1.0"); $fakeShaders[0] = $newss; $fakeShaders[1] = $sgName; // Create a dummy lambert shader + shading group $newss = `shadingNode -name _fakeSS_blinn_ -asShader blinn`; $sgName = ($newss + "SG"); $sgName = `sets -renderable true -noSurfaceShader true -empty -name $sgName`; eval ("connectAttr -f " + $newss+".outColor " + $sgName+".surfaceShader"); eval ("setAttr -type float3 " + $newss+".color 1.0 1.0 1.0"); $fakeShaders[2] = $newss; $fakeShaders[3] = $sgName; // Create a dummy lambert shader + shading group $newss = `shadingNode -name _fakeSS_phong_ -asShader phong`; $sgName = ($newss + "SG"); $sgName = `sets -renderable true -noSurfaceShader true -empty -name $sgName`; eval ("connectAttr -f " + $newss+".outColor " + $sgName+".surfaceShader"); eval ("setAttr -type float3 " + $newss+".color 1.0 1.0 1.0"); $fakeShaders[4] = $newss; $fakeShaders[5] = $sgName; } global proc generateLightMaps(string $useThisShader, string $postFix, string $fileFormat, int $allMeshes, int $blendMode, int $shadows, int $antiAlias, int $rx, int $ry) { global string $fakeShaders[]; // Get what to work on string $selected[]; int $needsUVRange[]; // Only polys should use the 0 1 0 1 uv range ? int $cnt = 0; // All untemplated meshes / subdivs / nurbs if ($allMeshes) { $selected = `ls -type "mesh" -type "subdiv" -type "nurbsSurface" -ut`; select -r $selected; $cnt = size($selected); for ($i=0; $i<$cnt; $i++) { $needsUVRange[$i] = 1; } } // Check the selection list, and screen out meshes / subdivs / nurbs else { string $unselect[]; $cnt = 0; string $unfiltered[] = `ls -dag -ap -sl`; for ($i=0; $i