## 3 Proposed Framework
### Foam Effects Based on Projective-Space  
#### 3.1.1 Projection Map Generation from Fluid Particles  
This section briefly describes the projective-space-based foam generation technique used in this paper. First, water particles in 3D space are projected onto screen space, and two maps are created that store the acceleration and depth values at the projected location, respectively. The meaning of each symbol in the following explanation is as follows: \(W\) and \(H\) are the horizontal and vertical pixel resolutions of the screen-space, respectively, \(N_{x}\times N_{y}\) is the resolution of the regular grid divided by the projection interval \(h\), and  
Figure 3: Algorithm overview. is the radius of the water particles. \(r\) is a user-adjustable value to get a map where the values run smoothly after projection. As mentioned above, \(z_{ij}\), which is the depth value of the water particles, and \(d_{ij}\), which is the acceleration, are stored at the projected location, respectively, and each map is composed as follows: depth map \(\mathbf{Z}\in\mathbb{R}^{N_{x}\times N_{y}}\), acceleration map \(\mathbf{D}\in\mathbb{R}^{N_{x}\times N_{y}}\). The acceleration \(d_{ij}\) of the water particle is calculated from the difference in velocity between frames: \(\frac{|\mathbf{v}_{x}+\Delta\mathbf{-v}_{y}|}{\Delta t}\). A particle \(\mathbf{x}\) at 3D location \([x,y,z,1]^{T}\) is projected onto 2D space using the projection matrix \(\mathbf{P}\) (see Equation (1)). \[ \begin{bmatrix}x^{\prime}\\ y^{\prime}\\ z^{\prime}\\ w\end{bmatrix} =\mathbf{P} \begin{bmatrix}x\\ y\\ z\\ 1\end{bmatrix}  \tag{1}\]  
To avoid distortion of \(z\) values during projection, perspective division is applied only to the \(x\) and \(y\) coordinates. Using this method, the coordinates \((x_{p},y_{p}),z_{p}\) where the 3D fluid particle is projected and the projected acceleration \(d_{p}\) are calculated (see Equation (2)). \[\underbrace{ \begin{bmatrix}x_{p}\\ y_{p}\\ z_{p}\end{bmatrix} }_{projected\ coordinates\ and\ depth},\underbrace{ \begin{bmatrix}x_{d}\\ y_{d}\\ d_{p}\end{bmatrix} }_{acceleration}= \begin{bmatrix}x_{p}\\ y_{p}\\ d\end{bmatrix} , \tag{2}\]  
where \((x_{d},y_{d})\) is the index of the array in which \(d_{p}\), the acceleration on screen space, is stored. The radius \(r\) of a particle in 3D space is projected using the following method (see Equation (3)): \begin{table}
\begin{tabular}{l l l} \hline \hline
**Name** & **Description** & **Value** \\ \hline \(r\) & Radius of water particle & – \\ \(\mathbf{Z}\) & Depth map & – \\ \(\mathbf{D}\) & Acceleration map & – \\ \(\mathbf{P}\) & Projection matrix & – \\ \(\mathbf{Q}\) & Inverse projection matrix & – \\ \(x_{p},y_{p},z_{p}\) & Projected coordinate & – \\ \(r_{x},r_{y},r_{z}\) & Projected radius & – \\ \(d_{p}\) & Projected acceleration & – \\ \(\mathbf{C}\) & Candidate region in 2D & – \\ \(\mathbf{C}^{*}\) & Final candidate region in 2D & – \\ \(\mathbf{F}\) & Depth map based curvature & – \\ \(\tau_{p}\) & Torque of water particle & – \\ \(\mathbf{L}_{p}\) & Angular momentum of water particle & – \\ \(\omega_{p}\) & Angular velocity of water particle & – \\ \(I_{p}\) & Scalar inertia moment of water particle & – \\ \(\omega_{pf}\) & Relative angular velocity of water and foam particles & – \\ \(H^{*}\) & Mean curvature of the depth map & – \\ \(\Delta\) t & Time-step & 0.006 \\ \(\alpha\) & Angular momentum transfer & 10.0 \\ \(\beta\) & Curvature threshold & 0.1 \\ \(k\) & Weight for inertia moment & \(\frac{1}{30}\) \\ \(h\) & Projective spacing & 2.0 \\ \(N_{x}\times N_{y}\) & Projective space res. & 400 \(\times\) 300 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Simulation variables and parameters. \[ \begin{bmatrix}r_{x}\\ r_{y}\\ r_{z}\end{bmatrix} =\left[ \begin{array}{c}rW\sqrt{p_{1,1}^{2}+p_{1,2}^{2}+p_{1,3}^ {2}}/w\\ rH\sqrt{p_{2,1}^{2}+p_{2,2}^{2}+p_{2,3}^{2}}/w\\ r\sqrt{p_{3,1}^{2}+p_{3,2}^{2}+p_{3,3}^{2}}\end{array} \right], \tag{3}\]  
where \(p_{ij}\) is an element of the projection matrix \(\mathbf{P}\).