Having nothing to do over the weekend, I wanted to see if I can reproduce ClimateStudio’s pass-like simulation workflow in vanilla Radiance.
Folks at Solemma came up with this path-tracing “pass” style workflow. Not only it’s fast, but it’s also a great way to communicate the ray-tracing process to the end-users. Having been inspired by that, I was wondering if I can recreate that workflow using existing tools with vanilla Radiance.
Specifically, I was using Numpy in Python Jupyter lab environment. Numpy is a python library that wraps the BLAS linear algebra library written in C and Fortran. As a result, Numpy is fast for matrix multiplication, which comes in very handy with Radiance matrix-based simulation. I’ve written some routines for loading and doing matrix multiplication in Numpy in frads. Running Python in Jupyter Lab allows us to store the loaded matrix files for later use so that we can multiply matrices quickly for each pass.
The rest of the workflow is then very simple:
- gather the octree
- gather the input grid sensor
- load an annual sky-matrix into memory
- call rcontrib to generate a sensor-to-sky matrix
- multiply the sensor-to-sky matrix with the preloaded sky-matrix
- Figure out the sDA, e.g. what percentage of the year a sensor is > 300 lx, .etc.
- Plot our sDA results.
- Repeat another run starting at step 4, compute the cumulated average sDA from previous runs and plot the cumulative average.
Here I have a simple open office model with 460 workplane sensors. The results look like this (this .gif should be in real-time with each pass takes a little over a second). Instead of having ambient division (
ad) set to 1 to mimic pass-tracing, I set it to 64 since the initial ray generation relies on
ad as well. There may be a better way to generate the initial rays with something like
The entire code is available here if you are interested. You can also try the script with your own model.
Let me know if you have any feedback or questions.