Simulation and Control Framework
3.5 Flowing Control System
be found, the distance d will be lowered down iteratively until we have a valid region. After finding the region we can sample on, we may have many possible symmetric pair candidates, and the algorithm just randomly pick one of them.
As for the parameters of particles p1 and p2, their levels l1 and l2 are decided as li − 1.
The parameter about the particle’s properties (e.g. conductivity, emissivity, temperature, elastic stress coefficient, viscosity coefficient, and velocity ...etc) is the same as the original particle p, and the energy store in p (e.g. absorb energy, heat energy) can be distributed evenly to p1 and p2 since their mass are equal.
Merge Two particles pi and pj can be merged if they are neighbor to each other and both of them pass the conditions we have mentioned above. A new particle pkwill be generated at the position xk = xi+x2 j, and the level is lk = li + lj. The position should be chosen carefully to inside the fluid volume and also avoid placing too close to other particles, which may cause large pressure forces. If there is no merge pair pass the above criteria, then the merge operation will be canceled in this iteration.
The parameters for the merged particle pk can be a weighted sum of that for pi and pj according to the mass. By a weighted sum computation, we can correctly handle the merge operation for particles in different level or with different material.
3.5 Flowing Control System
So far, our method provides an reasonable fluid simulation framework and a thermal transfer scheme for simulating the heat flow, which can trigger the melting event. Although we have the ability to simulate the object melting, the animators may expect to design the flowing pattern for object melting, including the shape of the fluid. To this end, we develop a flowing control system, aiming to provide two types of control mechanism for different purpose. The first one is called flowing path control, which is used for guiding the direction of melting flow. The second one is named as melting shape control, which generate an approximate geometric potential field
3.5 Flowing Control System 30
to constrain the flow shape. We utilize the control particles concept as in [TKPR06] to guide the fluid volume.
Figure 3.10 shows the control system flowchart in our approach.
Figure 3.10: Flowing control flowchart.
3.5 Flowing Control System 31
At the initial stage, we sample a set of control particles through the SPH particles. We define an influence range for each control particle to control the nearby particles. Each control particle has two forces to affect the movement of SPH particles. Attraction force drags the nearby particles to the control particles and the velocity force gives the nearby particles the forces based on the control particle’s moving direction. The strength of force is inversely proportional to the distance between the control particle and other SPH particles. We make use of these control particles to guide all the SPH particles move as the user designed. Furthermore, we also utilize the attraction force to enhance small droplet formation during the melting process.
3.5.1 Path Control
For path control, user can draw several flowing paths directly on the object surface or other constrainted surface. These path are used for guiding the nearby control particles to flow along the path. Instead of apply forces on all the normal SPH particles, we consider the control particles, which is a subset of SPH particles, are enough to guide the fluid direction. Moreover, by lowering the strength of force with respect to the distance to the center of control particle, more fluid detail can be preserved. Each path is defined by a set of path nodes generated along a user-draw trajectory, the path nodes have the information about the influence range R, and two forces direction: attraction force and velocity force, which can be used to drag the control particles close to the path and give the control particles a direction along the path. In the end, each path may give the forces to control particles that will move along the path trajectory.
3.5 Flowing Control System 32
(a) Attraction force (b) Velocity force
Figure 3.11: Two path control forces.
Attraction Force Our method compute the attraction force based on the vector Va and Vb, which is shown in Figure 3.11(a). The control particle is attracted by the path along the direction
−Vasin θ, the angle θ is the angle between Vaand Vb. Equation 3.27 is the final attraction force for each control particle:
Fa=X
i
(− ~Vasin θ)i (3.27)
where i indicates the index of each path, Fais the attraction force.
Velocity Force Velocity force provides the necessary force for fluid to flow along the pre-defined path. Figure 3.11 (b) represents how we generate the velocity force for each control particle. The path direction is decided by the vector from the current node to the next node position, and the magnitude of velocity force is proportional to the distance between the control particle and the path node. Equation 3.28 shows the formulation we use in our method:
3.5 Flowing Control System 33
Fv =X
i
( ~VbW (d, R))i (3.28)
where i is the index of path, ~Vbis the direction along the path, W (d, R) is a smoothing function (e.g. gaussian function) with influence range R defined on the path.
The final force for each control particle can be get as a weighted sum of Faand Fvas shown in Equation 3.29.
Fpath = (Wa∗ Fa+ Wv ∗ Fv) (3.29) In addition, we apply a feedback control scheme to adjust the force strength during simulation.
Considering the fluid force acting on the control particles, which is computed by the fluid solver in 3.2, if this fluid force direction is away from the control direction, we need a larger control force to correct the flowing direction. The strength of path control is proportional to the angle θp between the force direction provided by the fluid solver and the force direction provided by the paths. Equation 3.30 is the force provided by a path.
FP athf = Wp∗ Fpath (3.30)
Equation 3.31 shows the weighting coefficient Wp computation as a feedback scheme, where kp is a constant coefficient and θp in Equation 3.32 is the angle between the force direction provided by the fluid solver and the force direction provided by the paths.
Wp = kp(−θp+ 1.0) (3.31)
θp = Ff luid· Fpath
kFf luidkkFpathk (3.32)
where Ff luidis the force direction provided by the fluid solver and Fpath is the force direction provided by the paths.
Except for the force control we have mentioned above, our path control also controls the temperature absorbtion rate to achieve our goal. Since the fluid will go toward low to flow, we slightly change the heat adoption coefficient δ at starting point of the path, so the melting may
3.5 Flowing Control System 34
happen faster than other regions, causing the melting flow toward our control path. The heat adoption coefficient is simply modified by a Gaussian function, making the adoption coefficient smoothly varying according to the distance to the center of path point. Figure 3.12 shows the adoption coefficients varies in a color-coded particles diagram.
Figure 3.12: Modify the adoption coefficient around the path starting point
3.5.2 Shape Control
It is quite often that artists have the needs to control the fluid to form a target shape. In our object melting simulation, we provide an easy-design shape control interface for artists to do these jobs. Differ from path control scheme, shape control must control all the SPH particles more precisely to obey the constraints we set. Because user will not expect there are small droplet cross the shape or there are some details do not follow this constraint. Therefore, instead of only applying on control particles, we enforce all the SPH particles in the influence range of control shape to accept the control forces.
As the same way in path creation, we allow user to draw shape contours on the scene surface, and store each contours with discrete nodes along the trajectory. Although the shape contour
3.5 Flowing Control System 35
is 2D on the surface, the influence is still on a 3D volume around each node. We think this is adequate for a melting process control since the fluid is usually flowing close to the surface.
A shape contour has several shape nodes on the trajectory. And for each shape node, it stores a direction for the contour repulsion force and two influence range as shown in Figure 3.14.
The farther range is the attraction range used to attract SPH particles to move close the contour line and the closer range is the repulsion range used to keep the particles stay inside the shape contour region.
Once a shape contour is drawn, we then compute the shape force direction for each node on the shape contour. By finding a nearest surface vertex normal vector and the vector to its next node position, we compute the shape force vector as the cross product of these two vectors, as shown in Figure 3.13.
Figure 3.13: Shape control force for each node.
We divide the influence range for each node into two level: attraction and repulsion range.
Figure 3.14 reveals the two level range in our approach. Inside the light red region, we employ the shape force describe above to enforce the fluid inside the shape contour. In the light blue
3.5 Flowing Control System 36
region, we use a attraction force to attract the nearby particles to form our target shape, and the direction is simply the vector from particle to shape node.
Figure 3.14: Shape node two level influence range
Equation 3.33 shows the formulation of shape attraction force, which is used to attract the nearby SPH particles to form the target shape.
FSa= CSaVSaW (d − h1, h2− h1) (3.33) where FSais the attraction force, CSais the coefficient of attraction strength, VSais the attraction direction from particle position to the shape node position, and W is a smoothing kernel to smooth interpolate the magnitude of the force with the distance d.
The repulsion force computation can be done as Equation 3.34:
FSr = CSrVSrW (d, h1) (3.34)
where FSris the repulsion force, CSris the coefficient of repulsion strength, VSris the repulsion direction for the shape node, and W is a smoothing kernel to smooth interpolate the magnitude of the force with the distance d.