|
In the game Cloud Guardian, I used a Pressurized Soft Body (PSB) implementation to create the balloon, which is the main object that the player will see and interact with. It is based on the paper “Pressure Model of Soft Body Simulation” by Matyka et al. published in SIGRAD 2003 and implemented using Microsoft XNA 2.0. The basic idea is to pump a gas into the balloon to maintain its shape and volume. Surface springs are used to create surface tension on the skin of the balloon. Local deformation is achieved by adjusting the rest lengths of the surface springs. This is the first prototype of the balloon and is not the actual version used in the game due to lack of control by the player. Pressurized Soft Body The pressure is governed by the Ideal Gas Law as PV = nRT, where n is the number of moles of gas, R is the universal gas constant of 8.314, T is the temperature in Kelvin, and V is the volume of the balloon. By assuming that n and T are constant, an inversely proportional relationship between P and V is obtained. This relationship causes the balloon to retain its volume as it is interacted with external forces. Since the force due to pressure is just another force acting on the vertices of the balloon, the standard simulation algorithm can still proceed as usual. The only extra thing to do is add the pressure forces on each vertex, as shown in the image below. The direction of the force acting on each vertex follows the face normal, while the magnitude is calculated as pressure divided by face area.
Local Deformation I predefined 6 regions on the balloon (arranged in a hexagonal fashion) where there are good topological flow of edges. Sets of bump edges and spike edges are marked manually. The rest length of these springs are increased or decreased to achieve local deformations.
A recurring issue in physically-based simulations is that it is hard to find the right constants that will give the look that we are looking for. This phase usually involves a lot of trial and error to find the appropriate values to plug into the variables, failing which the simulation tends to move unrealistically or even “explode”. Another problem faced was when I was trying to inflate/deflate the balloon. I tried to change a variety of attributes such as the volume of the balloon and the stiffness of the springs. These attributes tend to change the forces acting on the vertices and thus result in a different behavior in the mesh after the inflation/deflation has taken place. For example, increasing the stiffness of the springs will cause the balloon to “deflate” because the springs exert more force to pull the vertices closer together. However, this causes the balloon to vibrate faster when perturbed, which is changing the original behavior of the balloon. After a considerable amount of testing, I found out that a stable inflation/deflation can take place by changing the rest lengths of the springs. Although not physically possible in real life, it works very well for our balloon simulation and it is the method that I used for the early prototypes of the game. |
Copyright © 2003-2024 Skeel Lee. All works are original ones by Skeel, unless otherwise stated.
|