340 likes | 350 Views
Computer Animation Ying Zhu Georgia State University. Soft Bodies and Rigid Bodies. Soft body and clothes. In older versions of Blender, cloth is part of Soft Body simulation But in the latest version, cloth simulation has its own parameters and controls
E N D
Computer AnimationYing ZhuGeorgia State University Soft Bodies and Rigid Bodies
Soft body and clothes • In older versions of Blender, cloth is part of Soft Body simulation • But in the latest version, cloth simulation has its own parameters and controls • So now soft bodies are mainly used for simulating closed meshes
BackgroundDampened Mass Spring model • Soft bodies are simulated by connecting neighbor vertices with dampened mass springs • The same applies to cloth simulation too • Many Soft Body related parameters are better understood in the context of a dampened mass spring • Mass • Stiffness • Damping: a friction force that resists the motion
Dampened Mass Spring • http://www.myphysicslab.com/spring1.html • http://en.wikipedia.org/wiki/Damping
Dampened Mass Spring model • The behavior of a simple spring is governed by Hook’s law : Fspring = −k x • K is spring stiffness • X is stretch • Add damping force then we have acceleration x'' = − k⁄mx − b⁄mx‘ • m: mass • b: damping coefficient • X’: velocity
Dampened Mass Spring model • Mass: • Increase object mass will reduce the acceleration of the object • Increase object mass will reduce the frequency of spring oscillation (i.e. soft body will be less bouncy) • Stiffness: • Increase spring stiffness will increase the restoring force generated by the spring • Increase stiff will increase the frequency of spring oscillation (i.e. soft body will be bouncier)
Dampened Mass Spring model • Damping: • A force that reduces the amplitude of spring oscillations • Increase damping makes a soft body less bouncy
How to create a soft body in Blender? • Create a soft body object • In “Object”, “Physics buttons” panel, “Soft Body” tab, press “Soft Body” button
Soft body parameters • Friction: “media friction” • Friction with the surrounding air or liquid • Increase this friction make the soft body move slower in the air • Mass: mass of vertices • Larger mass slows down motion • Speed: internal timing of physical simulation • Use values less than one to simulate dense air or very light fabric dropping
Use Goal • By default the “Use Goal” button is pressed • This is similar to “Pinning of cloth” • Part of the soft body is pinned and doesn’t move • How to set goal for soft body? • Create a vertex group on the soft body object • In “Soft Body” tab, press “Use Goal” • Click on the (up and down arrow) button next to the “Use Goal” button, select the vertex group from the drop down menu
“Use Goal” parameters • G Stiff: the stiffness of the connection between the pinned vertex group and rest of the mesh • If set to 0.0, the object may swing • G Damp: the damping of the connection between the pinned vertex group and rest of the mesh • “G Min” and “G Max”: usually keep the default values • Setting “G Max” below 1.0 and the goal (pinning) would have no effect
Why doesn’t the soft body fall under gravity? • By default “Use Goal” is enabled • If no vertex group is selected as a “goal”, the entire soft body object is pinned • To make soft body object fall under gravity, release the “Use Goal” button
Soft body parameters • Use Edges: connect neighbor vertices with springs • Stiff Quads • For quad faces, also connect diagonal vertices with springs
Soft body parameters • Stiffness • Pull Stiffness: spring stiffness when pulled • Push stiffness: spring stiffness when pushed (usually the same as Pull Stiffness) • Bending stiffness: spring stiffness when bended • Shear stiffness: spring stiffness when twisted • Increasing stiffness generally creates stiffer and bouncier soft bodies (if everything else remains the same)
Soft body parameters • Damping: • Friction for edge springs • Higher damping means higher resistance to motion • Higher damping means that the spring will go back to its rest position quicker (i.e. object will calm down quicker)
Collision • In the Collision tab, press “Self Collision” if you see soft body faces penetrating each other during animation
Baking • Baking happens automatically the first time you press Alt + A to start the animation • When you make changes and press Alt + A, baking automatically restarts • A cache folder is automatically created under the “output” folder you set in the “Scene” panel • Set baking start and end frames to match your animation • Note that each soft body has its own baking start and end frames
Create a deflector • Create an object (e.g. a flat plane) • Under “Object”, “Physics buttons” panel, “Collision” tab, press “Collision” button • There is a group of parameters under “Soft Body and Cloth Interaction”
Collision parameters • You can define a collision layer surrounding the actual mesh • Inner: thickness of the collision layer inside the object • Outer: thickness of the collision layer outside the object • Damping • Low damping: hard surface • High damping: soft surface
Soft Body example: a soccer ball • Add an Icosphere • Subdivision: 3 • Radius: 1 • Set Soft Body parameter as follows
Soft Body example: a Jell-O • Create a cube • Set Soft Body parameters as follows:
Soft Body example • http://www.blender.org/fileadmin/movies/softboy.avi
Rigid bodies • Rigid bodies are handled in the Logic (F4) panel • Select an object • Go to Logic Panel • Select “Rigid body” from the Object type menu • The default is “Static” • Move mouse cursor to 3D View, press P to start the physics simulation
Rigid body • A “Rigid body” object will fall under gravity • A “Static” object will not fall under gravity • A rigid body object will collide with other rigid body objects and static objects • Unlike soft bodies, there is no need to explicitly make an object “collide-able” with rigid body
Rigid body parameters • Ghost: if enabled, the rigid body will not collide with other objects • Mass • Damp: general movement damping • Reducing damping makes the object bouncier • RotDamp: rotation damping
Bounds • Blender uses bounding boxes for collision detection • Bounds: bounding box shape • Choose a bounding box shape that is close to the shape of the mesh • For example, choose box for cube, sphere for ball, etc. • Choose “Convex Hull” for more complex objects • “Triangle Mesh” is the most accurate but also the slowest
Baking • Unlike soft bodies, there is no explicit baking button for rigid bodies • The process • In Game menu, select “Record Game Physics to IPO” • In “Scene” panel, adjust start and end frames in “Anim” tab • Move mouse cursor to 3D View, and press P to start physics simulation • The physics simulation will be “baked” into IPO curves • Next time you can press Alt + A to play back the rigid body simulation
User interaction with rigid bodies • There are three set of parameters under the Logic panel • Sensors: event trigger • Controllers: link sensors with actuators • Actuators: how to manipulate the rigid body obj • Together they make it possible for users to control a rigid body object with keyboard, mouse, or joystick • They can also make the rigid body move without user interaction
Sensors • Press the “Add” button under “Sensors” to add a new sensor • Always: always on (no user interaction) • Keyboard: triggered by keyboard input • Mouse: triggered by mouse input • Joystick: triggered by joystick input • Collision: triggered by collision
Controllers • Press the “Add” button under “Controllers” to add a new controller • Usually use the default “AND” controller type • Use mouse to connect a Sensor with a Controller
Actuators • Press the “Add” button under “Actuators” to add a new actuator • Actuator types • Motion • Visibility • Camera • Sound • and many more types • Use mouse to connect a Controller with an Actuator
Motion Actuators • Can transform the rigid body object • Loc • Rot • Can apply forces to the rigid body object • Force • Torque • Can change its velocity • LinV: linear velocity • AngV: angular velocity
Simple game • With Sensors, Controllers, and Actuators, you can create a simple game • For examples see http://www.continuousphysics.com/ftp/pub/test/index.php?dir=blender/&file=physics_demos-2.42-preview34.zip