honeybee_radiance.modifier.material.mist module

Radiance Mist Material.

http://radsite.lbl.gov/radiance/refer/ray.html#Mist

class honeybee_radiance.modifier.material.mist.Mist(identifier, modifier=None, values=None, is_opaque=None, dependencies=None)[source]

Bases: Material

Radiance Mist Material.

Mist is a virtual material used to delineate a volume of participating atmosphere. A list of important light sources may be given, along with an extinction coefficient, scattering albedo and scattering eccentricity parameter. The light sources named by the string argument list will be tested for scattering within the volume. Sources are identified by name, and virtual light sources may be indicated by giving the relaying object followed by ‘>’ followed by the source, i.e:

3  source1  mirror1>source10  mirror2>mirror1>source3

Normally, only one source is given per mist material, and there is an upper limit of 32 to the total number of active scattering sources. The extinction coefficient, if given, is added the the global coefficient set on the command line. Extinction is in units of 1/distance (distance based on the world coordinates), and indicates the proportional loss of radiance over one unit distance. The scattering albedo, if present, will override the global setting within the volume. An albedo of 0 0 0 means a perfectly absorbing medium, and an albedo of 1 1 1 means a perfectly scattering medium (no absorption). The scattering eccentricity parameter will likewise override the global setting if it is present. Scattering eccentricity indicates how much scattered light favors the forward direction, as fit by the Henyey-Greenstein function:

P(theta) = (1 - g*g) / (1 + g*g - 2*g*cos(theta))^1.5

A perfectly isotropic scattering medium has a g parameter of 0, and a highly directional material has a g parameter close to 1. Fits to the g parameter may be found along with typical extinction coefficients and scattering albedos for various atmospheres and cloud types in USGS meteorological tables. (A pattern will be applied to the extinction values.):

mod mist id
N src1 src2 .. srcN
0
0|3|6|7 [ rext gext bext [ ralb galb balb [ g ] ] ]

There are two usual uses of the mist type. One is to surround a beam from a spotlight or laser so that it is visible during rendering. For this application, it is important to use a cone (or cylinder) that is long enough and wide enough to contain the important visible portion. Light source photometry and intervening objects will have the desired effect, and crossing beams will result in additive scattering. For this application, it is best to leave off the real arguments, and use the global rendering parameters to control the atmosphere. The second application is to model clouds or other localized media. Complex boundary geometry may be used to give shape to a uniform medium, so long as the boundary encloses a proper volume. Alternatively, a pattern may be used to set the line integral value through the cloud for a ray entering or exiting a point in a given direction. For this application, it is best if cloud volumes do not overlap each other, and opaque objects contained within them may not be illuminated correctly unless the line integrals consider enclosed geometry.

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.

  • modifier – Modifier. It can be primitive, mixture, texture or pattern. (Default: None).

  • values – An array 3 arrays for primitive data. Each of the 3 sub-arrays refer to a line number in the radiance primitive definitions and the values in each array correspond to values occurring within each line.

  • is_opaque – A boolean to indicate whether this primitive is opaque.

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

Properties:
  • identifier

  • display_name

  • values

  • modifier

  • dependencies

  • is_modifier

  • is_material

  • is_opaque

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_dict(data)

Initialize the object from a dictionary.

Parameters

data – A dictionary in the format below.

{
"modifier": {},  # primitive modifier (Default: None)
"type": "",  # lowercase string for the primitive type
"identifier": "",  # primitive identifier
"display_name": "",  # primitive display name
"values": [],  # values
"dependencies": []
}
classmethod from_primitive_dict(primitive_dict)

Initialize the object from a primitive dict.

The primitive_dict is a dictionary following the base Primitive schema of a Radiance object. This base Primitive schema is the same for all Radiance Primitives (including Modifiers and Geometry) whereas the from_dict classmethod accepts a different schema that is customized to each subclass inheriting from the Radiance Primitive.

Parameters

data – A dictionary in the format below

{
"modifier": {},  # primitive modifier (Default: None)
"type": "",  # lowercase string for the 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()

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 dependencies

Get list of dependencies for this primitive.

Additional dependencies can be added with the add_dependent method.

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