This project computes the total solar irradiance (direct + diffuse + reflected) received by each wall of every building in a user-supplied city map. Using a shapefile as input, it constructs an LOD-1 3D model of all buildings, performs GPU-accelerated ray tracing to evaluate shading, and outputs per-wall irradiance maps and heatmaps for further visualization and solar potential analysis.
The pipeline is designed for city-scale performance, leveraging a Bounding Volume Hierarchy (BVH) and a compute shader for massively parallel shadow testing.
The image above shows an example visualization of the application’s output rendered in CesiumJS.
This visualization is not part of the repository; it is simply a demonstration of how the generated GeoJSON files and irradiance heatmap textures can be used in external tools for interactive exploration.
- Converts 2D building footprints + height attributes into LOD-1 extruded 3D geometry
- Uses ear-clipping triangulation for polygon meshing
- Builds a BVH acceleration structure for fast ray–triangle intersection
- Incorporates hourly EPW weather data (irradiance + sun position)
- Performs GPU-parallel ray tracing via compute shaders
- Computes direct, diffuse, and reflected irradiance per building wall
- Generates irradiance heatmaps and GeoJSON output for visualization
The shapefile must contain:
- Building footprints (2D polygons)
- A building height attribute
The EnergyPlus Weather (EPW) file provides:
-
Global Horizontal Irradiance (GHI)
-
Diffuse Horizontal Irradiance (DHI)
-
Direct Normal Irradiance (DNI)
-
Solar azimuth and zenith angles
These values are used per hour of the year.
Extract:
- Building coordinates
- Polygon geometry
- Building height
Each polygon is extruded to its height to create walls and roof faces.
Polygons are triangulated using Ear Clipping Triangulation, which runs in:
- O(k²) time for a polygon with k vertices
- O(n) overall for city data, since k is small and fixed per building
A Bounding Volume Hierarchy is constructed over all triangles.
Properties:
- O(n) memory usage
- O(log n) ray intersection queries
- Greatly accelerates ray tracing for shadow casting
From the EPW file, per hour:
- GHI, DHI, DNI
- Sun direction vector
These determine:
- Whether a wall is sun-facing
- The amount of irradiance it can receive
Walls are uniformly sampled.
The sampling density controls:
- The resolution of the heatmap
- The accuracy of shadow estimation
Each sampled point is sent to the compute shader.
A compute shader launches one thread per sampled point, performing:
- Generate a ray at the point in the sun direction
- Traverse the BVH
- Detect if any building obstructs the ray
Outputs:
- Whether the point receives direct sunlight
For each hour, for each wall:
shadowFraction = numObstructedPoints / totalSamplePoints
cosTheta = max(0, dot(outwardNormal, -sunDirection))
eDirect = DNI * (1 - shadowFraction) * cosTheta
eDiffuse = DHI * (1 + tiltFactor) / 2
eReflected = GHI * 0.2 * (1 - tiltFactor) / 2
totalIrradiance = eDirect + eDiffuse + eReflected
Diffuse and reflected irradiance use a standard isotropic sky model with a fixed ground albedo of 0.2.
For each building face:
- Irradiance values at sampled points
- A texture (heatmap) visualizing irradiance distribution
- A GeoJSON file linking geometry to irradiance
This enables use in GIS tools, dashboards, or BIPV potential workflows.
- Wall-wise irradiance values (W/m² or Wh/m²)
- Heatmap textures for each wall
- GeoJSON with irradiance attributes
- Uses LOD-1 geometry only (no roofs with slopes, balconies, overhangs)
- Trees and vegetation are not modeled
- Uses an isotropic diffuse model and fixed ground albedo
- Shadowing considers only building geometry
- C# (Unity or .NET)
- Compute shaders (HLSL)
- BVH acceleration structure
- Ear clipping triangulation
- EPW weather file parser
- GIS libraries (QGIS) for shapefile processing
- Add tree geometry and vegetation occlusion
- Integrate LOD-2 or LOD-3 building models
- Support anisotropic sky models (Perez, Hay-Davies)
- Incorporate multiple reflections or radiosity
- Improve sampling adaptively based on geometry
