Hello everyone,
I am calculating the irradiance at the indoor calculation points following the Five-phase method in the tutorial(RadianceMatrixBasedMethod-v1.1), and I would like to obtain the incident ray angle when the direct sunlight reaches the calculation points. I’ve studied the documentation about ‘rtrace’, but it’s too complicated for me.
So, is there a way to output the incident ray angle at the calculation points?
Thanks,
Guo
Are you talking about the incident ray from the sun at each point on the surface? Do you need just the angle from the surface normal, or something else? Do you have any light sources in your scene other than the sun?
If you are only interested in the angle to the sun, you can take the surface normal at each ray intersection (-oN) and use the solar vector in your sky file to compute the angle with each normal rtrace spits out. I can be more specific if this is indeed what you want.
-Greg
Hello Greg,
Thank you for your reply.
- I am only interested in the angle to the sun and just the angle from the surface normal. And, there are no more light sources in my scene other than the sun.
- I have tried the following commands, but i got nothing.
oconv -f material.rad building.rad ProxyForWindow.rad > building.oct
rtrace -oN -fa -ab 1 building.oct < suns.rad
My ‘suns.rad’ maybe wrong
- I also tried the following commands, but I get the directions in ‘points.txt’
oconv -f material.rad building.rad suns.rad ProxyForWindow.rad > building.oct
rtrace -oN -fa -ab 1 building.oct < points.txt - ‘rtrace’ requires ‘input for each ray is: xorg yorg zorg xdir ydir zdir’. Maybe I can set the ‘xdir ydir zdir’ the same as in the ‘suns.rad’. But I have no idea about the ‘xorg yorg zorg’.
Thank you for your help.
Best,
Guo
Hi Guo,
You are right that you don’t give rtrace suns, but ray origins and directions or, if you are using the rtrace -I+ option, sample points and orientations to compute irradiance.
Do you have multiple suns in your scene? It seems you have a list of them in “suns.rad”. Do you want angles to all of them, or only one?
Also, what points do you want angles from? Do you want angles from all ray intersections in a multi-bounce calculation? If not, there is no reason to specify the “-ab 1” option.
Do you want angles corresponding to an image, or to a set of irradiance/illuminance measurement points? It would help if you were more specific about what you are trying to calculate. Note that the angles to a set of illuminance measures on a plane will all be the same.
Cheers,
-Greg
Hi Greg,
- I got irradiance on measurement points by
so I do not use the rtrace -I+ option this time. - It seens that ‘suns.rad’ contains 5185 suns, by
And, the cdses related to 5185 suns are computed by
Then, the sun/cds corresponding to each of the 8760 hours is selected by
Is my understanding correct? - I specify the “-ab 1” option to focus on the angle of direct sunlight, as
- I want angles corresponding to a set of irradiance/illuminance measurement points on floor and roof. I want to calculate the incident ray angle for the entire year.
Thank you for your help.
Best,
Guo
This is not a rendering problem. Just compute the dot products between your sun vector directions against the surface normal direction vectors (making sure both are normalized) and the arc-cosine will tell you the angle for each.
You can use rcalc to extract the sun direction vectors as in your step 2, and the surface directions are just arguments $4, $5, and $6 in each line of your “points.txt” file.
cnt 5185 | rcalc -e MF:6 -f reinsrc.cal -e Rbin=recno -e “$1=Dx;$2=Dy;$3=Dz” > sunvecs.txt
To get a matrix of angles (in radians) you can use a trick with rmtxop:
rcalc -e “$1=$4;$2=$5;$3=$6” points.txt | rcollate -hi -fa3 -or 1 -oc $npts | rmtxop -fd “!rcollate -hi -fa3 -oc 1 -or 5185 sunvecs.txt” - -c 1 1 1 | getinfo - | rcalc -id -e '$1=acos($1)" > results.txt
It’s a bit complicated, but the first rcalc just extracts the surface normals from “points.txt”, assuming they are normalized. If they are not, then you can use the form below, instead. The output is sent through rcollate to put on a header that tells rmtxop that the input is a 3-component/entry matrix with 1 column and $npts rows. (You should set $npts to the number of points in “points.txt”.) Then, rmtxop loads the output of a second rcollate command, which takes the sun vectors and puts them into a matrix with a single row of values, which rmtxop concatenates with the point normals to create a matrix with $npts columns and 5185 rows. The final “-c 1 1 1” adds the 3 components together to complete the dot product for each element. This dot product matrix is then passed through a final getinfo command to strip the header so rcalc can compute the arc-cosine (angles) at each matrix position. (I convert to and from double to speed up the operation and eliminate the issue with matrix columns confusing rcalc.)
Oh, and the normalization command for “points.txt” in case you need it is:
rcalc -e "nm=1/sqrt($4*$4+$5*$5+$6*$6);$1=nm*$4;$2=nm*$5;$3=nm*$6’ points.txt
I didn’t test everything, so I hope this works. You can also use Excel if you’d rather to perform the calculations. As I said, this is not a rendering problem.
Cheers,
-Greg
Hi Greg,
Sorry for not explaining my question clearly before. This time, I’ve used a diagram to express it, and I hope it helps. The angle I want is in the first image. If I follow the commands you gave, the angle I calculate should be the one in the second image.
Best,
Guo
Hi Guo,
There is still a little ambiguity in your question/diagrams. Here are two interpretations and their implications:
-
Based on the second diagram, if the ray direction arriving at the sensor is unmodified by the scene (no scattering or reflection), then as Greg says this is not a rendering problem and can be found with a dot product between sun vector and sensor direction. In this interpretation I am assuming the blue ray going to the upper point in the upper diagram is from another sun position.
-
If instead I interpret the multiple rays in the top diagram to be scattering at the window layer, then you are not strictly interested in “direct sunlight”. If this is the case, then your question is ill posed. The “incident ray angle” does not exist as a single value, as scattered rays from the window will arrive at your sensor point from across the window surface. Given your rendering parameters, this means that, in addition to the shadow test ray, the subset of the 256 ambient rays that hit the window will all potentially have non-zero contributions to irradiance. So your “incident ray angle” would need to be defined as some (potentially weighted) average of those non-zero rays.
If #2 is correct, you will not be able to do this using sensor points with rcontrib, so you either would need to use rtrace with the full trace output, image based renders, or <<gasp, plug>> raytraverse. But there is also a strong likelihood all of those options are overkill depending on what you are ultimately trying to achieve. Can you share what your next step is? that will help to determine how accurate/general a solution might need to be. For example, given your simple room diagram, I’m not sure you would gain much beyond isolating this scatter component from the direct and using a fixed relationship between the single window center and each point (again calculated with a dot product).
If neither of my interpretations are correct, maybe you can try explaining what the single ray is that is not a fixed property of the solar direction?
-Stephen
Hi Stephen,
Thank you for your reply.
I agree with what you said in #2. Maybe the average (potentially weighted) of those non-zero rays is more suitable for my needs.
Perhaps I have a misunderstanding of ‘direct sunlight’. My current definition of ‘direct sunlight’ includes two key points: the gendaymtx -d
option and the rcontrib -ab 1
option.
My current workflow is as follow:
- I calculated the irradiance at the indoor calculation points following the Five-phase method in the tutorial(RadianceMatrixBasedMethod-v1.1). The Sun-Coefficient simulation part is as follows:
- I would like to analyze the incident angle of sunlight received at the measurement points, as one of the factors for optimizing the side windows.
Or in other words, can ‘rcontrib’ output the angle of the ray at the measurement points? Or is there another command that can achieve this?
Best,
Guo
The rendering process, including rcontrib, typically generates hundreds of rays at each measurement point. Singling out those that meet your definition of “direct” is difficult. If this is possible at all, you will need to use rtrace rather than rcontrib, add the desired options following rtrace -oTd, and figure out how to weight the ray directions and angles based on your criteria. Since you haven’t spelled those out for us, we can’t be much more help to you.
-Greg
Hi Greg,
Thank you for your reply.
After your explanation, I realized that this question is not very realistic. I’ll use the relative angle between the center of the window and the calculated point as an average angle (As Stephen said).
Thank you again.
Best,
Guo