Rtrace with spectrum mat problem

Hey everyone,

I am currently trying to perform spectral simulation using the new capabilities of radiance. However, I encountered a problem. I followed the explanations provided by dear Taoning and reached logical results, but then I realized that the defined materials were in RGB format. I created several spectral materials using spectraldb.com and Optics6 in a 20-channel format (cause genssky is 20-channel):

void spectrum spec_window
0 
0
22 380 780 0.0565 0.6663 0.744 0.6659 0.5499 0.36 0.2018 0.1983 0.2206 0.4904 0.8058 0.856 0.8553 0.848 0.8393 0.8288 0.8175 0.8054 0.7934 0.7815

spec_window glass window
0 
0
3 1 1 1

But the results of rtrace became very large, something like 2.9744e+7 and when I rerun the simulation at solar noon during the summer solstice, the results went to +Infinity!
I didn’t change any of the settings or other inputs, and I used -pM in all simulations.

And one more question: what happens if the number of channels defined in the material is not the same as that of the light source, and how are the channels distributed? For example, if the sky has 20 channels and the materials have 81 channels.

Thanks in advance

I am sorry you are having trouble with the new Radiance spectral calculations.

Can you share more details of your test scene and your command line?

Different spectra are made compatible with the rendering sampling determined by the -cw and -cs options. Some details may be found in my workshop presentations posted here.

Cheers,
-Greg

1 Like

Hi dear Greg,

Thank you for your response.
I initially ran this test with Python and then on Linux and got same results. The configuration of the Python code is similar to what Taoning provided in his workshop.
I have also uploaded all the inputs(ssky, rad files, grid points, RGB mat and spectrum mat) and simulated outputs (-pM and -pY values for spectrum mat and RGB mat) here .

my_scene = pr.Scene(case_name, surfaces=[floor, wall, ceiling, window], materials=[mat], sources=[sky, spectra_sky])
    params = pr.SamplingParameters(
        I=True,
        ab=3,
        ad=4096,
        aa=0,
        lw=0.01,
        co=True,
        cs=20,
    )
   
    grid_rays = "\n".join(" ".join(map(str, row)) for row in grid)

    result_p = pr.rtrace(grid_rays.encode(), my_scene.octree, params=params.args()+['-pY'], header=False, outform='f')

    result_m = pr.rtrace(grid_rays.encode(), my_scene.octree, params=params.args()+['-pM'], header=False, outform='f')

The problem is your walls and floor materials have reflectances much greater than 100%, as the spectra are in percentage rather than fractions as they should be. The simple fix is to change each material definition from something like:

void spectrum spectra_floor
0
0
22 380 780 11.32 29.49 42.63 45.8 48.01 49.62 50.9 52.69 53.84 54.99 56.31 57.27 57.89 58.33 58.63 58.81 59.06 59.47 59.64 59.64

spectra_floor plastic floor
0
0
5 1 1 1 0 0

to:

void spectrum spectra_floor
0
0
22 380 780 11.32 29.49 42.63 45.8 48.01 49.62 50.9 52.69 53.84 54.99 56.31 57.27 57.89 58.33 58.63 58.81 59.06 59.47 59.64 59.64

spectra_floor plastic floor
0
0
5 0.01 0.01 0.01 0 0

In other words, you can continue to cut-and-paste spectra, but be aware when they are in percentages rather than fractions. Your first example with the window glass was fine, which is why I needed to see your other files.

Best,
-Greg

1 Like

We have a function in pyradiance to load materials from spectral material database.

import pyradiance as pr
prims = pr.load_material_smd("data.csv", spectral=True)
1 Like

Oops!
What a silly mistake I made.
Thank you both of you

1 Like