A method for modeling volumetric clouds and subsurface scattering of functionally specified objects

. Accurate modeling of light transfer in media is important in many fields, such as scientific visualization, medical imaging, synthesis of realistic images, and so on. Complex volumetric structures and translucent materials are used. Light scattering in media is responsible for the appearance of many materials. However, accurate and efficient modeling of lighting effects is a difficult problem. This requires solving not only the visualization equation, but also its volumetric solution, the radiation transfer equation. A method for modeling subsurface scattering of functionally specified objects is presented. The method allows you to simulate the transfer of light in chromatic media. To do this, a modified free-range distribution is used. This allows you to minimize the deviations of the bandwidth of the path. As a result, the variance of the estimate is reduced. The collision coefficients depending on the wavelength are effectively processed. As a result, it is possible to simulate volumetric clouds and subsurface light scattering in translucent materials such as marble, wax, leather, etc. The control coefficients and free run sampling are based on the minimum and maximum values in the media found by random sampling over a short preliminary pass. Reducing the rendering time is achieved by using a different distribution of paths.


Introduction
Modeling of light transfer is important in such areas as scientific visualization, medical applications [1], synthesis of realistic images, etc. Visual effects are used, in particular, for translucent materials such as marble, jade, wax, leather, etc. With their help, realistic images, depth and scale are created. However, modeling the transfer of light in such materials presents significant computational complexity. To do this, graphics processors (GPUs) are used in combination with specialized APIs. This makes it possible to interactively trace paths. Spectral rendering is used to accurately simulate light transfer, for example, to calculate light scattering [2,3]. Spectral rendering is also used to render a scene with fluorescence. Since fluorescence is a physical phenomenon that strongly depends on the wavelength. Methods of fluorescence visualization under global illumination conditions are described in [4][5][6].
Wavelength samples are used taking into account both the spectra of fluorescent materials and light sources. The paper [7] shows the unification of several methods for sampling trajectories in space and in spectrally varying media. Monte Carlo algorithms of the general Markov chain and algorithms for modeling light transfer are described in [8]. Algorithms require providing only correct inverse sampling functions. This makes them suitable for modeling light transfer. The application of the theory of light transfer in practice is described in the article [9]. Such as obtaining architectural visual effects and light ratings for daytime lighting. As well as the potential of solar radiation on the surfaces of buildings for the implementation of photovoltaic systems. Path tracing is one of the methods of visualizing photorealistic images by modeling the physics of light propagation in a scene. The review [10] describes path-tracing methods. Photorealistic rendering and global illumination are based on models of materials from the visible spectrum. There are also methods for visualizing thermal infrared radiation. The paper [11] describes the physical principles of determining the temperature distribution in a 3D scene. However, the above methods require more resources than traditional RGB rendering pipelines. By increasing the available internal memory on GPUs, spectral mapping becomes possible.
In this paper, the strengths of spectral rendering are used. The proposed spectral path tracer approach is implemented on a CPU. The paper also offers solutions for the use of memory in the processing of asymmetric spectra and large scenes. The method solves the problems of efficient processing of collision coefficients depending on the wavelength. Several vectorized variants of weighted tracking are analyzed. A solution is proposed taking into account these options for setting the collision probabilities. This prevents a geometric increase in the bandwidth of the path. The mathematical basis of the method is derived directly from the radiation transfer equation. The integral expression of the zero collision algorithm is used. This mathematical framework defines spectral path tracking. That is, tracking is implemented directly from the radiation transfer equation. Thanks to this, there is no need for more complex mathematical algorithms. An additional approach is used to efficiently process the collision coefficients depending on the wavelength. Joint tracking of multiple wavelengths increases efficiency and reduces color noise. The proposed multi-wave tracking does not require an explicit choice of wavelength. The construction of several calculation methods is combined, in which path tracking is used. Tracking is based on deviation, using multiple sampling without explicitly estimating or approximating the distance of the probability density function.

Definition of quadrics and free forms
The main primitives are chosen surfaces of the second order -quadrics. A second-order threedimensional function is defined by ten coefficients. The same amount of data is needed to describe the spatial location of one triangular face. A more compact representation of the model allows you to reduce memory costs when storing a database, and, consequently, to unload the transport routes between the computing components of the system and memory blocks. A class of free forms is built on this basis (Fig. 1). This means the ability to describe complex geometric objects by specifying a second-order deviation function from the base surface. In addition to the fact that such a representation is much more economical than a polygonal one in terms of memory consumption, during image generation it is necessary to subject only the coefficients of the bearing surface to geometric transformations, because the deviation function remains constant, thus reducing the database.
The surface of a quadric is the surface of a constant level of a second-order function Q(x, y, z). Define a certain perturbation function, R(x, y, z), which has the smoothness property. Let the function be expressed in the form [12]: Due to the smoothness of the cue, and preserve this property and, consequently, the surface of level zero will also be smooth. Thus, we have constructed a complex surface using a second-order function as the base one. However, in order to get the desired shape of the surface, you need to learn how to set the appropriate perturbation function in an acceptable way. A smooth perturbation is constructed from a quadratic function as follows. Define the inner region of Q as a part of the space where 0<Q. Then in the outer part of Q, we put R identically equal to zero, and in the inner part, we raise Q to the power: where Q(x, y, z) is the perturbing quadric.
The object, which we call a free form, remains essentially a quadric, but taking into account the addition made by the perturbation to its own basic function. In turn, the free form can be a perturbation function for some other object.

Mathematical model
In order for the result of preliminary visualization of free-form prototypes to be unambiguously represented as OpenGL objects, it is necessary to have a good idea of the data structure of the scene, and its use in the algorithm for constructing the final image.

Mathematical representation of free forms
The primitive quadric is the basis for the construction of all other objects. The surface forming it is a second-order surface.
A quadric is defined using a real continuous describing function of three variables are a points lying outside and not belonging to the quadric [13,14]. An algebraic inequality of the second degree (with three unknowns x,y,z) is any inequality of the form: where x, y and z are spatial variables.

Radiation transfer equation
Radiation transfer equation in differential form is [15,16]: where ) ,  dt

Tracking the path
Efficient processing of collision coefficients with spectral resolution is implemented. The distribution for sample collisions is determined. Then the discrepancy between this distribution and the true distribution of the free path per wavelength is eliminated by reweighing. Tracking occurs only once for all wavelengths. For each collision, the collision weight is calculated with spectral resolution. The weight can be expressed using a spectral basis or as a vector of wavelengths. Three primary colors are used -red, green and blue.
Continuous spectra are processed by transferring a discrete set of wavelengths in each path, using the wavelength selection and combining method. To keep the estimate variance low, a free sampling coefficient is set to limit the maximum value at all wavelengths.
The variance of spectral tracking depends on the variance of the spectrally resolved collision weights. The weight deviates from one, since it is impossible to set the collision probabilities to cancel fractions for all wavelengths at the same time. By setting the collision probabilities, it is possible to determine the weight of the local collision, as well as the throughput of the path.
The weight of the local collision for all wavelengths is determined using the probability of the maxima for all wavelengths: where c is the normalization constant; Since the weights of local collisions can exceed one, multiplying the sequence of them can lead to a geometric increase in the throughput of the path. Therefore, we include the bandwidth of the path in the average probability of collisions. At each i-th vertex of the path, the bandwidth of the built-under path is included. Let the probabilities be express in the forms: The average bandwidth over all wavelengths for all vertices of the path is equal to one. The maximum bandwidth for any wavelength is. This avoids a geometric increase in the capacity of the path during successive collisions. These probabilities reduce the amount of unwanted color noise. In addition, they prevent bright chromatic emissions.
For example, the material does not emit, it is possible to reduce the throughput. For this purpose, absorption collisions and redistribution of absorption probability between two types of collisions are not simulated. Table 1 shows the coefficients used in the method.
Spectral tracking includes the following steps: 1) Is set  to limit the maximum value ) , (   7) The history of the path is taken into account. 8) If the material does not radiate, the completion rate decreases due to a decrease in the growth of the path capacity weights.

Results
Testing was performed on a 12 core 2.5 GHz Intel Xeon E5-2678 v3. Figure 2 shows materials with spectrally varying absorption, scattering and extinction coefficients. Scene is generated using the path tracking method.
Spectral tracking increases the total number of path segments, the number of searches and visualization time by 20-25%. This is because smaller steps are used on average. Since the sampling coefficient of the free path should limit extinction for all wavelengths in a material with high chromaticity.
Spectral tracking data depends on the value of the sampling coefficient of the free path. Noise increases when the limiting piecewise constant μ(x) decreases. Using the proposed method, subsurface scattering is simulated (Fig. 2). Figure 2 shows translucent objects with a smooth dielectric boundary. Which covers a color volume. The free run sampling coefficients were based on the minimum and maximum values for the entire volume. They were calculated using a random sample in a short preliminary pass.
The reduction in rendering time during spectral tracking is due to the different distribution of paths. As well as lower throughput, since the algorithm completes paths earlier.
The effectiveness of path tracking also depends on how tightly the extinction coefficient can be linked from below. This is a difficult task for volumes and materials with a high degree of heterogeneity. Performance strongly depends on how well the spatial structure isolates and subdivides heterogeneous regions.
A feature of the proposed spectral path tracking method is the ability to process unlimited sampling coefficients of free path and control attenuation. The method allows you to quickly perform a preliminary calculation of the optimal sampling coefficients.
The method works well when searching in memory is expensive and data sets are large. In addition, if they are subject to cache overload and expensive high-order interpolation is used. If the volume is modeled with complex procedural functions, the savings can be significant.
The method is also effective for arbitrary values of collision coefficients if the sampling coefficient of the free run limits the extinction coefficient. Using the method, it is possible to calculate the optimal heuristic balance weight if the same tracking is used for sampling free range and transmission coefficient.   Figure 3 shows a cloud visualized using the proposed method. Chromatic media are processed using the method and collision estimates are reduced. Figure 4 shows graphs of changing RGB extinction for maximum values in the media. The abscissa axis shows the values of distance, the ordinate shows extinction.   In this case, we consider the medium as non-absorbing, i.e. the albedo is equal to one, with uncorrelated scattering coefficients. The spectral tracker creates paths with an average number of scattering events. Track history accounting provides better path throughput and less estimation noise. Figure 6 shows the scattering distribution for Figures 4 and 5. The abscissa axis shows the values of distance, the ordinate shows density.  Table 2 compares the proposed path tracking algorithm with the octal tree algorithm, shows the effect of the depth of the octal tree on performance: as the depth increases, the calculation time increases. In the table. 2 also shows a decrease in the calculation time of the path tracking as the depth increases.   Table 2 shows that the decrease in the calculation time of the path tracking algorithm begins to decrease after depth 8.

Conclusion
The paper presents a method for modeling volumetric clouds and subsurface scattering of functionally specified objects. Spectral tracking reduces the variance when simulating subsurface light scattering. The method provides higher performance than known modern methods [14]. The method efficiently processes collision coefficients with spectral resolution. The proposed approach is based on the radiation transfer equation and the integral formula of the zero collision algorithm. The method can be used in computer graphics and scientific visualization, as well as for other areas of computer science.