Sunteți pe pagina 1din 25

//Created by Amanda Squeo and Ashley LaButte //for VSFX 160 Introduction to Programming //Taken at Savannah College of Art

& Design, May 2013. //Do not remove credits if script is used. global proc MakeWaterfallUI() { // These attributes are for the Mist only. global string $sMistEmitter; global string $sMistBaseRes; global string $sMistGravity; global string $sMistViscosity; global string $sMistFriction; global string $sMistDamp; global string $sMistDensity; global string $sMistBuoyancy; global string $sMColor1; global string $sMColor2; global string $sMColor3; global string $sMistShadeQuality; global string $sCollision; global global global global global global global global global string string string string string string string string string $sWaterfallEmitter; $sWaterfallViscosity; $sWaterfallFriction; $sWaterfallDamp; $sWaterfallRadius; $sWaterfallStickiness; $sWColor1; $sWColor2; $sWColor3;

// The creation of the window and its naming. string $WaterfallWindow = `window -title "Waterfall Creation" -rtf true`;

// The liquid emitter and mist emitter settings will be divided. // This marks the beginning of the Water Mist Settings section of the UI. columnLayout -adjustableColumn true -columnWidth 950; frameLayout -collapsable false -label "Waterfall"; columnLayout -adjustableColumn true -columnWidth 950; frameLayout -collapsable true -label "Mist Flow Settings"; string $sMistEmitter = `floatSliderGrp -label "Particle Emission Rate" -field true -minValue 1 -maxValue 300 -value 100`; string $ButtonInfo = `text -label "Please Note: The higher the Base Resolution, the slower the waterfall runs. The resolution heavily influences detail quality and mist flow."`; string $sMistBaseRes = `floatSliderGrp -label "Base Resolution" -field true -minValue 3 -maxValue 150 -value 13`; string $sMistGravity = `floatSliderGrp -label "Gravity" field true -minValue .01 -maxValue 30 -value 9.8`; string $sMistViscosity = `floatSliderGrp -label "Viscosity" -field true -minValue 0 -maxValue 1 -value 0`;

string $sMistFriction = `floatSliderGrp -label "Friction" -field true -minValue 0 -maxValue 20 -value 0`; string $sMistDamp = `floatSliderGrp -label "Damp" -field true -minValue 0.0 -maxValue 1.0 -value 0.0`; string $sMistDensity = `floatSliderGrp -label "Density" field true -minValue 0 -maxValue 40 -value 5`; string $sMistBuoyancy = `floatSliderGrp -label "Buoyancy" -field true -minValue -30 -maxValue 30 -value -20`; setParent ..; columnLayout -adjustableColumn true -columnWidth 950; frameLayout -collapsable true -label "Mist Color and Shading"; columnLayout; string $ButtonInfo2 = `text -label "Press the Mist Color button to preview the mists color in a new window."`; // To view the mists color the user needs to press this button, // it brings up a small window with the chosen color as its background. // The procedure for the colorCheck option is found later on.

button -label "Mist Color" -command "colorCheckQ($sMColor1, $sMColor2, $sMColor3)"; separator; // The color selection is divided into three sliders because // the entry for any color value is separated into three values. string $sMColor1 = `colorSliderGrp -label "Red" -rgb 0.715 0 0`; string $sMColor2 = `colorSliderGrp -label "Green" -rgb 0 1 0`; string $sMColor3 = `colorSliderGrp -label "Blue" -rgb 0 0 0.9525`; separator -height 10; string $sMistShadeQuality = `floatSliderGrp -label "Shade Quality" -field true -minValue 0 -maxValue 10 -value 1`; setParent..; setParent..; columnLayout -adjustableColumn true -columnWidth 950; frameLayout -collapsable true -label "Waterfall Flow Settings"; string $sWaterfallEmitter = `floatSliderGrp -label "Particle Emission Rate" -field true -minValue 1 -maxValue 2500 -value 100`; string $sWaterfallViscosity = `floatSliderGrp -label "Viscosity" -field true

-minValue 0 -maxValue 1 -value 0`; string $sWaterfallFriction = `floatSliderGrp -label "Friction" -field true -minValue 0 -maxValue 20 -value 0`; string $sWaterfallDamp = `floatSliderGrp -label "Damp" field true -minValue 0.0 -maxValue 1.0 -value 0.0`; string $sWaterfallRadius = `floatSliderGrp -label "Radius" -field true -minValue 0.0 -maxValue 10.0 -value 0.3`; string $sWaterfallStickiness = `floatSliderGrp -label "Stickiness" -field true -minValue 0.0 -maxValue 1.0 -value 0.0`; setParent ..; setParent..; columnLayout -adjustableColumn true -columnWidth 950; frameLayout -collapsable true -label "Waterfall Color and Shading"; columnLayout; string $ButtonInfo7 = `text -label "Press the Waterfall Color button to preview the mists color in a new window."`;

// To view the mists color the user needs to press this button, // it brings up a small window with the chosen color as its background. // The procedure for the colorCheck option is found later on. button -label "Waterfall Color" -command "colorCheckZ($sWColor1, $sWColor2, $sWColor3)"; separator; // The color selection is divided into three sliders because // the entry for any color value is separated into three values. string $sWColor1 = `colorSliderGrp -label "Red" -rgb 0.715 0 0`; string $sWColor2 = `colorSliderGrp -label "Green" -rgb 0 1 0`; string $sWColor3 = `colorSliderGrp -label "Blue" -rgb 0 0 0.9525`; separator -height 10; string $sWaterfallShadeQuality = `floatSliderGrp -label "Shade Quality" -field true -minValue 0 -maxValue 10 -value 1`; setParent..; setParent..; string $ButtonInfo3 = `text -label "Create just the Waterfall and Mist Emitters"`; button -label "Create Waterfall" -command "createWaterfallButton($sMistEmitter, $sMistBaseRes, $sMistGravity, $sMistViscosity, $sMistFriction,

$sMistDamp, $sMistDensity, $sMistBuoyancy, $sMColor1, $sMColor2, $sMColor3, $sMistShadeQuality,$sWaterfallEmitter, $sWaterfallViscosity, $sWaterfallFriction, $sWaterfallDamp, $sWaterfallRadius, $sWaterfallStickiness, $sWColor1, $sWColor2, $sWColor3)"; setParent..; string $ButtonInfo4 = `text -label "Do you already have geometry you want the waterfall to collide with?"`; button -label "Create and Collide with Previous Geometry" -command "createWaterfallButton2($sMistEmitter, $sMistBaseRes, $sMistGravity, $sMistViscosity, $sMistFriction, $sMistDamp, $sMistDensity, $sMistBuoyancy, $sMColor1, $sMColor2, $sMColor3, $sMistShadeQuality,$sWaterfallEmitter, $sWaterfallViscosity, $sWaterfallFriction, $sWaterfallDamp, $sWaterfallRadius, $sWaterfallStickiness, $sWColor1, $sWColor2, $sWColor3)"; setParent..; setParent..; showWindow $WaterfallWindow; } // The colorCheckQ and colorCheck procedures are borrowed // from the Waterfall script by Tyler Britton. global proc colorCheckQ(string $CmMColor1, $CmMColor2, string $CmMColor3) { vector $CoMColor1 = `colorSliderGrp -q $CmMColor1`; vector $CoMColor2 = `colorSliderGrp -q $CmMColor2`; vector $CoMColor3 = `colorSliderGrp -q $CmMColor3`; string -rgb -rgb -rgb

colorCheck ($CoMColor1, $CoMColor2, $CoMColor3); } global proc colorCheckZ(string $CmWColor1, string $CmWColor2, string $CmWColor3) { vector $CoWColor1 = `colorSliderGrp -q $CmWColor1`; vector $CoWColor2 = `colorSliderGrp -q $CmWColor2`; vector $CoWColor3 = `colorSliderGrp -q $CmWColor3`; colorCheck2 ($CoWColor1, $CoWColor2, } -rgb -rgb -rgb $CoWColor3);

// This procedure creates the small window that shows the color preview. global proc colorCheck(float $CMColor1, float $CMColor2, float $CMColor3) { confirmDialog -title "Mist Color Preview" -message "This is the Mist Color." -button "Exit this Window" -bgc $CMColor1 $CMColor2 $CMColor3; } global proc colorCheck2(float $CWColor1, float $CWColor2, float $CWColor3) { confirmDialog -title "Waterfall Color Preview" -message "This is the Waterfall Color." -button "Exit this Window" -bgc $CWColor1 $CWColor2 $CWColor3;

} //// Querying all the values within the UI. //// There are two because the user has a choice between using no geometry, //// or using their own geometry and having the emitter collide with it. // Just the Mist Emitter procedure. global proc createWaterfallButton(string $qMistEmitter, string $qMistBaseRes, string $qMistGravity,string $qMistViscosity, string $qMistFriction, string $qMistDamp, string $qMistDensity, string $qMistBuoyancy, string $qMColor1, string $qMColor2, string $qMColor3, string $qMistShadeQuality, string $qWaterfallEmitter,string $qWaterfallViscosity, string $qWaterfallFriction, string $qWaterfallDamp, string $qWaterfallRadius, string $qWaterfallStickiness, string $qWColor1, string $qWColor2, string $qWColor3) { float $MistEmitter = `floatSliderGrp -q -value $qMistEmitter`; float $MistBaseRes = `floatSliderGrp -q -value $qMistBaseRes`; float $MistGravity = `floatSliderGrp -q -value $qMistGravity`; float $MistViscosity = `floatSliderGrp -q -value $qMistViscosity`; float $MistFriction = `floatSliderGrp -q -value $qMistFriction`; float $MistDamp = `floatSliderGrp -q -value $qMistDamp`; float $MistDensity = `floatSliderGrp -q -value $qMistDensity`;

float $MistBuoyancy = `floatSliderGrp -q -value $qMistBuoyancy`; vector $MColor1 = `colorSliderGrp -q -rgb $qMColor1`; vector $MColor2 = `colorSliderGrp -q -rgb $qMColor2`; vector $MColor3 = `colorSliderGrp -q -rgb $qMColor3`; float $MistShadeQuality = `floatSliderGrp -q -value $qMistShadeQuality`; float $WaterfallEmitter = `floatSliderGrp -q -value $qWaterfallEmitter`; float $WaterfallViscosity = `floatSliderGrp -q -value $qWaterfallViscosity`; float $WaterfallFriction = `floatSliderGrp -q -value $qWaterfallFriction`; float $WaterfallDamp = `floatSliderGrp -q -value $qWaterfallDamp`; float $WaterfallStickiness = `floatSliderGrp -q value $qWaterfallStickiness`; float $WaterfallRadius = `floatSliderGrp -q -value $qWaterfallRadius`;

vector $WColor1 = `colorSliderGrp -q -rgb $qWColor1`; vector $WColor2 = `colorSliderGrp -q -rgb $qWColor2`; vector $WColor3 = `colorSliderGrp -q -rgb $qWColor3`;

makeFallMist ($MistEmitter, $MistBaseRes, $MistGravity, $MistViscosity, $MistFriction, $MistDamp, $MistDensity, $MistBuoyancy, $MColor1, $MColor2, $MColor3, $MistShadeQuality, $WaterfallEmitter, $WaterfallViscosity, $WaterfallFriction, $WaterfallDamp, $WaterfallRadius, $WaterfallStickiness, $WColor1, $WColor2, $WColor3); WaterBlinnMaterial(); } // Collision with Users Geometry procedure. global proc createWaterfallButton2(string $qMistEmitter, string $qMistBaseRes, string $qMistGravity,string $qMistViscosity, string $qMistFriction, string $qMistDamp, string $qMistDensity, string $qMistBuoyancy, string $qMColor1, string $qMColor2, string $qMColor3, string $qMistShadeQuality, string $qWaterfallEmitter,string $qWaterfallViscosity, string $qWaterfallFriction, string $qWaterfallDamp, string $qWaterfallRadius, string $qWaterfallStickiness, string $qWColor1, string $qWColor2, string $qWColor3) { float $MistEmitter = `floatSliderGrp -q -value $qMistEmitter`; float $MistBaseRes = `floatSliderGrp -q -value $qMistBaseRes`; float $MistGravity = `floatSliderGrp -q -value $qMistGravity`; float $MistViscosity = `floatSliderGrp -q -value $qMistViscosity`; float $MistFriction = `floatSliderGrp -q -value $qMistFriction`; float $MistDamp = `floatSliderGrp -q -value $qMistDamp`;

float $MistDensity = `floatSliderGrp -q -value $qMistDensity`; float $MistBuoyancy = `floatSliderGrp -q -value $qMistBuoyancy`; vector $MColor1 = `colorSliderGrp -q -rgb $qMColor1`; vector $MColor2 = `colorSliderGrp -q -rgb $qMColor2`; vector $MColor3 = `colorSliderGrp -q -rgb $qMColor3`; float $MistShadeQuality = `floatSliderGrp -q -value $qMistShadeQuality`; float $WaterfallEmitter = `floatSliderGrp -q -value $qWaterfallEmitter`; float $WaterfallViscosity = `floatSliderGrp -q -value $qWaterfallViscosity`; float $WaterfallFriction = `floatSliderGrp -q -value $qWaterfallFriction`; float $WaterfallDamp = `floatSliderGrp -q -value $qWaterfallDamp`; float $WaterfallStickiness = `floatSliderGrp -q value $qWaterfallStickiness`; float $WaterfallRadius = `floatSliderGrp -q -value $qWaterfallRadius`; vector $WColor1 = `colorSliderGrp -q -rgb $qWColor1`; vector $WColor2 = `colorSliderGrp -q -rgb $qWColor2`;

vector $WColor3 = `colorSliderGrp -q -rgb $qWColor3`; makeFallMist ($MistEmitter, $MistBaseRes, $MistGravity, $MistViscosity, $MistFriction, $MistDamp, $MistDensity, $MistBuoyancy, $MColor1, $MColor2, $MColor3, $MistShadeQuality, $WaterfallEmitter, $WaterfallViscosity, $WaterfallFriction, $WaterfallDamp, $WaterfallRadius, $WaterfallStickiness, $WColor1, $WColor2, $WColor3);

// The presence of this procedure is what makes the difference. collideWithPreGeo(); WaterBlinnMaterial(); } //// The creation of the Mist Emitter and its 3D Container. ////There is a long list of specific attributes that are associated with the Mist. //// Some are customizable, but a majority are not. //// Those that are customable within the User Interface have their strings //// declared within the very beginning of the Mist Emitters section. // Pulling the values from the UI into the attributes of the new emitter. global proc makeFallMist(float $MistEmitter, float $MistBaseRes, float $MistGravity, float $MistViscosity, float $MistFriction, float $MistDamp, float $MistDensity, float $MistBuoyancy, float $MColor1, float $MColor2, float $MColor3, float $MistShadeQuality, float $WaterfallEmitter, float $WaterfallViscosity, float $WaterfallFriction, float $WaterfallDamp, float

$WaterfallRadius, float $WaterfallStickiness, float $WColor1, float $WColor2, float $WColor3) { //file -f -new; playbackOptions -max 500; playbackOptions -e -playbackSpeed 0 -maxPlaybackSpeed 0; ////Emitter and Container creation and connecting. // Creation of Mist's emitter and its 3D fluid container. fluidEmitter; create3DFluid 10 10 10 10 10 10; // // // // The emitter is renamed to avoid conflictions with previously created waterfalls or emitters. This also so the user can distinguish between the liquid emitter and the mist emitter.

string $FluidShape[] = `ls -sl -dag`; rename $FluidShape[1] MistFluidShape; rename fluidEmitter1 MistEmitter; // Connection of the emitter to the 3D fluid container. connectDynamic -em MistEmitter MistFluidShape; // Base Resolution controls the resolution of the mist stream. // The higher the resolution, the better the mist looks, // the slower it runs. setAttr "MistFluidShape.baseResolution" $MistBaseRes; // Contents Method, preset attributes. setAttr "MistFluidShape.densityMethod" 2; setAttr "MistFluidShape.velocityMethod" 2;

setAttr setAttr setAttr setAttr

"MistFluidShape.temperatureMethod" 0; "MistFluidShape.fuelMethod" 0; "MistFluidShape.colorMethod" 0; "MistFluidShape.falloffMethod" 0;

// Display, preset attributes. setAttr setAttr setAttr setAttr setAttr setAttr "MistFluidShape.shadedDisplay" 1; "MistFluidShape.slices" 1; "MistFluidShape.voxelQuality" 2; "MistFluidShape.boundaryDraw" 0; "MistFluidShape.numericDisplay" 0; "MistFluidShape.wireframeDisplay" 2;

//// Dynamic Simulation // Customizable setAttr setAttr setAttr setAttr "MistFluidShape.gravity" $MistGravity; "MistFluidShape.viscosity" $MistViscosity; "MistFluidShape.friction" $MistFriction; "MistFluidShape.velocityDamp" $MistDamp;

// Preset Attributes setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr "MistFluidShape.solver" 1; "MistFluidShape.highDetailSolve" 3; "MistFluidShape.substeps" 1; "MistFluidShape.solverQuality" 20; "MistFluidShape.startFrame" 1; "MistFluidShape.simulationRateScale" 1; "MistFluidShape.gridInterpolator" 0; "MistFluidShape.forwardAdvection" 1; "MistFluidShape.conserveMass" 1; "MistFluidShape.collide" 1; "MistFluidShape.doEmission" 1; "MistFluidShape.doFields" 1; "MistFluidShape.emitInSubsteps" 0;

// Liquids, preset to OFF. setAttr "MistFluidShape.enableLiquidSimulation" 0;

// Auto Resize, preset attributes. setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr "MistFluidShape.autoResize" 1; "MistFluidShape.resizeClosedBoundaries" 1; "MistFluidShape.resizeInSubsteps" 1; "MistFluidShape.resizeToEmitter" 1; "MistFluidShape.maxResolution" 300; "MistFluidShape.dynamicOffsetX" 0; "MistFluidShape.dynamicOffsetY" 0; "MistFluidShape.dynamicOffsetZ" 0; "MistFluidShape.autoResizeThreshold" 0.001; "MistFluidShape.autoResizeMargin" 0;

// Self Attraction and Repulsion, preset to OFF. setAttr "MistFluidShape.selfForce" 0; //// Content Details // Density, some customable attributes, majority are preset. setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr "MistFluidShape.densityScale" $MistDensity; "MistFluidShape.densityBuoyancy" $MistBuoyancy; "MistFluidShape.densityDissipation" 1; "MistFluidShape.densityPressure" 0; "MistFluidShape.densityPressureThreshold" 1; "MistFluidShape.densityNoise" 0; "MistFluidShape.densityTension" 0; "MistFluidShape.tensionForce" 0; "MistFluidShape.densityGradientForce" 0;

// Velocity, preset attributes. setAttr setAttr setAttr setAttr setAttr "MistFluidShape.velocityScaleX" 1; "MistFluidShape.velocityScaleY" 1; "MistFluidShape.velocityScaleZ" 1; "MistFluidShape.velocitySwirl" 0; "MistFluidShape.velocityNoise" 0;

// Turbulence, preset attributes.

setAttr "MistFluidShape.turbulenceStrength" 0; setAttr "MistFluidShape.turbulenceFrequency" 1.198; setAttr "MistFluidShape.turbulenceSpeed" 0.757; // Grids Cache, preset attributes. setAttr setAttr setAttr setAttr setAttr setAttr setAttr "MistFluidShape.loadDensity" 1; "MistFluidShape.loadVelocity" 1; "MistFluidShape.loadTemperature" 1; "MistFluidShape.loadReaction" 1; "MistFluidShape.loadColor" 1; "MistFluidShape.loadTextureCoordinates" 1; "MistFluidShape.loadFalloff" 1;

// Surface, preset to Volume Render. setAttr MistFluidShape.surfaceRender 0; setAttr "MistFluidShape.surfaceThreshold" 0.01; // Output Mesh, preset attributes. setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr "MistFluidShape.meshMethod" 0; "MistFluidShape.meshResolution" 2; "MistFluidShape.meshSmoothingIterations" 0; "MistFluidShape.colorPerVertex" 0; "MistFluidShape.incandescencePerVertex" 0; "MistFluidShape.uvwPerVertex" 0; "MistFluidShape.opacityPerVertex" 0; "MistFluidShape.useGradientNormals" 0; "MistFluidShape.velocityPerVertex" 1;

// Shading, transparency only customizable. setAttr "MistFluidShape.transparency" -type double3 0.322683 0.322683 0.322683; setAttr "MistFluidShape.glowIntensity" 0; setAttr "MistFluidShape.dropoffShape" 0; // Color, actual color of mist is customizable.

setAttr "MistFluidShape.color[0].color_Color" -type double3 $MColor1 $MColor2 $MColor3; // Opacity, preset attribute. setAttr "MistFluidShape.opacityInputBias" 0.3; // Matte Opacity, preset attribute. setAttr "MistFluidShape.matteOpacity" 1; // Shading Quality, only quality is customizable. setAttr setAttr setAttr setAttr "MistFluidShape.quality" $MistShadeQuality; "MistFluidShape.contrastTolerance" 0.01; "MistFluidShape.sampleMethod" 3; "MistFluidShape.renderInterpolator" 0;

// Textures, preset attributes. setAttr setAttr setAttr setAttr setAttr "MistFluidShape.colorTexture" 0; "MistFluidShape.incandTexture" 0; "MistFluidShape.opacityTexture" 0; "MistFluidShape.textureType" 0; "MistFluidShape.coordinateMethod" 0;

// Lighting, preset attributes. setAttr "MistFluidShape.selfShadowing" 1; setAttr "MistFluidShape.hardwareSelfShadow" 1; setAttr "MistFluidShape.shadowOpacity" 0.5; setAttr "MistFluidShape.shadowDiffusion" 1; setAttr "MistFluidShape.lightType" 1; setAttr "MistFluidShape.lightBrightness" 1.188; setAttr "MistFluidShape.fluidLightColor" -type double3 1 1 1 ; setAttr "MistFluidShape.ambientBrightness" 0.298; setAttr "MistFluidShape.ambientDiffusion" 2.320 ; setAttr "MistFluidShape.ambientColor" -type double3 0.494 0.6964 1 ; setAttr "MistFluidShape.realLights" 1; setAttr "MistFluidShape.directionalLightX" 1;

setAttr "MistFluidShape.directionalLightY" 0.3; setAttr "MistFluidShape.directionalLightZ" 0.2; // Render Stats, preset attributes. setAttr setAttr setAttr setAttr setAttr setAttr "MistFluidShape.castsShadows" 1; "MistFluidShape.receiveShadows" 1; "MistFluidShape.primaryVisibility" 1; "MistFluidShape.smoothShading" 1; "MistFluidShape.visibleInReflections" 0; "MistFluidShape.visibleInRefractions" 0;

//// MistEmitter Settings // The following settings are changes to the emitter. // Basic Emitter Attributes setAttr "MistEmitter.emitterType" 4; setAttr "MistEmitter.rate" $MistEmitter; setAttr "MistEmitter.cycleEmission" 0; // Fluid Attributes setAttr setAttr setAttr setAttr setAttr setAttr setAttr "MistEmitter.densityMethod" 1; "MistEmitter.fluidDensityEmission" 2; "MistEmitter.heatMethod" 1; "MistEmitter.fluidHeatEmission" 1; "MistEmitter.fuelMethod" 1; "MistEmitter.fluidFuelEmission" 1; "MistEmitter.fluidDropoff" 0;

// Emission Speed Attributes setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr "MistEmitter.speedMethod" 2; "MistEmitter.inheritVelocity" 2; "MistEmitter.alongAxis" 0; "MistEmitter.aroundAxis" 0; "MistEmitter.directionalSpeed" 0; "MistEmitter.directionX" 1; "MistEmitter.directionY" 0; "MistEmitter.directionZ" 0;

// Fluid Emission Turbulence setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr setAttr "MistEmitter.turbulenceType" 0; "MistEmitter.turbulence" 1.497; "MistEmitter.turbulenceSpeed" 1; "MistEmitter.turbulenceFrequencyX" 1; "MistEmitter.turbulenceFrequencyY" 1; "MistEmitter.turbulenceFrequencyZ" 1; "MistEmitter.turbulenceOffsetX" 0; "MistEmitter.turbulenceOffsetY" 0; "MistEmitter.turbulenceOffsetZ" 0; "MistEmitter.detailTurbulence" 0;

// Volume Emitter Attributes setAttr setAttr setAttr setAttr setAttr setAttr "MistEmitter.volumeShape" 1; "MistEmitter.volumeOffsetX" 0; "MistEmitter.volumeOffsetY" 0; "MistEmitter.volumeOffsetZ" 0; "MistEmitter.volumeSweep" 360; "MistEmitter.normalizedDropoff" 1;

// Create an emiter for the waterfall using nParticles emitter -pos 0 0 0 -type volume; nParticle; // // // // The emitter is renamed to avoid conflictions with previously created waterfalls or emitters. This also so the user can distinguish between the waterfall emitter and the mist emitter.

string $nParticleShape[] = `ls -sl -dag`; rename $nParticleShape[1] WaterfallnParticleShape; rename emitter1 WaterfallEmitter; // Connection of the emitter to the 3D fluid container. connectDynamic -em WaterfallEmitter WaterfallnParticleShape;

//Lifespan setAttr "WaterfallnParticleShape.lifespanMode" 0; //Particle Size setAttr "WaterfallnParticleShape.radius" $WaterfallRadius; setAttr "WaterfallnParticleShape.radiusScale[0].radiusScale_Posit ion" 0; setAttr "WaterfallnParticleShape.radiusScale[0].radiusScale_Float Value" 1; setAttr "WaterfallnParticleShape.radiusScale[0].radiusScale_Inter p" 0; setAttr "WaterfallnParticleShape.radiusScaleInput" 6; setAttr "WaterfallnParticleShape.radiusScaleInputMax" 1; setAttr "WaterfallnParticleShape.radiusScaleRandomize" 0.132; //Collisions setAttr "WaterfallnParticleShape.collide" 1; setAttr "WaterfallnParticleShape.collideStrength" 1; setAttr "WaterfallnParticleShape.collisionLayer" 0; setAttr "WaterfallnParticleShape.collideWidthScale" 0.5; setAttr "WaterfallnParticleShape.selfCollideWidthScale" 1; setAttr "WaterfallnParticleShape.solverDisplay" 0; setAttr "WaterfallnParticleShape.bounce" 0; setAttr "WaterfallnParticleShape.friction" $WaterfallFriction; setAttr "WaterfallnParticleShape.stickiness" $WaterfallStickiness; setAttr "WaterfallnParticleShape.maxSelfCollisionIterations" 4; //// Dynamic Simulation //Dynamic Properties

setAttr setAttr setAttr setAttr setAttr setAttr

"WaterfallnParticleShape.dynamicsWeight" 1; "WaterfallnParticleShape.conserve" 1; "WaterfallnParticleShape.damp" $WaterfallDamp; "WaterfallnParticleShape.drag" 0; "WaterfallnParticleShape.pointMass" 1; "WaterfallnParticleShape.ignoreSolverGravity" 0;

//Mass Scale setAttr "WaterfallnParticleShape.massScale[0].massScale_Position" 0; setAttr "WaterfallnParticleShape.massScale[0].massScale_FloatValu e" 1; setAttr "WaterfallnParticleShape.massScaleInputMax" 1; setAttr "WaterfallnParticleShape.massScaleRandomize" 0; // Liquids, preset to ON. setAttr "WaterfallnParticleShape.enableSPH" 1; setAttr "WaterfallnParticleShape.incompressibility" 1; setAttr "WaterfallnParticleShape.restDensity" 2; setAttr "WaterfallnParticleShape.radiusScaleSPH" 0.65; setAttr "WaterfallnParticleShape.viscosity" $WaterfallViscosity; //Output mesh setAttr setAttr setAttr setAttr setAttr "WaterfallnParticleShape.meshMethod" 0; "WaterfallnParticleShape.threshold" 0.86; "WaterfallnParticleShape.blobbyRadiusScale" 1; "WaterfallnParticleShape.motionStreak" 0; "WaterfallnParticleShape.meshTriangleSize" 0.5;

//Shading setAttr "WaterfallnParticleShape.particleRenderType" 7; setAttr "WaterfallnParticleShape.opacity" 0.083; setAttr "WaterfallnParticleShape.color[0].color_Color" type double3 $WColor1 $WColor2 $WColor3;

// Render Stats, preset attributes. setAttr setAttr setAttr setAttr setAttr "WaterfallnParticleShape.castsShadows" 1; "WaterfallnParticleShape.receiveShadows" 1; "WaterfallnParticleShape.primaryVisibility" 1; "WaterfallnParticleShape.visibleInReflections" 1; "WaterfallnParticleShape.visibleInRefractions" 1;

//// Waterfall Emitter Settings // The following settings are changes to the emitter. // Basic Emitter Attributes setAttr "WaterfallEmitter.emitterType" 4; setAttr "WaterfallEmitter.rate" $WaterfallEmitter; setAttr "WaterfallEmitter.cycleEmission" 0; //Distance/Direction Attributes setAttr "WaterfallEmitter.directionX" 1; setAttr "WaterfallEmitter.directionY" 0; setAttr "WaterfallEmitter.directionZ" 0; // Emission Speed Attributes setAttr "WaterfallEmitter.speedRandom" 0; // Volume Emitter Attributes setAttr setAttr setAttr setAttr setAttr } "WaterfallEmitter.volumeShape" 1; "WaterfallEmitter.volumeOffsetX" 0; "WaterfallEmitter.volumeOffsetY" 0; "WaterfallEmitter.volumeOffsetZ" 0; "WaterfallEmitter.volumeSweep" 360;

//Add a blinn texture to the waterfall particles global proc WaterBlinnMaterial() { shadingNode -asShader blinn;

sets -renderable true -noSurfaceShader true -empty -name blinn1SG; connectAttr -f blinn1.outColor blinn1SG.surfaceShader; rename blinn1 "WaterBlinn" ; defaultNavigation -createNew -destination "WaterBlinn.transparency"; createRenderNode -allWithTexturesUp "defaultNavigation force true -connectToExisting -source %node -destination WaterBlinn.transparency" ""; defaultNavigation -defaultTraversal -destination "WaterBlinn.transparency"; shadingNode -asUtility particleSamplerInfo; defaultNavigation -force true -connectToExisting -source particleSamplerInfo1 -destination WaterBlinn.transparency; window -e -vis false createRenderNodeWindow; rename particleSamplerInfo1 "WaterparticleSamplerInfo" ; select -r nParticle1 ; hyperShade -assign blinn1SG; sets -e -forceElement blinn1SG; } //// Collision with present objects in scene. //// This procedure is only activated when the appropriate button //// is pressed within the UI. global proc collideWithPreGeo() { // Establishes that all geometry will collide with the Mist. select -all; select -d WaterfallEmitter nParticle1 nucleus1; doMakeCollideFluid 1 { "200" } ; select -all; select -d WaterfallEmitter nParticle1 nucleus1 MistEmitter fluid1 nucleus1; makeCollideNCloth;

S-ar putea să vă placă și