In addition to simulating the object melting, the animators may expect to design the flowing pattern for object melting, including the shape of the fluid. Thus 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 to constrain the flow shape. We utilize the control particles concept as in [TKPR09] to guide the fluid volume. Figure 15 shows the control system flowchart in our approach.
Figure 15: Flowing control flowchart.
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.
Attraction Force Our method compute the attraction force based on the vector Vaand Vb, which is shown in Figure 16(a). The control particle is attracted by the path along the direction−Vasin θ, the angle θ is the angle between Vaand Vb. Equation 30 is the final attraction force for each control particle:
Fa=∑
i
(− ⃗Vasin θ)i (30)
(a) Attraction force (b) Velocity force
Figure 16: Two path control forces.
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 predefined path. Figure 16 (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 31 shows the formulation we use in our method:
Fv =∑
i
( ⃗VbW (d, R))i (31)
where i is the index of path, ⃗Vb is 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 32.
Fpath = (Wa∗ Fa+ Wv∗ Fv) (32)
In addition, we apply a feedback control scheme to adjust the force strength during simulation. If the 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 33 is the force provided by a path.
FP athf = Wp∗ Fpath (33)
Equation 34 shows the weighting coefficient Wp computation as a feedback scheme, where kp is a constant coefficient and θp in Equation 35 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) (34)
θp = Ff luid· Fpath
∥Ff luid∥∥Fpath∥ (35)
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 absorb-tion rate to achieve our goal. Since the fluid will go toward low to flow, we slightly change the heat adopabsorb-tion coefficient δ at starting point of the path, so the melting may 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 17 shows the adoption coefficients varies in a color-coded particles diagram.
Figure 17: 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 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 19.
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 18.
Figure 18: Shape control force for each node.
We divide the influence range for each node into two level: attraction and repulsion range. Figure 19 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 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 19: Shape node two level influence range
Equation 36 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) (36) 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 37:
FSr = CSrVSrW (d, h1) (37)
where FSr is the repulsion force, CSr is the coefficient of repulsion strength, VSr is 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.
Moreover, we also control the temperature of particles within the influence region. We slightly lower down the temperature per iteration until it is below to the melting point, so the particle will stick to the target shape we design.