Upload
phamdiep
View
242
Download
2
Embed Size (px)
Citation preview
OUTLIN
EIntroduction
UsingBlender
ImportingDatafromParaview
UsingBlenderDirectlywithVTKandPython
3
7
18
34
INTRO
DUCTIO
NIntroduction
What:UseBlenderandVTKtoproducemorerealisticrenderingsofdatageneratedinOpenFOAM
Why:• Highqualityvisualizationsareexcitingtolookatandcanattracttheinterestofnon‐science
types.• Goodformarketingimagesorotherapplicationswhereformmightoutweighfunction• Notasuitablealternativetoastandardpost‐processingprogramsuchasParavieworEnsight
Ojectivesofthistutorial:• LearnBlenderUI• ExportdatafromParaviewandimportinBlender• UnderstandbasicsofmaterialpropertiesinBlender• Learnhowtocreatecameras• Learnhowtosetuplights• PerformbasicrenderinginBlender• DemonstratedirectVTK/Blenderintegration
INTRO
DUCTIO
NSoftwareOverview
Blender:• Opensource3Drenderingsoftware• www.blender.org• www.blenderartists.org• Largecommunityandactivelydeveloped• Reasonablystable• Highlyscriptable• Currentreleaseis2.5x
• BasedonPython3.x• Veryniceinterface• Faster,higherqualityrendering
• Blender2.49bisusedduringthistutorial• BasedonPython2.x• Slowerrendering• Notasuserfriendly
VTK:• VisualizationToolkit• PowerfulopensourceC++LibrariesusefulformanipulatingdatabyKitware• ParaviewisbasedonVTK• VTKcontainsPython2.xwrappers• CurrentlynoPython3.xsupport
*BasicknowledgeofOpenFOAM,Python,andParaviewareassumedforthistutorial
INTRO
DUCTIO
NMethod1
Simple:A. GenerateOpenFOAMdataB. VisualizeinParaviewC. RenderinBlender
Pros:• RequiresfewerBlenderskills• Mostusersarealreadyfamiliar
withParaview• Noscriptingneeded• ModelscanbemovedtoBlender
2.5x
Cons:• Cannotrenderanimations(orit
wouldbeverypainfultodoso)• Requirestheintermediatestepof
usingParaview
Method2
Complex:A. GenerateOpenFOAMdataB. UseVTKpythonwrappingtoreaddata
intoBlenderwithblenderVTK.pymodule
C. RenderinBlender
Pros:• Everythingdonefrominsideof
Blender• Capableofrenderinganimations/time‐
dependentdata
Cons:• ScriptingrequiredwithbothBlender
andVTKmodules
GETTIN
GSTARTED
StaringBlenderandUnderstandingtheUI
• Fromaterminaltype“blender”• Mousebuttonsaredifferentfrommostprograms:
• OtherImportantShortcuts
Button Function
LMB Move3dCursor
RMB Select
MMB RotateModel
Shift+MMB Pan
Ctrl+MMB/Scroll Zoom
Button Function
LMB Move3dCursor
RMB Select
MMB RotateModel
Shift+MMB Pan
Ctrl+MMB/Scroll Zoom
Esc StopCurrentAction
Ctrl+Z UNDO!
F12 RenderImage
Tab Switchbetweenobjectandeditmode
Shift+D Duplicate
GETTIN
GSTARTED
StaringBlenderandUnderstandingtheUI
OptionButtons
WindowMode
SwitchViews
SwitchBetweenObject/EditMode
DefaultCube
AxisTriad
Light
3dCursor
Camera
GETTIN
GSTARTED
StaringBlenderandUnderstandingtheUI
1. RMBbetweenframes2. Click“SplitArea”3. CreateSecondArea4. RMBCamerain3Dview5. InsmallFrameLMB
View>>Cameras>>SetActiveObjectAsActiveCamera
Wecannowseethe3dView,plustheviewthecamerawillsee
GETTIN
GSTARTED
Rotating/Translating/ScalingGeometry
Button Function
G Grab
S Scale
R Rotate
(G,S,R)>>(X,Y,Z) Grab,Scale,orRotatealongX,Y,orZaxis
CreateSimple3PointLighting:1. RMBthelightsource2. Shift+Dtoduplicate3. Dragnewlighttobehindtheboxand
thenLMBwheninplace4. Shift+Dtoduplicateagain5. Dragnewlighttothesideofthecamera
andLMBtoplace6. Thesearetheiill,backlightandkeylights
12
3
GETTIN
GSTARTED
AdjustLightProperties
AdjusttheKeyLight:
Thekeylightshouldbeabout2Xasbrightastheiill:1. RMBthekeylight2. SelecttheShadingtab(F5)3. DoubleclicktheEnergyBoxandAdjustto2.004. RMBthebacklight5. ChangeEnergyto0.5 2
31
GETTIN
GSTARTED
Addagroundplane(meshobject)
Nowaddagroundplane:1. ‘Spacebar’>>Add>>Mesh>>Plane2. Planewillbeaddedatthe3dCursor3. ‘S’,‘10’toscale10units4. ‘G’,‘Z’,‘‐1’tomoveitdown1unitintheZ
direction
31
PARA
VIEWANDBLEN
DER
ReadVTKdataintoParaview
1. OpenParaview(Earlierthan3.10)–Notsurewhytheexporttooldoesnotworkin3.10
2. OpenexampleFluid.vtk3. Openmonkey.stl
PARA
VIEWANDBLEN
DER
GenerateDatainParaview
1. Selecttheiluidiileandcreateastreamtraceriilter
2. OntheStreamTracerFilter:I. SettheVectorstoUII. Settheseedlocationto(‐2,0,0)III. Changethenumberofseed
pointsto303. SelecttheStreamTracerandaddaTubeiilter
I. Changetheradiusofthetubesto0.05
4. ColortheTubesbyU
PARA
VIEWANDBLEN
DER
ExportParaviewData
1. HidetheFluidBox2. File>>Export>>vrmlThevrmlexporterisWYSWYG—thereforemakesureeverythingyouwantexportedisshown/coloredthewayyoulike
PARA
VIEWANDBLEN
DER
PrepBlenderforParaviewData
1. Switchtheboxontherighttotheoutlinermode
2. Thenselectthebox3. Deletedtheboxbypressing‘X’andclicking
the‘EraseselectedObject(s)’
PARA
VIEWANDBLEN
DER
ImportParaviewDataintoBlender
1. Importthevrmliile:I. File>>Import>>X3Dand
VRML97II. SelecttheiileIII. SelectLoadIV. Select‘OK’toimportthe
hierarchy2. ThedatafromParaviewloadsintoblenderwithsomeotherdatasuchaslightsandviewpoints
PARA
VIEWANDBLEN
DER
ClearoutExcessParaviewData
1. Shift+Clickeachofthe“DirectLight”(notthe“lamp”)objectsandthe“viewpoint”objectintheoutlinerpanel
2. ‘X’toDeletealloftheseobjects
PARA
VIEWANDBLEN
DER
TurnonDataColorMap
1. Selectthestreamlines(RMB)2. Clickthebuttonforthematerial
context3. Turnon‘VcolPaint’
1
2
3
PARA
VIEWANDBLEN
DER
RenderButton
AddingNewmaterials:• It’susuallymostefiicienttousematerials
alreadycreatedandimporttheminsteadofcreatingfromscratch
1. Downloada.blendiilewithmaterialsofinterest
2. Appendthenew.blendiiletothecurrentiile3. File>>AppendorLink>>Colored
Glass.blend>>scene>>scene4. ClickLoad
Thenewmaterialsshouldnowbepartofthelibrary
PARA
VIEWANDBLEN
DER
RenderButton
1. Selectthemonkey(RMB)2. Gotothematerialssettings3. IntheMA:LinktoObjectiield,changeto
CG001
1
23
GETTIN
GSTARTED
RotatetheGeometryandCleanuptheShadows
1. Rotatethemonkeyandthestreamlines90degreestobetterfacethecamera
2. ‘R’–torotate,‘X’–fortheXaxis,‘90’–for90degrees
5. RemovetheshadowsfromtheFillandBackLightsby:
• Selectthebacklight• Selectthematerialtab• UnchecktheRayShadowtab
PARA
VIEWANDBLEN
DER
ChangetheCameraPosition
Adjustthecameratozoominonthesubject1. Selectthecamera(RMB)2. Clickuse3dmanipulatorand3dtranslator3. Grabandslidethearrowstomovethe
camera1
23
PARA
VIEWANDBLEN
DER
EighthRender
1. Renderingtheplane,monkeywithglassproperties,andColoredstreamlines
VTKBLEN
DERIN
TEGRA
TION
BlenderPythoninterpreter
Blenderhasapythoninterpreter.UsingtheVTKpythonwrappersandamodulecalledVTKblenderbyUniversityofAlbertaCSdepartment.
Thismodulecaniteratethroughanimationsortimedependentdata. 1
23
VTKBLEN
DERIN
TEGRA
TION
VTKPythonDemo
StepstorunningtheUAICTDemo:1. CopyVTKBlend.pyto/usr/lib/python26/
(Youwillneedtosudoforthiscommand)2. OpentheVTKBlender_demo2.py3. Gototherenderingtab4. ClickANIM
ThisdemoworksbyusingVTKtogeneratethedataandthenreplaceameshiilewiththenewmeshdataateachtimestep
1
23
CONCLU
SIONS
Summary
Conclusions:• Blenderisagreattoolforhigh‐qualityrendering• Thereisabitofalearningcurve,butitismanageable• Blender2.5Xismuchnicerandfaster,however,itisbuiltonpython3.0(VTKis2.xonly)anditcurrentlydoesnotimportvrmliilesdirectly• Blender2.49iilescanbeopenedin2.5x,soif2.5xispreferred,theiilecanbeimportedin2.49andthenusedin2.5x• BlenderisnotasuitablealternativetoParavieworothertruedatavisualizationpackage• Renderingisanartandisafairlyindepthsubject