290 likes | 298 Views
Computer Animation Ying Zhu Georgia State University. Fluids. Computational Fluid Dynamics. Blender uses the Lattice Boltzmann method (LBM) to simulate fluids For more details see http://en.wikipedia.org/wiki/Lattice_Boltzmann_methods http://math.nist.gov/mcsd/savg/parallel/lb/.
E N D
Computational Fluid Dynamics • Blender uses the Lattice Boltzmann method (LBM) to simulate fluids • For more details see • http://en.wikipedia.org/wiki/Lattice_Boltzmann_methods • http://math.nist.gov/mcsd/savg/parallel/lb/
Creating fluids • The process • Model the scene (objects, materials, etc.) • Specify the “Domain” in which the fluid will flow • Select the objects that may collide with the fluid and specify their functions • Create the fluid sources and specify their parameters • Bake the fluid simulation • Play back the fluid simulation (with Alt + A, etc.)
Domain • A “domain” is a bounding box for fluid simulation • Use the bounding box of the object regardless of its shape • Only one fluid domain is allowed for each scene • All fluid objects must be in the domain • No fluid will be simulated outside the domain • Multiple fluids should not collide with each other in their initial position
Domain • Add a cube to the scene, move and resize the cube to cover the area that you want the fluid to be simulated • In “Object”, “Physics buttons” panel, “Fluid” tab • Press “Fluid” button • Press “Domain” button
Domain parameters: resolution • Resolution • Setting the resolution higher will give you better visual quality • But it will require more memory usage • Also the computation will be slower • Adjust the resolution number based on your computer’s memory capacity • Otherwise the computer may crash • You can see the “Req. BAKE Mem.” number changes as you adjust Resolution
Domain parameters: time • Start and End Time • There are two time periods related to fluid simulation • Simulation time: the Start and End time (in seconds) in the “Fluid” tab • Animation time: the Start and End frames in the Anim(ation) tab under the Scene (F10) panel
Simulation time and Animation Time • The “simulation time” is used by fluid physics solver to calculate the behavior of fluid • The simulation is then spread over the frame numbers specified in the Anim(ation) tab in the final rendering • Animation Time == Simulation Time: Slow motion • Animation Time > Simulation Time: Slow motion • Animation Time < Simulation Time: Fast Forward
Fluid Baking and Animation Time Frames • When baking fluids, Blender will ignore the Start frame in the Anim tab • Blender always bakes fluid from frame #1 to the End frame number specified in Anim tab
Simulation time and Animation Time • Suppose in the Fluid tab (under Domain) you have Start Time = 0.0 (second), End Time = 10.0 (seconds) • The fluid solver will simulate fluid for 10 seconds • This means the simulation lasts 250 frames long • The standard frame rate is 25 frames per second • If in the Anim tab, the End frame number is 250, then the simulation will be played in regular speed when you play the animation
Simulation time and Animation Time • If in the Anim tab, the End frame number is larger than 250, then the simulation will be played in slow motion when you play the animation • If in the Anim tab, the End frame number is smaller than 250, then the simulation will be sped up when you play the animation
Domain parameters: bake • Press the “BAKE” button to bake the fluid simulation • Unlike particles and clothes, fluid baking is not automatically started when you press Alt + A • You must BAKE first, and then press Alt + A to play back the animation • You should specify the Path for storing files created during baking in the Fluid tab (default is /tmp) • The baking progress is displayed in header bar
Domain Parameters: viscosity and real-world size • Viscosity: resistance to flow in a fluid • In the Fluid tab, under “Domain”, press “Ad” button, and adjust the viscosity • Can choose predefined settings for water, oil, and honey • Can manually adjust viscosity • “Realworld-size”: the size of the Domain box in meters • Adjust this number to match the size of the fuild in your virtual world
Domain parameters: Particles • In the Fluid tab, under “Domain”, press “Par” button • Can adjust • Tracer Particles: generate particles to trace where the water level used to be • Generate Particles: generate particles when water is splashed • Compare the results with and without particles at http://wiki.blender.org/uploads/9/90/Manual-FluidSimParts.jpg
Fluid parameters • Volume init • Volume: the space enclosed by the object is treated as fluid (only works for closed mesh) • Shell: the surface (and a thin shell surrounding it) of the object is considered as fluid (works for both closed and open mesh) • Both (volume and shell)
Interacting with obstacle • Select the object to be collided with fluid, in Fluid tab, press “Fluid” and then “Obstacle” • Volume init: which part of the object will be colliding with the fluid • Boundary type • Noslip: the obstacle is sticky • Free: the obstacle is slippery • Part: somewhere in between • Moving object must be “Noslip”
Inflow object • Select an object, in Fluid tab, press “Fluid” and then “Inflow” • There is no need to create a separate Fluid object • This object will constantly inject fluid into the domain • Can be used to simulate tap, fountain, etc. • Adjust Inflow velocity (e.g. Z = -0.2) to change the volume of inflow fluid • Enable “Local Coords” if the Inflow object is animated
Outflow object • Select an object, in Fluid tab, press “Fluid” and then “Outflow” • The fluid will disappear when it touches the Outflow object • In other words, the Outflow object “kills” the fluid • Can be used to simulate sink, etc.
Control object • Make an object attract or repel fluid • E.g. object with magic force • Can make the simulation really slow • Time: the time period (in seconds) the control object is activated • Attraction force • Velocity force • How much influence of the control object velocity has on the fluid
Control object • Example • http://www.youtube.com/watch?v=WruTNnF6Ztg
How to create material for fluid? • Select the Domain object • Go to “Material Buttons” panel • In “Mirror Transp” tab, press “Ray Transp” and set IOR (Index of Refraction) to 1.33 (one tutorial suggests 1.17) • Press “Ray Mirror” and set “RayMir” to 0.11 • Set Alpha to 0.109 • Set Color to R=0.17, G=0.50, B = 0.89
Animating fluid parameters • Blender has a special IPO Curve for Fluid Simulation • Select the fluid Domain object, open an IPO Curve Editor window • Select FluidSim type • FluidSim IPOs cannot be keyframed by simply using the I key • You must manually set values by pressing Ctrl + LMB in the IPO window.
Parameters that can be animated • For fluid Domain object • Fac-Visc: changes fluid viscosity • Fac-Time: change the speed of the simulation • 0 freezes the simulation • 1.0 is normal speed • < 1.0 slow motion • > 1.0 fast forward • GravX/GravY/GravZ: change gravity over time • E.g. in space or in a speeding car (?)
Parameters that can be animated • For Fluid, Inflow, or Outflow objects • VelX, VelY, VelZ: animate fluid velocity • Active: takes two values -- Zero or non-Zero • Zero: the fluid disappear • Anything above zero: the fluid appears • Can simulate dripping by animating the Active parameter
How to make fluid simulation start later than frame #1? • Note that fluid baking always starts from frame #1 • Create a FluidSim IPO curve for the Fluid object’s “Active” parameter • Make the fluid Active at the desired frame number
Parameters that can be animated • For Control objects • AttrForceStr: attraction force strength • AttrForceRa: attraction force radius • VelForceStr: velocity force strength • VelForceRa: velocity force radius
Tutorials • http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Realistic_Water_using_Fluid_Sim_and_Yafray