# Extract ray direction from rfluxmtx

**URL:** <https://discourse.radiance-online.org/t/extract-ray-direction-from-rfluxmtx/6415>\
**Category:** radiance-general\
**Created:** [December 4, 2023, 5:06am UTC](https://discourse.radiance-online.org/t/extract-ray-direction-from-rfluxmtx/6415 "2023-12-04T05:06:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matu](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@Matu](https://discourse.radiance-online.org/u/Matu)\
**Post date:** [December 4, 2023, 5:06am UTC](https://discourse.radiance-online.org/t/extract-ray-direction-from-rfluxmtx/6415/1 "2023-12-04T05:06:16Z")

</div>

Hello Radiance experts.

I would like to get a set of directions (Dx,Dy,Dz) and contributions in the rfluxmtx contribution calculation.  
For example, how can I correct the following command?

`rfluxmtx -I+ -y 56 -lw 0.0001 -ab 5 -ad 10000 -n 8 - skyglow_r6.rad -i scene.oct < points.txt > test.mtx`

I read the post below, I could not figure out how to write the specific code due to my lack of knowledge.

> [@Rcontrib extract ray intersections and directions](https://discourse.radiance-online.org/t/rcontrib-extract-ray-intersections-and-directions/5032):
>
> Hello, I’m using rcontrib and dctimestep to evaluate radiation that is being reflected from the glazing of a building onto a test point. This is working well, however… Now I would also like to save the world intersections (Px,Py,Pz) and directions (Dx,Dy,Dz) of the contributing rays. In the rcontrib manual, under the explanation of the -b option it mentions a way. Presumably should be straightforward but am struggling to replicate -.- .Would anyone be kindly able to offer a solution? I’m quit…

What I want to do is to determine the upward and downward incident components to the measurement point using the positive and negative of Dz.

I am a Radiance beginner. I apologize if I am misguided.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Greg\_Ward](https://discourse.radiance-online.org/user_avatar/discourse.radiance-online.org/greg_ward/32/471_2.png) [@Greg\_Ward](https://discourse.radiance-online.org/u/Greg_Ward)\
**Post date:** [December 4, 2023, 5:15pm UTC](https://discourse.radiance-online.org/t/extract-ray-direction-from-rfluxmtx/6415/2 "2023-12-04T17:15:11Z")

</div>

Hi Matu,

If you are talking about the orientations of your measurement surface elements, these are contained in your provided “points.txt” file, where each position and orientation (6 values) will correspond to a row in the generated matrix.

It sounds like you want to know the direction of the rays that reach the sky, which are binned according to the “skyglow\_r6.rad” options. I would have to see that file to know what you specified in there, but the output matrix columns will correspond to the directions in the sky subdivision. If you included a ground plane as normally recommended, then the first matrix column will be the average of all downward-directed rays. However, since everything gets averaged together, you cannot know how much each actual sample ray contributed. To get that level of granularity, you would probably need to use rtrace.

I hope this is of some help.

Cheers,  
-Greg

---

<div class="post-metadata">

**Author:** ![Matu](https://discourse.radiance-online.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@Matu](https://discourse.radiance-online.org/u/Matu)\
**Post date:** [December 5, 2023, 11:13am UTC](https://discourse.radiance-online.org/t/extract-ray-direction-from-rfluxmtx/6415/3 "2023-12-05T11:13:33Z")

</div>

Hi Greg,

Thanks for the helpful advice!
