Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 1 Knowledge Worth Sharing Petrel TIPS&TRICKS from SCM, Inc. MakeItSnowWorkflow Manhasdreamedofcontrollingtheweathersincebeforefireandbeforethewheel.Now,withPetrel, mancanachievethisgoal.UsingaPetrelWorkflowwehavemadeitsnowinawindowseenin3Dspace. Granted,thisisasmallstepformankind,butasaPetreluserthiscouldbeagiantleapforwardinyour workflowknowledge.ThisPetrelTIPS&TRICKSwalksyouthroughtheloopsandmethodsneededto simulatefallingsnow.ImaginetellingyourfamilyandfriendsduringtheHolidaypartiesthatyouwere abletomakeitsnow.Youwillbethetalkof theparty! Figure:Logicalflowintheevolutionofhumantechnology. ThisSnowfallworkflowusesasingleloopandanestedpairofloopstomakeitsnow.Therearenospecial tricks(otherthanrandomnumbergeneration)beingusedandnoexoticprocessesbeingexecuted.For thatreasonthisworkflowmakesanexcellentTIPS&TRICKSexample.Thefollowingdiscussionwillwalk youthroughthelogicanddesignoftheworkflow. Design Thegeneraldesignofanyworkflowshouldbeplannedbeforestartingtobuildit.Theauthorsnormallydo thisusinganoutlineand/oraseriesofsketches(thesearepresentedinfiguresinthesectionbelow). Oncetheplanisfinishedworkflowconstructionbegins.ThissameapproachwasusedfortheSnowfall workflow. Fire Wheel Petrel Make Snow Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 2 SkeletonWorkflow Firstaskeletonworkflowtellingwhatishappeningateachstepiscreated.Thisworkflowcontains messagesandcommentsandanylogicrequiredtomaketheworkflowexecute.Whenexecuted,the SkeletonworkflowwillwriteanoutlineoftheprocessingstepstothePetrelmessagelog. OncetheSkeletonworkflowisworkingcorrectlythentheexecutablecommandsareslowlyaddedusing properQCalongtheway.Thisslowenhancementcontinuesuntiltheworkflowiscompleteandthe resultscorrect. Figure:Skeletonworkflowcontainingonlylogicandmessagestoindicatewhetherthedesignworks correctly. Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 3 Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 4 Figure:MessageloggeneratedbytheSkeletonworkflow. LogicandProcessingSteps TheinputandstepsrequiredtomakeitsnowinPetrelareoutlinedinthefiguresbelow.Followingeach figure(s)isthecompletedportionoftheworkflowthatperformsthatfunction. UserInputtoWorkflow Inputthattheuserprovidestheworkflowincludes: Polygonrepresentingthesnowflake X‐Ylimitsofthesnowfallarea Numberofflakes Numberoftimestoshifttheflakesdownward Distancetoshifttheflakedownward(thelargerthisdistancethefastertheflakemoves) Figure:TheUserusesMake/editPolygonstocreateasnowflake(left)anddefinestheX‐Ylimitsofthe Snowarea(right).Bothareenteredintotheworkflow.Notetheoriginalsnowflake(bluestar)isnotinthe Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 5 area;itslocationcanbeanywhere.Thesnowflakeandsnowareashouldbesizedsothattheflakeandits detailareeasilyseenwhendisplayedinthesnowarea. Figure:TheUserspecifies,asinputtotheworkflow,thenumberofsnowflakestobemade,distanceeach flakeshouldfall(shiftincrement),andnumberoftimeseachflakeshouldfall(beshifteddownward). Notethedashedlinerepresentsthesnowareawithaflakestartinginarandompositionandbeing shifteddownandoutoftheareabyequalshiftincrements. Number of flakes Fall distance ( shift increment ) Snow Area Xmin = 0 Xmax = 3700 Ymin = 1000 Ymax = 6000 Number of falls ( shifts ) Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 6 Figure:PortionoftheWorkflowusedtoinputfilesfoldersandparameters. Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 7 CreateSeedSnowflake TomakeiteasyfortheprogramtocreatemanysnowflakesitneedstohaveoneflakeinaknownX‐Y position.Theoriginalinputflakeiscopiedandthecopyisnamedandmovedtothelowerleftcornerof thesnowarea.Thiscopiedflakebecomestheseedforcreatingallsnowflakesusedbytheworkflow. Figure:TheWorkflowmakesacopyofthesnowflake,determinesitsmin‐Xandmin‐Yposition,calculates theshiftsneededtogetittoXminandYminoftheSnowarea,andtranslatesthecopiedflaketolower leftcornerofSnowarea. Figure:PortionoftheWorkflowusedtocreateandpositiontheseedsnowflake. Dy Dx Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 8 CreateSnowflakes Thesnowflakesarecreatedbycopyingtheseedflakeandthenrandomlypositioningthecopiesinthe snowarea.Eachcopyisthenresized,madetoappearrotatedandgivenacolor. Figure:TheWorkflowrandomlypicksavaluebetween0andX‐rangeofthesnowareaandanother between0andY‐rangeoftheareaandshiftsacopyoftheseedsnowflakebythosevalues,itrandomly resizestheshiftedflake(usingamultiplierbetween1and3),itrandomlyrotatestheflake(scalesXby randomnumberbetween.4and1.0andsimilarlyY),anditrandomlycolorstheflake(assignsarandomZ between0and300totheflake,withthecolortablesettingthecolor). Figure:PortionoftheWorkflowusedtocreatethesnowflakesandplacethemrandomlyinthesnow area. Dy Dx Randomly position co py in snow area Randomly resize snow flake Randomly rotate snow flake Randomly shift Z of snow flake ( color ) Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 9 DeleteSeedFlake Oncethesnowflakesarebuilttheseedsnowflakeisnolongerneeded. Figure:PortionoftheWorkflowusedtodeletetheseedsnowflake. MakeSnowFall Thesnowflakesthathavebeenplacedinthesnowareaaremadetofallbyshiftingeachflakedown(in theYdirection)bytheshiftincrement.Thisisdoneasmanytimesaswasspecifiedintheinput parameters. Figure:Thesnowflakesareallshiftedoneincrementdownandthentheshiftprocessisrepeated.This givestheillusionofthesnowfalling.Cartoonexampleofoneflakebeingshifted(left)andseveralbeing shifted(right). One snowflake shifted many times All snowflakes shifted many times Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 10 Figure:PortionoftheWorkflowusedshiftthesnowflakesdownward(makeitsnow). FinalDisplay Toadd“realism”tothedisplayawindowwascreatedusingpolygons.Aseriesoflineswerecreatedthat lookedlikethe sill and outlineofthe pains in a window. Thesewindowpolygons were located over an areajustbelowthesnowarea(south).Thisallowedthesnowtobecreatedbytheworkflowandthento passbehind(outside)thewindowastheflakesmoveddownward. [...]...Figure: Window with snow falling “outside”. Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc – All Rights Reserved 11 . Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 5 area;itslocationcanbeanywhere.The snow flakeand snow areashouldbesizedsothattheflakeandits detailareeasilyseenwhendisplayedinthe snow area. . Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright © 2000-2009 SCM, Inc. – All Rights Reserved 7 CreateSeedSnowflake To make it easyfortheprogramtocreatemanysnowflakes it needstohaveoneflakeinaknownX‐Y position.Theoriginalinputflakeiscopiedandthecopyisnamedandmovedtothelowerleftcornerof the snow area.Thiscopiedflakebecomestheseedforcreatingallsnowflakesusedbytheworkflow. Figure:TheWorkflowmakesacopyofthe snow flake,determinesitsmin‐Xandmin‐Yposition,calculates theshiftsneededtoget it toXminandYminofthe Snow area,andtranslatesthecopiedflaketolower leftcornerof Snow area. Figure:PortionoftheWorkflowusedtocreateandpositiontheseedsnowflake. Dy. Inc. Make It Snow Workflow Manhasdreamedofcontrollingtheweathersincebeforefireandbeforethewheel.Now,withPetrel, mancanachievethisgoal.UsingaPetrelWorkflowwehavemade it snow inawindowseenin3Dspace. Granted,thisisasmallstepformankind,butasaPetreluserthiscouldbeagiantleapforwardinyour workflowknowledge.ThisPetrelTIPS&TRICKSwalksyouthroughtheloopsandmethodsneededto simulatefalling snow. ImaginetellingyourfamilyandfriendsduringtheHolidaypartiesthatyouwere ableto make it snow. Youwillbethetalkof theparty! Figure:Logicalflowintheevolutionofhumantechnology. ThisSnowfallworkflowusesasingleloopandanestedpairofloopsto make it snow. Therearenospecial tricks(otherthanrandomnumbergeneration)beingusedandnoexoticprocessesbeingexecuted.For thatreasonthisworkflowmakesanexcellentTIPS&TRICKSexample.Thefollowingdiscussionwillwalk youthroughthelogicanddesignoftheworkflow. Design Thegeneraldesignofanyworkflowshouldbeplannedbeforestartingtobuild it. Theauthorsnormallydo thisusinganoutlineand/oraseriesofsketches(thesearepresentedinfiguresinthesectionbelow). Oncetheplanisfinishedworkflowconstructionbegins.ThissameapproachwasusedfortheSnowfall workflow. Fire Wheel Petrel Make Snow Petrel is a mark of Schlumberger 4801 Woodway Drive, Suite 150W • Houston, TX 77056 • www.scminc.com • info@scminc.com Copyright