honeybee_radiance.modifier.material.absdf module

Radiance aBSDF Material.

https://floyd.lbl.gov/radiance/refer/ray.html#BSDF

class honeybee_radiance.modifier.material.absdf.aBSDF(bsdf_file, identifier=None, up_orientation=None, modifier=None, function_file='.', transform=None, angle_basis=None, dependencies=None)[source]

Bases: Material

Radiance aBSDF material.

From source code: https://github.com/LBNL-ETA/Radiance/blob/master/src/rt/m_bsdf.c “For the MAT_ABSDF type, we check for a strong “through” component. Such a component will cause direct rays to pass through unscattered. A separate test prevents over-counting by dropping samples that are too close to this “through” direction. BSDFs with such a through direction will also have a view component, meaning they are somewhat see-through. A MAT_BSDF type with zero thickness behaves the same as a MAT_ABSDF type with no strong through component.”

mod aBSDF id
5+ BSDFfile ux uy uz funcfile transform
0
0|3|6|9
    rfdif gfdif bfdif
    rbdif gbdif bbdif
    rtdif gtdif btdif

The __init__ method sets additional diffuse reflectance for front and back as well as additional diffuse transmittance to 0. You can setup these values by using their respective property.

Parameters
  • bsdf_file – Path to an xml file. Data will NOT be cached in memory.

  • identifier – Text string for a unique Material ID. Must not contain spaces or special characters. This will be used to identify the object across a model and in the exported Radiance files. If None, the identifier will be derived from the bsdf_file name. (Default: None)

  • up_orientation – (x, y ,z) vector that sets the hemisphere that the BSDF material faces. For materials that are symmetrical about the face plane (like non-angled venetian blinds), this can be any vector that is not perfectly normal to the face. For asymmetrical materials like angled venetian blinds, this variable should be coordinated with the direction the face are facing. The default is set to (0.01, 0.01, 1.00), which should hopefully not be perpendicular to any typical face.

  • modifier – Material modifier (Default: None).

  • function_file – Optional input for function file (Default: .).

  • transform – Optional transform input to to scale the thickness and reorient the up vector (default: None).

  • angle_basis – BSDF file angle basis. If not provided by user honeybee tries to find it by parsing BSDF file itself.

  • dependencies – A list of primitives that this primitive depends on. This argument is only useful for defining advanced primitives where the primitive is defined based on other primitives. (Default: [])

Properties:
  • identifier

  • display_name

  • bsdf_file

  • up_orientation

  • function_file

  • transform

  • angle_basis

  • front_diffuse_reflectance

  • back_diffuse_reflectance

  • diffuse_transmittance

  • dependencies

  • values

  • modifier

  • dependencies

  • is_modifier

  • is_material

ToString()

Overwrite .NET ToString.

add_dependent(dep)

Add dependent.

static compress_file(filepath)[source]

Compress bsdf data in an XML file to a string.

static decompress_to_file(value, filepath)[source]

Write bsdf data string to a file.

duplicate()

Get a copy of this object.

static filter_dict_input(input_dict)

Filter a dictionary of a Primitive to get modifier and dependency objects.

static find_angle_basis(bsdf_file, max_ln_count=2000)[source]

Find angle basis in an xml file.

classmethod from_dict(data, folder=None)[source]

Initialize a aBSDF from a dictionary.

Parameters
  • data – A dictionary in the format below.

  • folder – Path to a destination folder to save the bsdf file.

{
"modifier": {},  # material modifier (Default: None)
"type": "aBSDF",  # Material type
"identifier": "",  # Material identifer
"display_name": ""  # Material display name
"up_orientation": [number, number, number],
"function_file": string,  # default: '.'
"transform": string,  # default: None
"bsdf_data": string,  # bsdf file data as string
"front_diffuse_reflectance": [number, number, number],  # optional
"back_diffuse_reflectance": [number, number, number],  # optional
"diffuse_transmittance": [number, number, number]  # optional
}
classmethod from_primitive_dict(primitive_dict)[source]

Initialize a aBSDF from a primitive dict.

Parameters

data – A dictionary in the format below.

{
"modifier": {},  # primitive modifier (Default: None)
"type": "aBSDF",  # primitive type
"identifier": "",  # primitive identifier
"display_name": "",  # primitive display name
"values": []  # values,
"dependencies": []
}
classmethod from_string(primitive_string)

Create a Radiance primitive from a string.

If the primitive modifier is not void or it has other dependencies, the modifier and/or dependencies must also be part of the input string.

lock()
to_dict()[source]

Convert aBSDF material to a dictionary.

to_radiance(minimal=False, include_modifier=True, include_dependencies=True)

Return full radiance definition.

Parameters
  • minimal – Boolean to note whether the radiance string should be written in a minimal format (with spaces instead of line breaks). Default: False.

  • include_modifier – Boolean to note whether the modifier of this primitive should be included in the string. Default: True.

  • include_dependencies – Boolean to note whether the dependencies of this primitive should be included in the string. Default: True.

unlock()
GEOMETRYTYPES = {'bubble', 'cone', 'cup', 'cylinder', 'instance', 'mesh', 'polygon', 'ring', 'source', 'sphere', 'tube'}
MATERIALTYPES = {'BRTDfunc', 'BSDF', 'aBSDF', 'antimatter', 'ashik2', 'dielectric', 'glass', 'glow', 'illum', 'interface', 'light', 'metal', 'metal2', 'metdata', 'metfunc', 'mirror', 'mist', 'mixedfunc', 'plasdata', 'plasfunc', 'plastic', 'plastic2', 'prism1', 'prism2', 'spotlight', 'trans', 'trans2', 'transdata', 'transfunc'}
MIXTURETYPES = {'mixdata', 'mixfunc', 'mixpict', 'mixtext'}
MODIFIERTYPES = {'BRTDfunc', 'BSDF', 'aBSDF', 'antimatter', 'ashik2', 'brightdata', 'brightfunc', 'brighttext', 'colordata', 'colorfunc', 'colorpict', 'colortext', 'dielectric', 'glass', 'glow', 'illum', 'interface', 'light', 'metal', 'metal2', 'metdata', 'metfunc', 'mirror', 'mist', 'mixdata', 'mixedfunc', 'mixfunc', 'mixpict', 'mixtext', 'plasdata', 'plasfunc', 'plastic', 'plastic2', 'prism1', 'prism2', 'spotlight', 'texdata', 'texfunc', 'trans', 'trans2', 'transdata', 'transfunc'}
NONEOPAQUETYPES = {'BRTDfunc', 'BSDF', 'aBSDF', 'dielectric', 'glass', 'mist', 'mixfunc', 'prism1', 'prism2', 'trans', 'trans2', 'transdata', 'transfunc'}
PATTERNTYPES = {'brightdata', 'brightfunc', 'brighttext', 'colordata', 'colorfunc', 'colorpict', 'colortext'}
TEXTURETYPES = {'texdata', 'texfunc'}
TYPES = {'BRTDfunc', 'BSDF', 'aBSDF', 'antimatter', 'ashik2', 'brightdata', 'brightfunc', 'brighttext', 'bubble', 'colordata', 'colorfunc', 'colorpict', 'colortext', 'cone', 'cup', 'cylinder', 'dielectric', 'glass', 'glow', 'illum', 'instance', 'interface', 'light', 'mesh', 'metal', 'metal2', 'metdata', 'metfunc', 'mirror', 'mist', 'mixdata', 'mixedfunc', 'mixfunc', 'mixpict', 'mixtext', 'plasdata', 'plasfunc', 'plastic', 'plastic2', 'polygon', 'prism1', 'prism2', 'ring', 'source', 'sphere', 'spotlight', 'texdata', 'texfunc', 'trans', 'trans2', 'transdata', 'transfunc', 'tube'}
property angle_basis

Get or set a string for the BSDF file angle basis.

Valid values are Klems Full, Klems Half, Klems Quarter and TensorTree

property back_diffuse_reflectance

Get or set the additional back diffuse reflectance.

property bsdf_file

Path to BSDF file.

property dependencies

Get list of dependencies for this primitive.

Additional dependencies can be added with the add_dependent method.

property diffuse_transmittance

Get or set the additional diffuse transmittance.

property display_name

Get or set a string for the object name without any character restrictions.

If not set, this will be equal to the identifier.

property front_diffuse_reflectance

Get or set the additional front diffuse reflectance.

property function_file

Get or set the path to function file.

property identifier

Get or set a text string for the unique primitive identifier.

property is_geometry

Get a boolean noting whether this object is a Radiance geometry.

property is_material

Get a boolean noting whether this object is a material modifier.

property is_mixture

Get a boolean noting whether this object is a mixture modifier.

property is_modifier

Get a boolean indicating whether this object is a Radiance modifier.

Modifiers include materials, mixtures, textures and patterns.

property is_opaque

Get or set a boolean to indicate whether this primitive is opaque.

This property is used to separate opaque and non-opaque geometries as well as modifiers.

property is_pattern

Get a boolean noting whether this object is a pattern modifier.

property is_texture

Get a boolean noting whether this object is a texture modifier.

property is_void

Only true for a void.

property modifier

Get or set an object for the primitive modifier.

property sampling_type

Return rfluxmtx parameters sampling type based on the angle basis.

Values are:

  • kf for klems full.

  • kh for klems half.

  • kq for klems quarter.

For other angle basis a None value will be returned.

property transform

Get or set the transform.

This is optional and is used to scale the thickness and reorient the up vector. (Default: None).

property type

Get or set a string for the primitive type.

This should always be lower case in order to match the radiance convention.

property up_orientation

Get or set the up normal vector.

(x, y ,z) vector that sets the hemisphere that the BSDF material faces. For materials that are symmetrical about the face plane (like non-angled venetian blinds), this can be any vector that is not perfectly normal to the face. For asymmetrical materials like angled venetian blinds, this variable should be coordinated with the direction the face are facing. The default is set to (0.01, 0.01, 1.00), which should hopefully not be perpendicular to any typical face.

property values

Get or set the values of the current primitive as a list of three lists.

Each sub-list represents a line of the primitive’s radiance representation and contain the properties that define the primitive.

Usage:

# This will erase all values except the first line, which has 9 custom items
primitive.values = [
    [0.5, 0.5, 0.5, "/usr/oak.pic", ".", "frac(U)", "frac(V)", "-s", 1.1667],
    [],
    []
]