Procedural Animation of Freshly Cooked Rice Based on Water Content-Aware XPBD and CDRF Shader

: In this paper, we propose a method of reproducing freshly cooked rice using computer graphics animation. The physical properties of freshly cooked rice (rice grains) include shape, density, refractive index, transmittance, and reflectance. Based on these data, the objective is to render the texture and shape of a large amount of cooked rice in a photo-realistic way. Create rice grain polygon models with low resolution based on electron micrographs, rice grains with different shapes and considering the porous structure, we can create a large number of 3D rice grain models. Next, a large number of freshly cooked rice grains were transferred to XPBD (eXtended Position-Based Dynamics), we simulate aggregates by adding a constraint condition. This can be used to simulate the softness of freshly cooked rice. It also allows you to create any shape of rice structure. Finally, the Sub-Surface Scattering (SSS) also takes into account the water content, so that it can be used for the Curvature-dependent reflectance function (CDRF). Depending on the moisture content, different rice grains can be represented with different appearances. With such proposed method, a large number of rice grains are placed in a bowl of freshly cooked rice, rice balls, sushi rice, etc. is represented realistically.


Introduction
Since its earliest days, computer graphics has been concerned with achieving photorealistic modeling and rendering of real-world scenes [1]. There has been a large and continuous effort to achieve realistic results for a wide variety of scenes, from natural objects to composites, and from natural landscapes to urban scenarios. The result has been spectacular, models were built to represent almost every possible material, both natural and man-made, from water to fire, clouds to concrete.
Photorealistic 3D content is critical to creating compelling digital images. However, the production process is very complex and usually requires a great deal of manual labor by skilled 3D artists. Among these, 3D modeling of fresh food is a particularly challenging area. Human perception is highly sensitive to everyday objects such as food, and even small discrepancies may not result in a visually satisfactory reproduction.
However, there has not been much attention paid to modeling and rendering of foods and edible materials, and only a few efforts are mentioned in the literature [2][3][4][5]. On the other hand, the process of cooking the most delicious rice has received much attention in the field of food engineering (e.g., [6,7]). However, this research has not been exploited by the computer graphics community.
In this paper, we introduce a procedural method for modeling and shading rice without relying on the manual work of a 3D artist, using freshly cooked rice, typical food of Japanese cuisine. Using a low-resolution polygonal model of rice grains created by referring to electron microscopy images as a base, the surface of the base model is filled with particles and converted to volume data, and then resurfaced using the Level Set method to create rice grain models with different shapes considering porous structures. Next, assuming a situation in which a large number of freshly cooked rice grains are served in a bowl, or squeezed together to form a "granular material" like a rice ball, a granular material simulation is performed using XPBD (eXtended Position-Based Dynamics) with a constraint that takes the F content into account. Finally, a procedural shader using a curvature-dependent reflectance function (CDRF) is used to add shading to SSS (Sub-Surface Scattering) to account for water content.
With our proposed method, freshly cooked rice, onigiri (rice balls), the sushi rice (Figure 1), etc., with a large number of rice grains in a bowl can be represented photo-realistically, which can be used not only for various entertainment contents but also for menu thumbnail images in restaurants and the menu creation process.

Previous Work
Christopher Schwartz et al. [8] proposed a photogrammetric modeling method for food products by constructing an apparatus with 151 cameras around a dome-shaped structure and 8 projectors on a gantry crane. By capturing 151 images at the same time, we were able to capture complex shapes without moving the object and obtain high-resolution point data. In the reflectance acquisition, the internal flash of the camera is triggered sequentially as a light source, and all cameras capture HDR images simultaneously. By projecting the image onto the acquired shape and combining the reflectance in any direction, we can estimate the bidirectional texture function. In this paper, however, a large-scale imaging device is required as a prerequisite, and it is not a method that can be easily reproduced by anyone.
In the research by Pixar Animation Studio [9][10][11], in order to reproduce the CG of cuisine more naturally and accurately, we reproduced the granular material using both elastic and rigid body simulations while preserving the volume conservation law, and shaded them using SSS shaders. However, the reproduced food itself does not require a large number of polygons or particles, and the elastic and rigid body simulations performed are not technically novel. Also, the SSS-aware shaders do not take into account the water content proposed in this paper.
When constructing shaders for food, it is difficult to set the optical parameters accurately in translucent materials with different textures from skin to fruit, for example, grapes, Jingjie Yang et al. [12] proposed an inverse rendering approach for heterogeneous translucent materials from a single input photograph. Given a single image of an object of a particular heterogeneous translucent material, Jingjie Yang et al.'s approach initializes the material distribution using 3D simplex noise combined with fractal Brownian motion and sets the color pattern of the noise using a histogram matching method. Based on the color pattern-matched noise values, the volume data with non-uniform optical parameters are initialized and rendered under specific lighting conditions using the Monte Carlo ray-marching method. Here, an iterative process is performed to approximate the optical parameters so that the difference between the rendering result and the input photograph is minimized. As a result, volume data with optimal heterogeneous optical parameters are obtained and can be used to render arbitrary geometry models under different lighting conditions. Since the "freshly cooked rice" to be reproduced in this paper is not a heterogeneous translucent material, we do not adopt a computationally expensive method as in the approach of Jingjie Yang et al.
Matthias et al. proposed a method (Position Based Dynamics: PBD) that avoids the calculation of velocities by using position-based simulation instead of simulation based on dynamic models [13].
In the PBD approach, objects can be manipulated directly during simulation, which greatly simplifies collision and attachment constraints and enables direct and immediate control of the animated scene. However, it is known that the behavior of PBDs depends on the simulation time step and the number of iterations [14]. Therefore, Miles et al. proposed an extended PBD (XPBD) that addresses the problem of iteration-and time-step-dependent stiffness by introducing a constraint that defines the elastic potential energy [15]. In this paper, we present a cohesive simulation using XPBD to represent the softness of freshly cooked rice.
Procedural modeling greatly reduces the amount of labor needed. A large amount and duplication of work become an art, for example, cities [16], planets [17], buildings [18], plants [19].
Also, there are four major categories of rice worldwide: indica, japonica, aromatic and glutinous. [20] This paper is based on the study of Japanese rice. If no explanation is given, the type of rice is japonica.

Rice Cooking Process
The Japanese style of cooking rice involves soaking the rice in an optimal amount of water and heating it until the water is gone, that is, until the water evaporates and is absorbed by the rice grains. The absorption of water into the cells of the rice grain during soaking is related to the gelatinization of the starch stored in the grain during cooking. In general, starch gelatinization depends on the physiological properties and hygroscopicity of the rice and affects the texture of the rice after cooking, which is one of the most important factors in rice-eating quality [21]. Good tasting rice depends largely on the boiling time after heating. As shown in Figure 2, there are three stages of heating: early boiling, proper heating, and delayed boiling. Depending on the stage of heating, the rice absorbs water and expands. The residual heat releases some of the water, causing the rice grains to shrink. "Fast boiling heating process" means boiling in 4~7 minutes after heating, and continuing for 20 minutes above 98°C after boiling. As shown in Figure 2, the "proper heating process" is when the rice boils 8-15 minutes after heating and continues to boil for 20 minutes above 98°C. Strictly speaking, there are cases where the rice is tasty because of the appropriate residual heat even in the early boiling process.
"Delayed boiling process" is when the water finally boils about 20 minutes after the start of heating, and continues to boil for 20 minutes above 98°C. Boiling is delayed because the heat is too low for the amount of rice. Here, too, the term "delayed boiling" should be used to match the term "fast boiling," but the term "delayed boiling" is used as a common term.

Pipeline of the Proposed Method
In this chapter, we describe the modeling of rice grains, the simulation method for freshly cooked rice, and the shader to reproduce the sizzle effect, which are all necessary for our proposed "procedural animation method for freshly cooked rice". First, we review the results of Tomita et al.'s [7,22] observation of rice grains using a scanning electron microscope (SEM) to understand the physical structure of rice grains, and refer to the mathematical model needed to model rice grains. Next, in order to treat a large number of freshly cooked rice grains as "granular material," a granular material simulation is performed by adding a unique constraint to XPBD that takes the water content into account. Finally, the SSS is shaded using a procedural shader with curvature dependent reflection function (CDRF) to account for water content.
The whole process consists of the animation pipeline shown in Figure 3, where all the stages of emulating freshly cooked rice are processes that work with polygon models.

Procedural Model of a Grain of Rice
When modeling rice grains, it is important to understand the physical structure of rice grains because animation is impossible without considering the viscoelasticity of cooked rice. Tomita et al. used SEM to observe the cross-section of broken rice [22]. As a result, it was found that the surface layer of the rice was dense and the interior was porous (soaked at 10°C for 120 minutes, Figure 4).
In this paper, we prepared several polygon models (base models, Figure 5) in the shape of rice grains in advance as a system to realize porous structures. The length and thickness of these base models can be freely edited by the user. Besides, users can feed their desired 3D polygon model to the pipeline as a rice grain model. Then, spheres are randomly generated on the surface and inside the base model ( Figure 6). The spheres are then voxelized and converted to volume data to reproduce the porous structure of the rice grain. The number and radius of the randomly generated spheres can be controlled by the user (parameterization of the porous structure).
In the first step of the conversion to volumetric data, the open-source binvox utility [23] is used to voxelize the mesh on which the spheres are placed. Once the polygon model has been converted to a volumetric texture M, a second volumetric texture DFM of the same size is generated containing the result of calculating the distance to the nearest bounding voxel in the volumetric texture M at each voxel and evaluated by the following [24]: Here, , , and , , are the cells of the respective textures that represent the spatial locations of , , and , , , and is a function that calculates the distance between the two cells, computed as the Manhattan or Euclidean distance. From the above evaluation formula, entries that are farther from the object boundary get a higher value than those that are closer. The new volume texture DFM serves as a discrete distance field that is needed at various stages of the pipeline.
The actual "fluffiness" of freshly cooked rice is due to its porous structure, which is the result of complex processes such as water absorption and physical deformation.
According to the study by Taeko et al. [25], even if the soaking time of polished rice grains increases, the change in the rice grain is very slight and in fact the rice grains stick together and the overall volume of the rice does not increase. Since there is no specific research on the volumetric change of rice grains after cooking, we judge it by visual appearance and use the following equation to express the change in volume.
x, y, z r, s, t , , is the voxel entry after the change, is a parameter between 1 and 1.5, and is randomly given to each rice grain to make it look realistic, !, ", # is the original voxel entry before the change.
After the porous structure is generated by the volume data, it is re-polygonalized by the level set method [26] (Figure 7). Figure 8 shows the automatically generated shapes and polygonal models of rice grains with different sizes.      (2) Examples of indica, japonica, and aromatic rice shading using this method from left to right, the wireframe is the modified base model.
We can choose three of the four types of rice that are easy to recognize, adjust the base model, and simulate them as shown in Figure 9. The indica rice does not expand easily, while the japonica and aromatic rice expand greatly after cooking.

Granular Material Simulation Using XPBD
In this process, we assume that a large number of freshly cooked grains of rice are served in a bowl, or squeezed together like a rice ball to form a "granular material" and simulate the granular material using XPBD. Granular material is considered to be an aggregate, including the medium that occupies the spaces between the grains. The individual granular are solids, but as an aggregate they behave like a fluid (liquid).
Position-Based Dynamics (PBD) [13] is a popular method for real-time simulation of deformable elastic bodies in games and interactive applications, and has recently been used in movies and medical simulations as well as in games. However, PBD suffers from the problem that the constraints on the elastic body are affected by the simulation time step and the number of iterations. This is especially problematic when calculating the interaction between an elastic body and a rigid body. For example, in the case of a scene where freshly cooked rice is served in a bowl, the simulation of the area where the rice grains come into contact with the bowl may malfunction.
Therefore, in this paper, we propose a simulation method for the extended PBD: XPBD algorithm with an additional constraint that takes the water content into account. This method addresses the problem of repeat-and time-step-dependent stiffness by introducing a new constraint equation that corresponds to the concept of elastic potential energy. This provides a constraint estimate that can be used for force-dependent effects.
Since our goal in this paper is to simulate freshly cooked rice, it is necessary to consider an additional damping model in order to simulate the characteristic "fluffiness" of rice. This allows us to define the Rayleigh vanishing potential.
Here, x + , 3 , … , -6 is the state of the system, v is the velocity vector, 7 is the constraint damping coefficient, and C 5 x is the constraint function. Sakamoto et al. measured the change in the standard water absorption of rice at different temperatures for different soaking times [22] (Figure 11). In this paper, the constrained damping coefficient is obtained from Figure 9 using both logarithmic functions in (4). 9:; 1 7 ⁄ < = 9:; ">? , @ Here, ">? is the immersion time set freely by the user, and < and @ are arbitrary constants. From

Boundary Particle Placement
For simulations of soft bodies, reducing the resolution of the mesh not only reduces the cost of a single iteration of the solver, but also reduces the number of iterations required to obtain visually satisfactory results.
In MÜLLER et al [28], the authors proposed a way to reduce the resolution of a dynamic mesh without losing too much visual detail. The most important detail in the simulation of soft bodies is small wrinkles. The method is based on the observation that wrinkle formation can be separated from the global dynamic behavior of the soft body. Therefore, complex dynamic simulations, including collision processes, are performed on a low-resolution mesh. Wrinkle formation is handled on a high-resolution mesh attached to the dynamic mesh (see Figure 12).

Procedural Water Content-aware Shader
Simulation of Sub-surface Scattering (SSS) is one of the most effective methods to realistically reproduce translucent materials such as marble, milk, and human skin. previous work on SSS has shown that the method developed by Jensen et al. [29] In previous work on SSS, the method developed by Jensen et al. has greatly accelerated simulations. In addition, Kubo et al. [30] developed a faster rendering method by simulating the surfacing scattering with the Curvature-Dependent Reflectance Function (CDRF). In this paper, the parameter H % , which represents the intensity of light scattering in CDRF, is obtained from both logarithmic functions shown in (8).
The CDRF I J is defined by the convolution of the incident light K ) and the Gaussian function ; L, H as follows: Where L is the angle between the direction of the light and the normal vector, and M is the curvature. The incident light K ) and the Gaussian function ; L, H are as follows: Here, H M represents the scattering intensity within a material and is assumed to be inversely proportional to the radius H M . Therefore, σ M [ S \ J H % M . In order to minimize the RMS error with the obtained dataset I J , H % is obtained from both logarithmic functions considering the water content in (8). Figure 13 shows the difference in the results of rendering by CDRF considering the water absorption of rice grains when the water temperature is 5°C and the soaking time is changed from Figure 11.

Results
The simulation results of the method proposed in this paper are shown below.   Figure 14 shows an example of shari (sushi rice), Figure 15 shows rice served in a bowl, and Figure 16 shows onigiri (rice balls). Figure 14 (a) shows the result of simulating the formation of Shari using XPBD, drawn as scan lines, and (b) is rendered using the procedural shader based on CDRF proposed in this paper. (c) shows a nigiri-zushi (hand-formed sushi) model with the ingredients placed on top of the rice model. Figure 15 shows a filling simulation using XPBD with a procedural rice grain model falling from the top of a chawan (bowl) polygon model, followed by rendering using a procedural shader with CDRF. Figure 16 (a) shows an example of onigiri generation. Figure 16 (a) shows an example of the generated onigiri, and (b) compares the cross-section of the actual frozen onigiri (left side of Figure 16 (b)) with the cross-section of the simulation result using XPBD proposed in this paper. Figure 17 shows an example of the simulation of a rice bunny.

Computing Times
The PC used for simulation and rendering was Windows 10 Pro 64-bit, Intel (R) Core (TM) i9-9900X CPU @ 3.50GHz, 128GB memory, and NVIDIA Quadro P2200 GPU. Table 1 summarizes the time spent for each simulation and rendering in Figures 14 to 17. The generated animations are available at the following URL: https://vimeo.com/435099509.

Conclusions and Future Work
In this paper, we proposed a method for procedurally producing rice, a typical ingredient of Japanese cuisine, from modeling to shading. The method proposed in this paper is as follows: 1. Using a low-resolution polygon model created in advance as a base, the surface of the base model was filled with particles to create volume data, and then resurfaced using the Level Set method to create rice grain models with different shapes considering porous structures. 2. We simulated a situation in which a large number of freshly cooked rice grains are served in a bowl, or formed into a "granular material" such as an onigiri (rice ball), by adding a constraint to XPBD that takes into account the water content. 3. The SSS was shaded by procedural shaders using curvature-dependent reflection functions (CDRF) to account for the water content.  Figure 14 to Figure 17.

Number of rice grain models Simulation time (180 frames)
Rendering time (3840x2160, sampling 800) Figure 14. Shari (1 piece) 270 2h 05m 23s 42m 48s Figure 15. Chawan. 800 4h 26m 22s 1h 25m 26s Figure 16. Onigiri (1 piece) 793 4h 53m 42s 2h 20m 5s Figure 17. Rice bunny. 3600 12h 32m 50s 3h 54m 8s The proposed method allows photorealistic rendering of freshly cooked rice, onigiri, sushi, and rice served in a bowl with a large number of rice grains, and can be used in a variety of contents. Since the method is common to numerical methods which widely used in commercial VFX software, our method can be quickly incorporated into industrial pipelines to realize a wide range of simulations of freshly cooked rice.
Future work includes the development of shaders that takes the degree of starchiness, the fragmentation of the rice grain model by fracture energy, and the acceleration of the filling simulation into account.