// =========================================================================== // 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. // =========================================================================== // // // Creation Date: 2002 // // Description: Create and attach a glow shape to a volumeLight // global proc string initVolumeLightFog( string $tform, string $shape ) { string $glowShape = ""; // create a shape node for the light fog based on the light's shape int $lightShape = `getAttr ($shape + ".lightShape")`; if( $lightShape == 1 ){ // sphere $glowShape = `createNode renderSphere`; } else if( $lightShape == 3 ){ // cone $glowShape = `createNode renderCone`; } else { // cylinder && box $glowShape = `createNode renderBox`; } if( $glowShape != "" ){ setAttr ($glowShape + ".renderType") 1; setAttr ($glowShape + ".overrideEnabled") 1; // Use the "reference" display override to avoid confusion // due to the pickable glow shape overlapping the volume light shape. setAttr ($glowShape + ".overrideDisplayType") 2; connectAttr ($glowShape + ".message") ($shape + ".fogGeometry"); string $tf[] = `listTransforms $glowShape`; string $glowTform = $tf[0]; if( $lightShape == 3 ){ // cone setAttr ($glowShape + ".coneAngle") 90; setAttr ($glowShape + ".coneCap") 1; setAttr ($tf[0] + ".rotateX") -90; } // Moving the shape just inside the light shape bounds avoids // a render precision problem that results in black // boxy artifacts in the glow. -DB setAttr ($glowTform + ".scaleX") 0.999; setAttr ($glowTform + ".scaleY") 0.999; setAttr ($glowTform + ".scaleZ") 0.999; parent -r $glowTform $tform; } return $glowShape; }