Presentation is loading. Please wait.

Presentation is loading. Please wait.

Physically Based Modeling Let physics take over!.

Similar presentations


Presentation on theme: "Physically Based Modeling Let physics take over!."— Presentation transcript:

1 Physically Based Modeling Let physics take over!

2 Physically Based Modeling Account for forces in system Account for object interaction, e.g. friction, collision

3 Spring-Mass-Damper Model: jello, cloth, muscle –Have gravity: add mass to vertices –Have stability (add stiffness to flag pole) –Put springs on each vertex, allowing to stretch a finite amount –Another use: angular springs on polygon corners to prevent self-penetration –Numerical integration for animation

4 Governing Equations Hooke’s Law (for graphics): F s = k s (dist-len) where –len = rest length –dist = current length – k s = spring constant F ij = -F ji = k s (dist ij (t) – len ij )d ij –Where d ij = unit vector along i-j –t = time F s = Σ F ij (sum of all edges coming out of a vertex) V1V1 V2V2 V3V3 E 12 E 31 E 23 Look at neighbors when calculating spring force! V F

5 Damping Force & Angular Springs F D = -k d v(t) Damper force is proportional to velocity and acts in direction opposite to velocity NET FORCE: F = Fs + Fd = k s (dist-len) -k d v(t) Angular spring: τ (torque) = k s [Ө(t) -Ө(rest)] - k d Ө(t) M1M1 M2M2

6 Object Representation Vertices: mass Edges: –Spring, damping constant –Resting length –Vertex IDs Each vertex has –Current position –Current velocity –Current acceleration –Mass –Number of edges X, Y, Z components

7 How it all comes together Use Newton’s Law (F = ma) to calculate acceleration for every vertex (big system of linear equations) Basic strategy: accumulate acceleration from different sources (Gravity, Spring, Damper) and integrate 2 times to get velocity and position –Can use Runge-Kutta, for example For project: you can use xspringies (2D) & ODE library or other library you can find or roll your own Make sure to cite your sources

8 Details (source Paul Bourke) Create the particles Create the springs between the particles Initialize the particle and spring parameters loop in time { Update the particle positions (solve ODEs) Display the results somehow }

9 Update Particle Positions Calculate force at each point –Add Positive force: Force*mass for each X,Y,Z –Subtract Drag: drag*velocity for each X,Y,Z –Handle spring interaction For each spring –For each of X,Y,Z of attached points »Force = Hooke’s law »Force += damping constant(Δvelocity of points)(Δlen of points in direction)/len x,y,z »Force *= -(Δlen of points)/len x,y,z »Add or subtract force to/from point (if the point is not fixed)

10 Calculate derivatives for points We already have velocities: –dp x /dt = velocity x Velocity derivative: –dv x /dt = force x /mass And solve with your favorite ODE solver (Runge-Kutta..) –Update positions –Update velocity


Download ppt "Physically Based Modeling Let physics take over!."

Similar presentations


Ads by Google