honeybee_radiance.modifier.material.trans module

Radiance Trans Material.

http://radsite.lbl.gov/radiance/refer/ray.html#Trans https://radiance-online.org//community/workshops/2010-freiburg/PDF/DavidMead.pdf

class honeybee_radiance.modifier.material.trans.Trans(identifier, r_reflectance=0.0, g_reflectance=0.0, b_reflectance=0.0, specularity=0.0, roughness=0.0, transmitted_diff=0.0, transmitted_spec=0.0, modifier=None, dependencies=None)[source]

Bases: Material

Radiance translucent material.

Parameters
  • 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.

  • r_reflectance – Reflectance for red. The value should be between 0 and 1 (Default: 0).

  • g_reflectance – Reflectance for green. The value should be between 0 and 1 (Default: 0).

  • b_reflectance – Reflectance for blue. The value should be between 0 and 1 (Default: 0).

  • specularity – Fraction of specularity. Specularity fractions greater than 0.1 are not common in non-metallic materials (Default: 0).

  • roughness – Roughness is specified as the rms slope of surface facets. A value of 0 corresponds to a perfectly smooth surface, and a value of 1 would be a very rough surface. Roughness values greater than 0.2 are not very realistic. (Default: 0).

  • transmitted_diff – The transmitted diffuse component is the fraction of transmitted light that is transmitted diffusely in as scattering fashion.

  • transmitted_spec – The transmitted specular component is the fraction of transmitted light that is not diffusely scattered.

  • modifier – Material modifier (Default: None).

  • 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: None)

Properties:
  • identifier

  • display_name

  • r_reflectance

  • g_reflectance

  • b_reflectance

  • specularity

  • roughness

  • transmitted_diff

  • transmitted_spec

  • average_reflectance

  • average_absorption

  • average_transmittance

  • diffuse_reflectance

  • diffuse_transmittance

  • specular_transmittance

  • specular_sampling_threshold

  • values

  • modifier

  • dependencies

  • is_modifier

  • is_material

ToString()

Overwrite .NET ToString.

add_dependent(dep)

Add dependent.

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.

classmethod from_average_properties(identifier, average_reflectance=0.0, average_transmittance=0.0, is_specular=False, is_diffusing=True, roughness=0.0, modifier=None, dependencies=None)[source]

Create trans material from average reflectance and transmittance.

The sum of average_reflectance and average_transmittance must be less than one and any energy not transmitted or reflected is assumed to be absorbed. The resulting material will always be grey with equivalent red, green and blue channels.

Parameters
  • 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.

  • average_reflectance – The average reflectance of the material. The value should be between 0 and 1 (Default: 0).

  • average_transmittance – The average transmittance of the material. The value should be between 0 and 1 (Default: 0).

  • is_specular – Boolean to note if the reflected component is specular (True) or diffuse (False). (Default: False).

  • is_diffusing – Boolean to note if the transmitted component is diffused (True) instead of specular like glass (False). (Default: True).

  • roughness – Roughness is specified as the rms slope of surface facets. A value of 0 corresponds to a perfectly smooth surface, and a value of 1 would be a very rough surface. Roughness values greater than 0.2 are not very realistic. (Default: 0).

  • modifier – Material modifier (Default: None).

  • 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: [])

classmethod from_dict(data)[source]

Initialize Trans from a dictionary.

Parameters

data – A dictionary in the format below.

{
"type": "Trans",  # Material type
"identifier": "", # Material identifier
"display_name": "",  # Material display name
"r_reflectance": float,  # Reflectance for red
"g_reflectance": float,  # Reflectance for green
"b_reflectance": float,  # Reflectance for blue
"specularity": float,  # Material specularity
"roughness": float,  # Material roughness
"transmitted_diff": float,
"transmitted_spec": float,
"dependencies": []
"modifier": {},  # Material modifier (Default: None)
}
classmethod from_primitive_dict(primitive_dict)[source]

Initialize Trans from a primitive dict.

Parameters

data – A dictionary in the format below.

{
"modifier": {},  # primitive modifier (Default: None)
"type": "trans",  # primitive type
"identifier": "",  # primitive identifier
"display_name": "",  # primitive display name
"values": [],  # values
"dependencies": []
}
classmethod from_reflected_specularity(identifier, r_reflectance=0.0, g_reflectance=0.0, b_reflectance=0.0, reflected_specularity=0.0, roughness=0.0, transmitted_diff=0.0, transmitted_spec=0.0, modifier=None, dependencies=None)[source]

Create trans material from reflected specularity.

This method assumes that all of the input fractions for reflectance and transmittance are absolute fractions of the total amount of light hitting the modifier. This is different than how Radiance natively interprets the properties.

Note: https://radiance-online.org//community/workshops/2010-freiburg/PDF/DavidMead.pdf

Parameters
  • 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.

  • r_reflectance – Reflectance for red. The value should be between 0 and 1 (Default: 0).

  • g_reflectance – Reflectance for green. The value should be between 0 and 1 (Default: 0).

  • b_reflectance – Reflectance for blue. The value should be between 0 and 1 (Default: 0).

  • reflected_specularity – Fraction of reflected specular. The reflected specularity of common uncoated glass is around .06, Matte = min 0, Satin = suggested max 0.07 (Default: 0).

  • roughness – Roughness is specified as the rms slope of surface facets. A value of 0 corresponds to a perfectly smooth surface, and a value of 1 would be a very rough surface. Roughness values greater than 0.2 are not very realistic. (Default: 0).

  • transmitted_diff – The transmitted diffuse component is the fraction of transmitted light that is transmitted diffusely in as scattering fashion.

  • transmitted_spec – The transmitted specular component is the fraction of transmitted light that is not diffusely scattered.

  • modifier – Material modifier (Default: None).

  • 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: [])

classmethod from_single_reflectance(identifier, rgb_reflectance=0.0, specularity=0.0, roughness=0.0, transmitted_diff=0.0, transmitted_spec=0.0, modifier=None, dependencies=None)[source]

Create trans material with single reflectance value.

Parameters
  • 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.

  • rgb_reflectance – Reflectance for red, green and blue. The value should be between 0 and 1 (Default: 0).

  • specularity – Fraction of specularity. Specularity fractions greater than 0.1 are not common in non-metallic materials (Default: 0).

  • roughness – Roughness is specified as the rms slope of surface facets. A value of 0 corresponds to a perfectly smooth surface, and a value of 1 would be a very rough surface. Roughness values greater than 0.2 are not very realistic. (Default: 0).

  • transmitted_diff – The transmitted diffuse component is the fraction of transmitted light that is transmitted diffusely in a scattering fashion.

  • transmitted_spec – The transmitted specular component is the fraction of transmitted light that is not diffusely scattered.

  • modifier – Material modifier (Default: None).

  • 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: [])

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]

Translate this object 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 average_absorption

Get the average absorption of over the RGB values of the material.

property average_reflectance

Get the average reflectance of over the RGB values of the material.

property average_transmittance

Get the total transmittance over the material.

property b_reflectance

Get or set the reflectance for blue channel.

The value should be between 0 and 1 (Default: 0).

property dependencies

Get list of dependencies for this primitive.

Additional dependencies can be added with the add_dependent method.

property diffuse_reflectance

Get the average diffuse reflectance of over the RGB values of the material.

property diffuse_transmittance

Get the total transmitted diffuse component.

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 g_reflectance

Get or set the reflectance for green channel.

The value should be between 0 and 1 (Default: 0).

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 r_reflectance

Get or set the reflectance for red channel.

The value should be between 0 and 1 (Default: 0).

property roughness

Get or set the roughness as the rms slope of surface facets.

A value of 0 corresponds to a perfectly smooth surface, and a value of 1 would be a very rough surface. Roughness values greater than 0.2 are not very realistic. (Default: 0).

property specular_sampling_threshold

Get the suggested specular sampling threshold (-st).

property specular_transmittance

Get the total transmitted specular component.

property specularity

Get or set the fraction of specularity.

In most cases specularity fractions greater than 0.1 are not common in non-metallic materials (Default: 0).

property transmitted_diff

Get or set the transmitted diffuse.

The transmitted diffuse component is the fraction of transmitted light that is transmitted diffusely in as scattering fashion.

property transmitted_spec

Get or set the transmitted specular.

The transmitted specular component is the fraction of transmitted light that is not diffusely scattered.

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 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],
    [],
    []
]