3D Shading

3D Shading Algorithm

“3D” is the short hand way of referring to the depth pass stencil buffer shadow volume (DPSBSV) algorithm used for advanced shadow modeling in PlantPredict. It is carried out with the aid of the OpenGL API. The DPSBSV is one of the most common ways that shadows are calculated in video games today. It is a graphical solution, meaning the algorithm must first draw out all of the objects in a given DC field (i.e. all PV tables, as well as any external objects added which could cause shading), and after it has done so it will count up the number of pixels that are in shadow. This is carried out in a 5 step process.

1.) Create the “shadow volumes”

Shadow volumes are objects whose interior represents where the shadow is cast. This is done by projecting the vertices of a solar panel or object in the opposite direction to the sun position vector. Figure X: Objects without shadows                                                  

Figure Xa&b: Shadows rendered as solid shadow volume

 

2.) Render the solar panels

3.) Render the shadow volume into the stencil buffer

The stencil buffer allows the user to make decisions on which areas to draw. Every stencil buffer pixel starts at 0; if a pixel sees the top of a shadow, the stencil buffer is incremented. If a pixel sees the bottom of a shadow, the stencil buffer is decremented. If it only sees a solar panel it is kept at 0.

 

4.) Redraw panels everywhere the stencil buffer is equal to 0

5.) Run occlusion test to get linear shading factor

So that it can perform the shading calculations as quickly as possible, the algorithm performs what is known as an occlusion test. This purpose of the test is to determine which hours have shading and to exclude any hours without shading from the calculation. Once an hour passes the occlusion test the linear shading factor can be determined simply by taking a ratio of the sum of the stencil buffer (shown in step 4) to the original field rendered with no shadows (shown in step 2).

3D plus Electrical Shading

For electrical shading the operation is a bit more complex. Instead of just taking a simple ratio of shaded area, the algorithm must determine which electrical strings are shaded. The number of total electrical strings in a DC Field is known based on the inputs, but In order to uniquely identify all electrical strings that are shaded the algorithm renders each one as a different color and passes these colors (represented numerically) into the stencil buffer. Finally, the algorithm counts up the total number of unique colors and divides it by the total number of electrical strings to yield the electrical shading factor for a given hour.

Diffuse Shading

At this current point in time, the 3D shading algorithm is only calculating the shading factors for the direct beam component of irradiance. The impact on diffuse irradiance is still being calculated by PlantPredict’s original diffuse model which accounts for the impact of row-to-row shading and slope. The PlantPredict team is working to quantify an accurate impact of diffuse shading in the 3D model, and how it pertains to the addition of near field objects.

Application of Shading Factors

            Linear –

The hourly linear shading factors are multiplied by the incident beam irradiance values so that a linear effective beam irradiance value can be determined.

Electrical –

The hourly electrical shading factors are multiplied by the incident beam irradiance values so that an electrical effective beam irradiance value can be determined.