# Using Stochastic Ray Tracing to Simulate a Dense Time Series of Gross Primary Productivity
## 2 Methods
### Canopy Radiation Modeling  
The virtual scene can be used in a ray tracer that simulates the propagation of individual photons and their interactions with the scene. Photons travel along lines that may intersect with surface elements. At the location of the nearest intersection, a fate is computed as to whether the photon is absorbed, scattered, or penetrates the element freely without collision. A constant Lambertian scattering probability was used across all scene elements representing foliage, \(p_{l}\), (\(\rho_{l}=0.05\), \(\tau_{c,l}=0.02\)) and a constant Lambertian reflectance for all soil and bark elements, \(p_{s}\) and \(p_{b}\) respectively (\(\rho_{s}=\rho_{b}=0.1\)). For a Lambertian surface, the direction of scattering (_i.e._, reflection or transmission) is independent from the photon incidence angle and follows a cosine-weighted hemispherical probability distribution where the reflected intensity drops with the cosine angle [35,50]. Earlier work [18,51] showed the use of ray tracers for the simulation of transmittance, reflectance, and absorptance by virtual plant canopies. In forward ray tracing simulations, photons are emitted from a horizontal reference plane that is located just above the 3D scene and interactions with the scene are computed for fixed illumination and viewing conditions. The requirement to simulate a large number of rays to obtain a realistic distribution of canopy radiation makes the use of ray tracers, challenging when illumination conditions are dynamic and updates to the radiation budgets are needed in real-time [52]. The current method populates a look-up table (LUT) of which the rows correspond to scene elements \((p)\) and columns to sky directions \((\phi_{i},\theta_{i})\). Each table element corresponds to the probability (\(P_{abs}\)) of absorbing photon flux (\(\mu\text{mol}\cdot\text{s}^{-1}\)) that passes the reference plane from direction \((\phi_{i},\theta_{i})\) by canopy element \(p\), so that the sum of probabilities across rows corresponds to canopy absorptance from direction \((\phi_{i},\theta_{i})\). Using this LUT, the irradiance  
Figure 1: An illustration of the level of detail in Arbaro tree modelling software. Figure 2: (**A**) Forest plot reconstructions representing individual stems; and (**B**) a coarser level of detail, where foliage clustered around branches is represented as planar polygons. that is absorbed by a scene element can be estimated by integrating radiance over directions \((\phi_{i},\theta_{i})\) weighted by \(P_{abs}\):  
\[E_{al}\left(p\right)=\ \frac{A_{ref}}{A_{p}}.\iint\ P_{abs}\left(p,\phi_{i},\theta_{i} \right)\cdot L_{ic}\left(\phi_{i},\theta_{i}\right)\cdot cos\left(\theta_{i} \right)\cdot sin\left(\theta_{i}\right)\ \cdot d\theta_{i}\cdot d\phi_{i} \tag{1}\]  
In Equation (1), \(A_{ref}\cdot\iint\ L_{ic}\left(\phi_{i},\theta_{i}\right)\cdot cos\left(\theta _{i}\right)\cdot sin\left(\theta_{i}\right)\ \cdot d\theta_{i}\cdot d\phi_{i}\) expresses the flux of photons received over a projected solid angle that passes through the reference plane that is located just above the highest scene element. Inclusion of \(P_{abs}\) in the integral determines the fraction of photons passing the reference plane from the projected solid angle \(\Omega\left(=\iint\ cos\theta_{i}\cdot sin\theta_{i}\cdot d\theta_{i}\cdot d \phi_{i}\right)\) that are absorbed by scene element \(p\) and accounts for the orientation of the elements as well as shading, and multi-scattering between the elements. \(P_{abs}\) is computed as the fraction of photons from direction \((\phi_{i},\theta_{i})\) that is absorbed by element \(p\). Finally, division by \(A_{p}\) normalizes this absorbed quantity to \(\mu\)mol photons m\({}^{-2}\cdot\)s\({}^{-1}\). To improve computing time, the sky was sampled using a Capitulum sampling distribution that owes its name to the resemblance to the distribution of seeds in a sunflower head.