Rcontrib or rtcontrib to trace light sources of specularly reflected lights

Hello everyone,

I’m using rcontrib to compute reflected light intensity of each sun in the sky. I faced some issues. So I politely ask some help here

  1. I merged several different suns in different solar positions with surface and material file of 3D models into octree file. As Greg thankfully informed several times in some previous answers, I used mirror and brightfunc to realize the specular surface which follows Fresnel law. However, rcontrib seems to detect the secondary source, the mirror, instead of the each sun with -m option. Is there a way to get it to calculate the contribution of the primary light source, which is each sun in my case? Or is there any other materials which doesn’t act as a secondary source and still can realize a specular reflective surface following fresnel law so that I can still stict to my current approach?
    Here is the surface material I used:

void brightfunc glass_angular_effect
2 0.09266+0.9312*exp(-5.3*Rdot) .
0
1 0.08

glass_angular_effect mirror glass_mat
0
0
3 1 1 1

  1. Also, while using the -o option in rcontrib, I’d like to use rcalc to calculate luminance, but it only provides RGB values without performing the calculation process. Below is the code snippet I’m using:

rcontrib -n 50 -h -V -o ./rcon_lum/%s.txt -m 11 -m 12 -m 13 -m 14 -ds 0.02 -dc 1 -dt 0 -dj 0.5 -st 0 -ss 64 -ab 3 -aa 0.02 -ar 1024 -ad 4096 -as 1024 -lw 1e-4 ./octree/oct_12.oct < ./rays.txt | rcalc -e ‘$1 = 179*(.265*$1+.670*$2 + .065*$3)’

Could you please advise on what modifications should be made in the code?

Many thanks,
Inwoo

Hi Inwoo,

I don’t think there is any reason to use a mirror type in this case. However, it should still give you contributions from the solar sources, so long as your rays are hitting it from the correct angles.

Here are the real issues I see:

A) Fresnel reflection does not apply to a mirror surface with 100% reflection.

B) You can use the “metal” type, and leave off the brightfunc, since it includes Fresnel effects, but again, the reflectance should be less than 100% for this to matter.

C) Your RGB → luminance formula only works for values output to stdout. Your “-o ./rcon_lum/%s.txt” redirects the output to a file, so it is not affected by the follow-on rcalc command. I should also mention that, for Windows users, the -e expression should be enclosed in double-quotes rather than single-quotes. You can perform the conversion using:

rcontrib -o "!rcalc -e ‘$1=179*(.265*$1+.67*$2+.065*$3)’ > rcon_lum/%s.txt"

The ‘!’ at the beginning tells rcontrib to output to a command rather than a file.

D) I would not use “-n 50” for rcontrib, even if you have 50 cores. You have no interreflections in this scene, so are unlikely to get a speedup past 4 or 5 processes.

I hope this helps!
-Greg

1 Like