![]() |
Rama
physically-based lighting Indirect lighting of the atmosphere |
Consider a view ray from the camera $\bc$ to a surface point $\bp$. The light which is scattered by the atmosphere towards the camera, along this view ray, is an integral over all the points $\bq$ of the view ray, and over all the directions $\bw$ at each point $\bq$, of the light $L$ coming from direction $\bw$ at $\bq$. Since we are interested here in the indirect lighting of the atmosphere, the incident light $L$ that we must consider is the light coming from the light sources via a single bounce on a diffuse surface or in the atmosphere. It is given by the $L_{LD}$ and $L_{LVE}$ functions that we computed in the Diffuse surfaces and Atmospheric scattering sections, respectively. Putting this together, we get the indirect lighting of the atmosphere as: \begin{equation} L_{L(D|V)VE}(\bc,\bp)=\int_{\bc}^{\bp}\mathfrak{t}(\bc,\bq)k_s(\bq)\int_\Omega P(\bw,\bq-\bc)\left[\mathfrak{t}(\bq,\br(\bq,\bw))L_{LD}(\br(\bq,\bw))+L_{LVE}(\bq,\br(\bq,\bw))\right]\diff\omega\diff\bq \end{equation} where $\br(\bq,\bw)$ the point on Rama's surface which is visible from $\bq$ in direction $\bw$ (i.e. the nearest intersection of the ray of origin $\bq$ and direction $\bw$ with the surface).
Since $L_{LD}$ and $L_{LVE}$ involve simple and double integrals, respectively, the whole expression involves triple and quadruple integrals, as well as ray-tracing computations for $\br(\bq,\bw)$. It is thus cleary impossible to compute analytically, and would be way too costly to integrate numerically at runtime. Hopefully the light sources in Rama are static and we showed in the previous sections that $L_{LD}$ can be precomputed in a lightmap and that $L_{LVE}$ can be approximated with a simple integral based on a precomputed volumetric lightmap $J_{LV}$. This "reduces" the runtime computation needs for the indirect atmosphere lighting to a triple integral, but this is still too much.
However, since we already used an approximation to reduce the computational cost of $L_{LVE}$, we can use the same approximation again in the above equation. This approximation was to replace the Rayleigh phase function with the isotropic phase function $1/4\pi$. Doing this yields: \begin{align} L_{L(D|V)VE}(\bc,\bp)&\approx\int_{\bc}^{\bp}\mathfrak{t}(\bc,\bq)J_{L(D|V)V}\diff\bq\\ J_{L(D|V)V}&=\frac{k_s(\bq)}{4\pi}\int_\Omega \left[\mathfrak{t}(\bq,\br(\bq,\bw))L_{LD}(\br(\bq,\bw))+L_{LVE}(\bq,\br(\bq,\bw))\right]\diff\omega \end{align} where $J_{L(D|V)V}(\bq)$ (in $W.m^{-3}$) can be seen as a volumetric light source, emitting light in all directions from all points and, most importantly, can be precomputed in a 3D texture. This finally reduces the runtime computational cost for the indirect lighting of the atmosphere to a simple integral per pixel.
Note: the mapping used in the Atmospheric scattering section assumes that the source term is symmetric under $120$ degrees rotations around the Rama axis, and around the planes passing through the light sources and the Rama axis. This is true for direct lighting, but not exactly true for indirect lighting, since this term includes contributions from the diffuse surfaces, whose shape and albedo are not exactly symmetric (but are quite close to this). This result in another small approximation compared to the "ground truth".
With the 6 linear light sources (and the same exposure) we get the following: