【Heskey带你玩渲染】Photon Mapping学术前沿
首先,老规矩:
未经允许禁止转载(防止某些人乱转,转着转着就到蛮牛之类的地方去了)
B站:Heskey0
PM, PPM, PPMAPA, SPPM
1. PM
a two-pass global illumination algorithm
-
The first pass is building a photon map using photon tracing
-
the second pass uses ray tracing to render the image.
Photon mapping decomposes the indirect illumination computation into diffuse and caustics parts, that are computed separately by special algorithms.
1.1 Algorithm Overview
Pass 1: Construct Photon Map
- Generate Photon Maps, the photons are shot from the light sources into the scene and they are classified as caustics photons and global photons.
- Process: Each photon is traced through the scene using a method similar to path tracing. Every time a photon hits a surface it is stored within the photon map and Russian roulette is used to determine whether the photon is absorbed or reflected (The new direction of a reflected photon is computed using the BRDF of the surface)
- Caustics Photon Map: The caustics photon map is used only to store photons corresponding to caustics and it is created by emitting photons towards the specular objects in the scene and storing these as they hit diffuse surfaces. Caustics are rendered by visualizing a radiance estimate(kNN) based on the caustics photon map directly and this requires a high density of photons.
- Global Photon map: emitting photons towards all objects. It is not visualized directly and therefore it does not require the same precision as the caustics photon map.
- Kd-Tree, a kd-tree is constructed for the global photon map and the caustic photon map. Those shadow photons are used during the rendering step to reduce the number of shadow rays.
Pass 2: Rendering via Path tracing
- Caustics, primary rays are shot from the camera to the scene. At hit points of the primary rays with the scene the illumination is computed by density estimation using kNN search in the caustics photon map.
- Direct Illumination, kNN search int the global photon map.
- Indirect Illumination, for a single hit on the object with a diffuse or glossy surface hundreds to thousands of final gather rays (FGRs) are shot. For each FGR the indirect illumination is computed by density estimation using kNN search in the global photon map. At Lambertian surfaces we also use the irradiance gradient caching scheme(reduce the computation of final gathering).
- the result of final gathering is noisy, at the same time the global photon map is blurry.
1.2 Memory Limitation
Since the photon map is stored in memory, the final quality is often limited by the maximum number of photons that can be stored in the photon map.
1.3 Biased
The radiance estimate in Equation 1 is the source of bias in photon mapping. The photon tracing step is unbiased, but the resulting photon distribution is blurred as part of the radiance estimate.
2. PPM
We overcome this problem(memory limitation) in photon mapping by using a sequence of smaller photon maps
- We use a concept similar to reverse photon mapping
2.1 Reverse Photon Mapping
Reverse photon mapping uses ray tracing in the first pass and photon tracing in the second pass.
The ray tracing step builds a kd-tree over the hit points and in the photon tracing step this kd-tree is used to find the nearest hit points that a photon contributes to.
2.2 Photon Ray Splatting
Since our density estimation is carried out in ray space rather than on surfaces, the results are more robust against geometrically incurred sources of bias.
Ray splatting removes boundary bias and topology bias by using rays rather than photons to perform the radiance estimate
- boundary bias: i.e., under-estimation of illumination near object boundary
- topological bias: i.e., over-estimation of illumination for curved surfaces
(1) Algorithm Overview
The basis of our method is a bidirectional path tracing algorithm combined with density estimation that samples eye and light paths (photons) whereby the eye paths are kept short to avoid the expensive final gathering.
No indirect eye paths are sampled except for deterministic reflections. Instead, the main computation is carried out for the light paths via photon splatting
The rendering algorithm consists of four passes:
- Eye pass: Primary rays are shot from the eye (camera) and created eye samples are stored at the hit points on the scene surfaces. The eye samples store position, normal, BRDF index, direction, pixel index, and weight for RGB components. Next a spatial kd-tree over the eye samples is constructed
- Light pass:
- Photon splatting:
- Final integration with BRDF evaluation:
2.3 PPM
We use a concept similar to reverse photon mapping
建议这部分直接去看PBRT,这里就不啰嗦了
VPM, Photon Surface
1. VPM
Volumetric photon mapping solves the RTE using a combination of photon tracing, ray-marching, and density estimation. (PM中的PT,对应到VPM,就是ray-marching)
- photon tracing:
- Russian Roulette: The ratio between the absorption and extinction coefficients describes the probability of absorption.
- Sampling Propagation Distance: importance sampling the transmittance term.
- Sampling Propagation Direction: importance sampling the phase function.
- ray-marching
- density estimation
- The conventional radiance estimate the in-scattered radiance at fixed points within the scene
This formulation is suboptimal
- firstly because it may gather the same photons more than once if the spherical neighborhoods overlap.
- secondly because it can lead to noise if the step size is too large and photons are omitted.
2. Photon Beam
2.1 Beam Radiance Estimate
Our technique replaces these multiple point-queries with a single beam-query
where \((t_i,\theta_i,r_i)=x_i\) are the cylindrical coordinates of photon \(i\) about the ray.
Path tracing measures the contribution of radiance arriving over the area of a pixel.
(1) Algorithm Overview
our volumetric photon mapping technique performs the following five steps:
- Shoot photons from light sources.
- Construct a balanced kd-tree for the photons.
- Photon Radius Computation: Assign a radius for each photon.
- Bounding Box Hierarchy Construction: Construct a bounding-box hierarchy over the photon-discs.
- The Beam Radiance Estimate: Use the photon BBH to render the image.
Steps 1 and 2 are identical to conventional photon mapping while 3–5 are unique to our approach and are explained in more detail below
(2) Photon Radius Computation
using the VK method (variable kernel method):
A smoothing kernel is “attached” to each photon and the radius of the kernel is allowed to vary from one photon to another, based on the local density.
with the beam radiance estimate, we blur in two dimensions (perpendicular to the ray) since the radiance we are computing already includes the integration along the ray itself. Therefore, the kernel in the beam estimate is normalized for 2D.
the kernel width:
where \(d_{i,m}\) is the distance from phton \(i\) to the \(m^{th}\) photon.
\(m\): controls the sensitivity of the computed radius to the local variation in density. \(m=\sqrt{n}\) works well as a default value.
(3) Bounding Box Hierarchy Construction
In order to efficiently locate all photons-discs which intersect a ray, we construct a bounding box hierarchy. (the same as BVH)
For each photon in the photon map, we compute the bounding box of all descendent photon-discs. The bounding box of each node encloses the node’s photon radius and the bounding boxes of its two child nodes.
(4) The Beam Radiance Estimate
During rendering we estimate the accumulated in-scattered radiance along viewing rays by locating all photons whose bounding spheres intersect the ray. These photons are found using a standard ray-BBH intersection traversal.
with the variable kernel method, a kernel \(K_i\) is defined per photon, leads to the following beam radiance estimate:
where \(x_i^\prime=x+t_i\vec\omega\) is the projection of the photon location \(x_i\) onto the ray's direction \(\vec\omega\), and \(t_i=(x_i-x)\cdot\vec\omega\).
We define the kernel as:
where \(r_i\) is the pre-computed radius for photon \(i\). We use Silverman's tow-dimensional biweight kernel along the ray, \(K_2(x)=3\pi^{-1}(1-x^2)^2\), where \(d_i\) is the shortest distance from photon \(i\) to the ray.
2.2 Progressive Photon Beams
3. Photon Surface
该部分为[Siggraph 2019]:
Photon Surfaces for Robust,unbiased Volumetric Density Estimation
我在B站已发布讲解视频
https://www.bilibili.com/video/BV1oZ4y187VH