# Approximate Image-Space Multidirectional Occlusion Shading Model for Direct Volume Rendering
## 3 Image Space Multidirectional Occlusion Shading Model
### Opacity Approximation  
The partial occlusion computation described in Section 3.3.2 requires opacity values to accumulate the amount of light transported onto a pixel. In this section, we describe how to approximate opacity values continuously using volume transmittance. Volume transmittance per pixel from an eye position during the ray-casting rendering was calculated as follows. \[T(z)=\exp\left(-\int_{0}^{z}\alpha(z^{\prime})dz^{\prime}\right) \tag{6}\]  
\[T_{n}\approx\prod_{j=1}^{n}\exp\left(-\alpha(z_{j})\Delta z\right), \tag{7}\]  
where \(n\) is the number of samples to reach the depth \(z\) during the ray-casting rendering, \(\Delta z\) the distance \((z_{j}-z_{j-1})\) between samples, and \(\alpha\) the opacity at a certain depth \(z\). The volume transmittance \(T(z)\) is a continuous analytical form, whereas \(T_{n}\) is a discrete form, which was used for the actual computation. The transmittance through objects is illustrated in Figure 2a and decreases as a ray passes an object. In previous work [34], a list of transmittances and their corresponding depths from a light position was stored for the deep shadow maps. To reduce the number of samples in the list, they introduced a compression scheme with an error tolerance, which is acceptable in practice. However, the compression procedure required a large storage for the list, and it might not be interactive when the light position changes. Instead, we proposed a functional approximation for the transmittance list. Figure 7a shows a graph of the transmittance as an example where the shape of the graph is similar to that of the Gaussian function. In practice, we do not need very accurate transmittance. The Gaussian function used in this work was defined as follows. \[f(z)=\exp\left(-\beta z^{2}\right), \tag{8}\]  
where \(\beta\) is the parameter to be approximated. Note that we used \(f(z)\) to minimize the number of parameters that should be stored in a buffer, but other functional forms with more parameters can be used to approximate the transmittance more accurately. Since we wanted to find the best \(\beta\) to approximate \(T(z)\), we used least-squares fitting. The squared residual was defined as follows. \[R_{\text{residual}}=\sum_{i}\left(\beta z_{i}^{2}-\log\left(\frac{1}{T_{i}} \right)\right)^{2}. \tag{9}\]  
Figure 7: Transmittance approximation and multilayer. Actual volume transmittance (**a**) is computed using Equation (7). The approximate volume transmittance using a function is illustrated as the orange line in (**b**). The transmittance is computed per pixel. Both actual and approximate transmittance are computed in real time during the ray-casting rendering. Our ISMOS model is applied for transparent layers. (**c**) We used ISMOS only for the opaque layer (d3). (**d**) We computed the occlusions for all layers (d1, d2, d3). From this, we could define \(X=\left(z_{1}^{2},z_{2}^{2},\ldots,z_{n}^{2}\right)^{T}\) and \(y=\left(\log(1/T_{1}),\log(1/T_{2}),\ldots,\log(1/T_{n})\right)^{T}\). Then, we simply applied linear least-squares fitting. Therefore, the best \(\beta\) per pixel was computed as:  
\[\beta=\left(X^{T}X\right)^{-1}X^{T}y. \tag{10}\]  
\(\beta\) was computed in real time during the ray-casting rendering. The approximate transmittance \(f(z)\) per pixel is shown in Figure 7b. Since we approximated the volume transmittance by only one parameter \(\beta\) per pixel, \(\beta\) was stored in the A component of the color buffer (RGBA) to represent the entire volume transmittance instead of using additional buffers to store opacity values corresponding to the depth layers. Note that the A component in the color buffer (RGBA) was not actually used as a color in our ISMOS model, since we did not use any blending after the first rendering pass; therefore, it was possible to use the A component for the approximation parameter \(\beta\) without using an additional buffer. To calculate the approximate opacity value at a certain \(z\) from the transmittance approximation, we used Equations (11) and (12) in the following equations.