Presentation is loading. Please wait.

Presentation is loading. Please wait.

Szirmay-Kalos László Magdics Milán Tóth Balázs

Similar presentations


Presentation on theme: "Szirmay-Kalos László Magdics Milán Tóth Balázs"— Presentation transcript:

1 Szirmay-Kalos László Magdics Milán Tóth Balázs
Free Path Sampling in High Resolution Inhomogeneous Participating Media Szirmay-Kalos László Magdics Milán Tóth Balázs Budapest University of Technology and Economics, Hungary

2 Problem statement GI rendering in participating media:
Free path between scattering points Absorption or scattering Scattering direction When photons are traced in participating media, for example, to obtain a global illumination solution, we have to repeat three fundamental operations. First, we have to find the free path length of the photon, that is, sample the location where this photon is scattered on some particle of the medium. Then, we have to decide whether or not the photon is absorbed. Finally, if the photon is not absorbed, a new scattered direction needs to be found. The first step, free path sampling shows up only in participating media rendering, while absorption decision and scattering direction sampling are also important parts in surface rendering as well. Free path sampling is the most time consuming step in high resolution and inhomogeneous media. This paper addresses this crucial step of participating media rendering.

3 r s Free Path Sampling CDF of free path Optical depth
According to importance sampling, the density of the free path should mimic the integrand of rendering. The cumulative distribution of such random length is an exponential function of the optical depth, which is obtained by the line integral of the extinction parameter or the medium density. Thus, free path sampling means the computation of s as the solution of this equation for number r that is uniformly distributed in the unit interval. Optical depth Sampling equation

4 r s Homogeneous case is simple
We note that if the media were homogeneous, then the optical depth would be proportional to the path length and the cumulative distribution would be a simple exponential function, which can be inverted expressing the free path length from random number r.

5 Ray marching Complexity grows with the resolution
In inhomogeneous media, however, the optical depth integral of the extinction should be evaluated. One possibility is the approximation of this integral by a Riemann sum, which leads to the well known ray marching process. We make small steps along the ray and when the exponential decay of the ever growing optical depth falls below the random number, we obtain the interaction point. Ray marching takes a sample in each intersected voxel, so very many steps need to be made if the average free path length is large and the volume is defined by a high resolution voxel array. Complexity grows with the resolution Independent of the density variation Slow in high resolution low density media Reject Reject Accept

6 Woodcock tracking Accept with prob: (t)/max Resolution independent
Another option is Woodcock tracking, which randomizes the sampling process, somehow similarly as Russian roulette randomizes the path termination. Woodcock tracking generates a random free path length with the maximum extinction parameter of the medium, obtaining a tentative collision point. The extinction of the tentative collision is fetched and this tentative collision is accepted with the probability that is equal to the ratio of the fetched extinction and the maximum extinction. If the tentative collision is rejected, then a similar step is done from the tentative point, and the same operation is repeated until acceptance. It can be proven that this rejection sampling scheme generates free path length with the required probability density. Woodcock tracking is resolution independent, so it becomes very efficient in high resolution media. However, as acceptance is computed with the ratio of the current and the maximal extinctions, very many rejections happen in strongly inhomogeneous media, where, for example, a small part is very dense and the rest is not dense at all. Resolution independent Complexity grows with the density variation Slow in strongly inhomogeneous media

7 Contribution of this paper
Sampling scheme for inhomogeneous media Generalization of Woodcock tracking and ray marching Involves them as two extreme cases Offers new possibilities between them Application for high resolution voxel arrays Application for procedurally generated media of ”unlimited resolution” The contribution of this paper is a sampling scheme that generalizes ray marching and Woodcock tracking, combining their advantages and getting rid of their disadvantages. The new sampling scheme involves classical ray marching and also Woodcock tracking as special cases, but offers infinitely many possibilities in between these extreme solutions. So it is a tool that can be adapted to the properties of the medium. As a demonstration, we use this sampling scheme both for high resolution voxels arrays, and for procedurally generated participating media, where potentionally infinite resolution can be considered.

8 Inhomogeneous media Scattering lobe (albedo +
Phase function) variation Spatial density variation Free path Photon Particle and its scattering lobe If we wish to extend simplicity of free path sampling in homogeneous medium for inhomogeneous medium, we should first understand the difference between the homogeneous and inhomogeneous volumes. Participating media are collections of volume particles the photon may collide with. If the density, albedo or the phase function of these particles are uniform, then the medium is homogeneous, otherwise it is inhomogeneous. The albedo and the phase function do not affect the free path length, so we consider only the non-uniform density of particles. Collision High density region In free path sampling only density variation matters! Low density region

9 Mix virtual particles to modify the density but to keep the radiance
collision Virtual particle and its scattering lobe Photon Real collision In order to simplify free path sampling, we modify the density of the medium, adding virtual particles to the real particles where necessary. If we do it in a naive way, this modification also affects the light radiance in the medium, so we would change the underlying problem in an unacceptable way. The question is whether we can set the properties of these virtual particles so that they alter the density and thus ease free path sampling, but guarantee the original radiance values. If a virtual particle has albedo 1, that is, it never absorbs a photon, and its phase function is a Dirac delta, that is, it never changes the direction of the photon, then the introduction of virtual particles will not change the radiance inside the volume. However, they can modify the density to make free path sampling easier. As in Monte Carlo simulation, we aim at expected values, it is enough if we determine only randomly whether a collision happened on a real or on a virtual particle, just the expectations must be correct. So the sampling algorithm would sample free path lengths using the density of the combined material containing both real and virtual particles. When a scattering point is found, it decides randomly whether a virtual or a real collision is found with a probability that equals to the density of real particles and the density of the combined medium. If a virtual particle is found, we do not change the direction, but repeat the sampling step as required by a Diract delta like phase function. Probability of hitting a real particle: (t)/((t)+virtual (t))=(t)/comb(t)

10 Sampling with virtual particles
Find comb(t) = (t)+virtual(t) upper bounding function extinction comb(t), Analytic evaluation: Sample with comb(t) Real collision with probability (t)/comb(t) This reasoning remains valid for arbitrary non-negative density of the virtual particles. Generally, the objective of the definition of the virtual particle density must be the easiness of sampling with the combined density, which is the case if the combined density can be analytically integrated, and the integral can be analytically inverted.

11 Challenges For the volume density find an analytically integrable sharp upperbound Voxel arrays: constant or linear upper-bound in super-voxels Procedural definition: depends on the actual procedure We demonstrate it with Perlin noise Finding such an analytically integrable upperbound is a challenge that needs to be addressed separately for every major volume representation. The optimal combined density is a sharp upperbound since we wish to mimimize the number of virtual collisions for the sake of efficiency. If the volume is available in a voxel array, then a piece-wise constant or tri-linear upperbound can easily be obtained. The exciting case is the procedural definition of the medium, when the selection of the virtual density depends on how the real density is defined. Here, as an example, we consider media defined by 3D Perlin noise.

12 Procedural media (Perlin noise)
To create fractal noise, we add up elemental noise functions defined on different scales. On a given scale, the noise is defined at discrete points and the value is interpolated between the sample points.

13 Upper bound: construction up to a limited scale
noise To apply our sampling scheme, we have to find a simple but sharp upper bounding function for the fractal noise. Such upper bounding function can be obtained if the noise is computed just up to a reduced level and on the missing finer levels, the noise values are replaced by the maximum amplitude of the noise. Perlin noise usually operates on a regular grid, so stopping the generation on higher levels correspond to the calculation of the noise just on a coarse grid and lifting it up with the maximum values of the missing levels. original resolution super-voxel resolution

14 Line integration scattering point where super-voxels ray optical depth
The voxels of this coarse grid are called super voxels since they include a lot of real voxels of the high resolution media. Inside a super-voxel the upper bounding extinction is available analytically and can be integrated. During free path sampling, we execute a ray marching algorithm on the super-voxel grid. When the super-voxel containing the solution of the sampling equation is found, then the sampling equation is solved for the exact point. Reading the real density at this point, we can decide randomly whether real or just virtual scattering happened. optical depth real depth original voxels

15 5123 voxel array, 32 million rays
Ray marching: 9 sec: Woodcock: 7 sec: New: 1.4 sec: The algorithm has been tested with voxel arrays defining the visible human. To compute the radiation dose with 32 million rays, classical ray marching needed 9 seconds, Woodcock tracking 7 seconds, and the new method with piece-wise linear upper bound only 1.4 seconds a little more when piece-wise constant upper bound was used. The performance depends on the resolution of the super-voxel grid. Here we show how many rays can be shot in a second. If the super-voxel has just a single cell, the algorithm is equivalent to Woodcock tracking. Using more cells, the performance increases, and eventually when the super-voxel grid has the same resolution as the original grid, we get ray marching back. In this example, the optimum needed 16^3 super-voxels, and in this case we got 5 times the speed of ray marching. Million rays per second with respect to the super voxel resolution

16 Perlin noise clouds, 9 million rays
If the resolution is higher, the advantage of the method becomes even more significant. We considered Perlin noise clouds at low, 256^3 and high, 4000^3 effective resolutions and examined both weakly and strongly inhomogeneous volumes. The speed up with respect to ray marching is more than a hundred for the high resolution case, and the method is fairly insensitive to the variation of the density.

17 Million rays per second
Scalability This table shows the scalability up to astronomically high resolutions, when the effective resolution is over 32 thousand cube. The speed up with respect ray marching is between 10 and a thousand, and with respect to Woodcock tracking is about three. The advantage over Woodcock tracking is higher when the volume is more inhomogeneous. Million rays per second

18 Videos 40963 effective resolution 40963 effective resolution
Two videos, both of them are the global illumination solutions for a volume of 4000 cube effective resolutions. In the first video, a frame is computed with 5 million photons and the volume is static, in the second video, the volume is also dynamic and we used 50 million photons to obtain flicker free animation. 40963 effective resolution 1283 super-voxel grid 5 million photons/frame 1 sec/frame 40963 effective resolution 1283 super-voxel grid 50 million photons/frame 9 sec/frame

19 Conclusions Handling of inhomogeneous media by mixing virtual particles that Simplify free path length sampling Do not change the radiance Compromise between ray marching and Woodcock tracking Much better than ray marching in high resolution media Much better than Woodcock tracking in strongly inhomogeneous media This paper proposed a free path length sampling method for inhomogeneous high resolution participating media, which is based on mixing virtual particles to the existing ones such that the radiance remains unchanged. The new method can be considered as a generalization or combination of ray marching and Woodcock tracking and can combine their advantages.


Download ppt "Szirmay-Kalos László Magdics Milán Tóth Balázs"

Similar presentations


Ads by Google