[Radiance-general] BSDF reader

Sorry to bring this topic back to life... but I am working with this kind
of stuff, but as usual, I prefer to make some sketches of the algorithms
first on Scilab or Matlab.

Anyways, my question is: I know how to load the BSDF matrix without much
trouble. However, I do not understand how the matrix written in the xml
file is converted in a Color Matrix.
Are they just grey matrices? is there any easy calculation?

If it is complicated just let me know, and I will make some trivial tests
on the algorithm before going into C.

THANKS

German

···

2013/4/22 Andrew McNeil <[email protected]>

Hi Aitor,

I recommend considering using the BSDF parser library from Radiance if you
can. The library has load and query routines to get everything you need.
It supports both Klems and TensorTree BSDFs without any need to
differentiate between them your side.

I used it for BSDF viewer, and it would have been a breeze if I didn't
need to use Java Native Interface in the process.

Andy

On Mon, Apr 22, 2013 at 9:43 AM, Greg Ward <[email protected]> wrote:

Hi Aitor,

This question probably belongs on the radiance-dev list, so I am
cross-posting there and ask you to sign up (if you haven't already) and
respond on that list. (Same goes for others -- thanks!)

The data order in the file is a matrix running from smallest to largest
Klems patches, with the columns (inner loop data) corresponding to the
input directions. This is verified by a tag in the "DataDefinition"
section that says:

<IncidentDataStructure>Columns</IncidentDataStructure>

If "Rows" appears there instead of Columns, then the outgoing directions
are the inner loop, but this would be unusual and probably not supported by
WINDOW.

The units of a BSDF are 1/steradians.

If you have the opportunity to link to C code, you may also use the
existing BSDF parser library included in the Radiance source tree to do the
data loading and interpretation.

Best,
-Greg

*From: *leceta <[email protected]>

*Date: *April 22, 2013 9:23:06 AM PDT

*
*

Hi all,

i would like to write a BSDF/xml parser for Rhino/Grasshopper 3d
modelling software.

In order to correctly interpret the data contained in <ScatteringData>
element in the xml file, i would appreciate to know:

-The order of this data related to Klem´s patches. supposed that they are
measuremts for each input/output direction

- The units of this data. Lumens? Percentage?

thanks
aitor

_______________________________________________
Radiance-dev mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-dev

_______________________________________________
Radiance-dev mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-dev

German,
We have not implemented color in BSDF files yet. The contain only
spectrally averaged visible and/or solar data.
Andy

···

On Mon, May 13, 2013 at 2:25 PM, Germán Molina Larrain <[email protected]>wrote:

Sorry to bring this topic back to life... but I am working with this kind
of stuff, but as usual, I prefer to make some sketches of the algorithms
first on Scilab or Matlab.

Anyways, my question is: I know how to load the BSDF matrix without much
trouble. However, I do not understand how the matrix written in the xml
file is converted in a Color Matrix.
Are they just grey matrices? is there any easy calculation?

If it is complicated just let me know, and I will make some trivial tests
on the algorithm before going into C.

THANKS

German

2013/4/22 Andrew McNeil <[email protected]>

Hi Aitor,

I recommend considering using the BSDF parser library from Radiance if
you can. The library has load and query routines to get everything you
need. It supports both Klems and TensorTree BSDFs without any need to
differentiate between them your side.

I used it for BSDF viewer, and it would have been a breeze if I didn't
need to use Java Native Interface in the process.

Andy

On Mon, Apr 22, 2013 at 9:43 AM, Greg Ward <[email protected]>wrote:

Hi Aitor,

This question probably belongs on the radiance-dev list, so I am
cross-posting there and ask you to sign up (if you haven't already) and
respond on that list. (Same goes for others -- thanks!)

The data order in the file is a matrix running from smallest to largest
Klems patches, with the columns (inner loop data) corresponding to the
input directions. This is verified by a tag in the "DataDefinition"
section that says:

<IncidentDataStructure>Columns</IncidentDataStructure>

If "Rows" appears there instead of Columns, then the outgoing directions
are the inner loop, but this would be unusual and probably not supported by
WINDOW.

The units of a BSDF are 1/steradians.

If you have the opportunity to link to C code, you may also use the
existing BSDF parser library included in the Radiance source tree to do the
data loading and interpretation.

Best,
-Greg

*From: *leceta <[email protected]>

*Date: *April 22, 2013 9:23:06 AM PDT

*
*

Hi all,

i would like to write a BSDF/xml parser for Rhino/Grasshopper 3d
modelling software.

In order to correctly interpret the data contained in <ScatteringData>
element in the xml file, i would appreciate to know:

-The order of this data related to Klem´s patches. supposed that they
are measuremts for each input/output direction

- The units of this data. Lumens? Percentage?

thanks
aitor

_______________________________________________
Radiance-dev mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-dev

_______________________________________________
Radiance-dev mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-dev

_______________________________________________
Radiance-dev mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-dev

Hello,

I am currently looking into the optical properties of complex fenestration and writing a custom-made data parser to extract information from a data-driven BSDF file.

I have been looking into this old thred to find information about the BSDF .xml data structure, and I saw references to the BSDF parser library from Radiance. I would like to know if this library is still accessible and where to find it.

Thanks in advance,

Valeria

Hi Valeria,

The BSDF library is designed for general use, but is still distributed as part of Radiance, which can be downloaded from Radiance online or github. The ray/src/common directory contains the following sources:

bsdf.h
bsdf.c
bsdf_m.h
bsdf_m.c
bsdf_t.h
bsdf_t.c
ccolor.h
ccolor.c
disk2square.c
ezxml.h
ezxml.c
fvect.h
fvect.c
hilbert.h
hilbert.c
rtio.h
words.c
testBSDF.c

The final module listed is a main() created to demonstrate library use and provide some simple operations for command-line testing. If you compile together all of the above C files, you can create the testBSDF utility. Or, you can use the makeall function at the top level folder to build all of Radiance and use the standard linking procedure to the ray/src/lib/librtrad.a library that is created in that process.

If you just want the sources needed for the BSDF library, the above list is comprehensive. The “bsdf.h” file contains the best documentation, but I am happy to answer questions you may have in how to use it.

Cheers,
-Greg

Hi Greg,

Thank you very much for the resources. Maybe I can clarify what I am looking for. I am trying to understand how to retrieve total transmission and reflection values for each Klems incident direction from the XML files.

If I understood correctly, this is should be possible by summing the BSDF values multiplied by the projected solid angles for each Klems patch. I am trying to understand how the projected solid angles are calculated. I had a look at bsdf.h but I am not sure I understand that.

Maybe you can help me clarify that?

Best,

Valeria

The Radiance BSDF library is the easiest way to get to this integral. If you look at the “testBSDF.c” main() routine, you can see how to load a BSDF. After that, you want to make a call to the SDdirectHemi() routine, as demonstrated in the “hemispherical values” section of main(). The flags that you pass determine which hemisphere(s) to include in the integral.

It is also possible to perform a manual calculation, but you would have to write your own routine to parse the matrix and compute the sums against the solid angle of each entry. Those solid angles are computed with the io_getohm() call in bsdf_m.c using the theta values for the Klems patches.

1 Like

Hi Valeria,

An alternative will be to use radbsdf, a Python wrapper of the Radiance BSDF library that Greg mentioned above.
You can then query a BSDF (.xml) file in Python environment.
Here is the repo and docs if you are interested.

Hi Wang,

This looks very promising. However, I was not able to install the package correctly. It looks like something is missing. Also, should I install frad or radbsdf?

Sorry about the typo. You should install radbsdf.
I included wheels for more platforms. It would be great if you can try again with:
pip install radbsdf
If still no luck, please let me know your Python version, operating system, and the error message when it failed to install.

Dear Wang,

It works now, I tried all the functions you presented in the documentation. That’s a great tool!

However, I think there is a problem with the sd_data.proj_solid_angle(ivec) function. It always returns a couple of 0 as a solution, no matter what ivec is selected…

There is a test directory in the repo and inside a file called test_proj_solid_angle.py. Can you confirm that it runs? You’ll need to download/clone the repo and run the test file within the test directory.

If so, can you send me your xml file?

Dear Wang,
Processing: N11.xml…

The test_proj_solid_angle.py runs correctly. But I always get a 0 solution when I run the function for my XML files.

You can download my XML here:

Best,

Valeria

Hi Valeria,

Your xml file is fine. There is a bug in my code that’s causing the issue with query projected solid angle. Now that I fixed it. you can reinstall/upgrade through pip.

Taoning

Dear Taoning,

Thanks for the update. It does work now!

Best,

Valeria

1 Like