# Calculation of View Factors for Building Simulations with an Open-Source Raytracing Tool
## 2 RADIANCE: Theoretical Basis and General Calculation Methodology  
### Introduction and Background  
RADIANCE is a collection of over a hundred independent command-line programs that are invoked in customized sequences to perform different types of lighting and daylighting simulations. It was developed in the mid-1980s at the Lawrence Berkeley National Laboratory by [PERSON] and has been under continued development since then. Detailed documentation about Radiance and its application for lighting and daylighting simulations can be found on [[https://www.radiance-online.org/](https://www.radiance-online.org/)]([https://www.radiance-online.org/](https://www.radiance-online.org/)) (accessed on 6 March 2022). The source code of Radiance and the compiled executables for different platforms are hosted at [[https://github.com/LBNL-ETA/Radiance](https://github.com/LBNL-ETA/Radiance)]([https://github.com/LBNL-ETA/Radiance](https://github.com/LBNL-ETA/Radiance)) (accessed on 6 March 2022). Initial research on RADIANCE focused on the development of its raytracing methodology [15] to simulate illuminated spaces [16]. The functionality of RADIANCE to accurately calculate photopic luminance [17] and a discussion on the underlying algorithms [18] can be found in the papers published by [PERSON] in the late 1980s.The results for lighting and daylighting simulations generated through RADIANCE have been empirically validated by an extensive body of research in the past three decades. An empirical validation of RADIANCE for simulating artificially lit spaces was conducted by [PERSON] in 1989 [19] and corresponding validation for daylight spaces was published by [PERSON] in 1995 [20]. Validation studies undertaken in the past decade have involved the use of complex shading systems [21] and annual daylighting simulation methods [22]. A schematic diagram showing the standard inputs and workflow for RADIANCE is shown in Figure 2. As is evident from the figure, the simulation methodology features the invocation of multiple programs in a specific sequence [23]. The core application of RADIANCE relates to raytracing. The purpose of the raytracing is to recursively evaluate Equation (4) at every sampled surface point of the geometry. \[ \begin{array}{c}L_{r}(\theta_{r},\varphi_{r})=L_{e}(\theta_{e},\varphi_{e})+ \\ \int\limits_{\varphi=0}^{2\pi}\int\limits_{\theta=0}^{\pi/2}L_{i}(\theta_{i}, \varphi_{i})\rho_{\text{bd}}(\theta_{i},\varphi_{i};\theta_{r},\varphi_{r})\ \cos\theta_{i}\sin\theta_{i}d\theta_{i}d\varphi_{i}\end{array}  \tag{4}\]  
where \(\theta\) is the polar angle measured from the surface normal, \(\varphi\) is the azimuthal angle, \(L_{e}(\theta_{e},\varphi_{e})\) is the emitted radiance in W/(sr\({}^{2}\)m\({}^{2}\)), \(L_{r}(\theta_{r},\varphi_{r})\) is the reflected radiance, \(L_{i}(\theta_{i},\varphi_{i})\) is the incident radiance and \(\rho_{\text{bd}}(\theta_{i},\varphi_{i},\theta_{r},\varphi_{r})\) is the bidirectional reflectance-transmittance distribution function in sr\({}^{-1}\). As indicated by the terms \(L_{e}\), \(L_{r}\), and \(L_{i}\) in Equation (4), the raytracing process calculates radiant energy emitted, reflected, and incident (respectively) at every sampled surface point. The raytracing algorithms are primarily accessed through three programs, namely: _rtrace_, _rpict_, and _contrib_. The surface-sampling methodology implemented in these programs is a combination of deterministic and stochastic sampling. In the context of lighting and daylighting simulations, deterministic sampling is used for calculating the radiant energy emitted by direct radiation sources like the sun or light fixtures. Stochastic sampling, which employs the Monte Carlo method, is used to calculate emitted or reflected radiation from diffuse sources like building surfaces. While _rpict_ and _rtrace_ incorporate additional techniques like ambient caching that are computationally efficient for lighting and daylighting applications, _contrib_ employs a pure Monte Carlo approach.