Efficient sky visibility matrix computation

Hello community,

I am back again looking for some help. I’ve been working on generating a sky visibility matrix using Radiance and I’ve partially succeeded. However, I am interesting in learning if there is a more efficient way to use Radiance to do the same thing.

So far, I’ve been using rcontrib and then filtering the resulting daylight coefficients that are larger than zero. This is how my rcontrib call looks like:

rcontrib -n 20 -I+ -faf -ab 0 -y 1 -ad 256 -lw 1.0e-3 -dc 1 -dt 0 -dj 0 -faa -M 9750_suns_modifiers.rad my_scene.oct < my_points.pts

This is how my scene looks like:

And this is how my result looks like:

I am creating my_scene.oct octree by combining a file that contains a number of plastic polygons (my_scene.rad) and a file that specifies light sources at the positions where I am interested to test the sky visibility:

oconv -f my_scene.rad 9750_suns.rad > my_scene.oct

where my 9750_suns.rad file looks something like this:

void light source_00000 0 0 3 1e6 1e6 1e6
source_00000 source sun_00000 0 0 4 0.00000 0.99972 0.02380 0.533
void light source_00001 0 0 3 1e6 1e6 1e6
source_00001 source sun_00001 0 0 4 0.00000 0.99887 0.04758 0.533
void light source_00002 0 0 3 1e6 1e6 1e6
source_00002 source sun_00002 0 0 4 0.00000 0.99745 0.07134 0.533

void light source_09749 0 0 3 1e6 1e6 1e6
source_09749 source sun_09749 0 0 4 -0.00100 0.02378 0.99972 0.533

And my 9750_suns_modifiers.rad file used in the rcontrib call is simply a list of all the modifiers in 9750_suns.rad.

If I understand things correctly, in this case rcontrib simply tests the visibility of each light source with a single ray. If the ray intersects a surface in the octree the result is zero, otherwise, if the light source is visible, the result is the dot product between the normal associated with my test point and the vector pointing to the light source. In my particular case, the actual value of the dot product is not interesting because I am looking for a binary result: visible/not visible.

Given the (relative) simplicity of these calculations, I expected rcontrib to run much faster than it did. Also, it seems like overkill to use a program as powerful as rcontrib to do these simple calculations. So I’m wondering if there’s a more efficient way to achieve the same result.

Does someone have any suggestions?

A simpler approach would be to create 9750 vector directions (same as the direction for each sun), ordering these in a file and use rtrace on your local scene geometry. You don’t even need any light sources – just test if the distance is > 1e9 like so:

rcalc -e ‘$1=Px;$2=Py;$3=Pz;$4=$1;$5=$2;$6=$3’ vector_list.txt \
| rtrace -h -oL local_geometry.oct \
| rcalc -e ‘$1=if($1-1e9,1,0)’ > sky_visible.txt

You should replace the Px, Py, and Pz in the first rcalc command with your point of interest. The “vector_list.txt” file contains the direction vectors for your sky positions, one per line. The rtrace command just tests each ray against the local geometry, and the final rcalc puts a ‘1’ if the sky is visible in that direction from your point, or ‘0’ if not.

-Greg

2 Likes

Thank you Greg! I will try this. :smiley: