honeybee-radiance 1.66.190__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of honeybee-radiance might be problematic. Click here for more details.
- honeybee_radiance/__init__.py +11 -0
- honeybee_radiance/__main__.py +4 -0
- honeybee_radiance/_extend_honeybee.py +93 -0
- honeybee_radiance/cli/__init__.py +88 -0
- honeybee_radiance/cli/dc.py +400 -0
- honeybee_radiance/cli/edit.py +529 -0
- honeybee_radiance/cli/glare.py +118 -0
- honeybee_radiance/cli/grid.py +859 -0
- honeybee_radiance/cli/lib.py +458 -0
- honeybee_radiance/cli/modifier.py +133 -0
- honeybee_radiance/cli/mtx.py +226 -0
- honeybee_radiance/cli/multiphase.py +1034 -0
- honeybee_radiance/cli/octree.py +640 -0
- honeybee_radiance/cli/postprocess.py +1186 -0
- honeybee_radiance/cli/raytrace.py +219 -0
- honeybee_radiance/cli/rpict.py +125 -0
- honeybee_radiance/cli/schedule.py +56 -0
- honeybee_radiance/cli/setconfig.py +63 -0
- honeybee_radiance/cli/sky.py +545 -0
- honeybee_radiance/cli/study.py +66 -0
- honeybee_radiance/cli/sunpath.py +331 -0
- honeybee_radiance/cli/threephase.py +255 -0
- honeybee_radiance/cli/translate.py +400 -0
- honeybee_radiance/cli/util.py +121 -0
- honeybee_radiance/cli/view.py +261 -0
- honeybee_radiance/cli/viewfactor.py +347 -0
- honeybee_radiance/config.json +6 -0
- honeybee_radiance/config.py +427 -0
- honeybee_radiance/dictutil.py +50 -0
- honeybee_radiance/dynamic/__init__.py +5 -0
- honeybee_radiance/dynamic/group.py +479 -0
- honeybee_radiance/dynamic/multiphase.py +557 -0
- honeybee_radiance/dynamic/state.py +718 -0
- honeybee_radiance/dynamic/stategeo.py +352 -0
- honeybee_radiance/geometry/__init__.py +13 -0
- honeybee_radiance/geometry/bubble.py +42 -0
- honeybee_radiance/geometry/cone.py +215 -0
- honeybee_radiance/geometry/cup.py +54 -0
- honeybee_radiance/geometry/cylinder.py +197 -0
- honeybee_radiance/geometry/geometrybase.py +37 -0
- honeybee_radiance/geometry/instance.py +40 -0
- honeybee_radiance/geometry/mesh.py +38 -0
- honeybee_radiance/geometry/polygon.py +174 -0
- honeybee_radiance/geometry/ring.py +214 -0
- honeybee_radiance/geometry/source.py +182 -0
- honeybee_radiance/geometry/sphere.py +178 -0
- honeybee_radiance/geometry/tube.py +46 -0
- honeybee_radiance/lib/__init__.py +1 -0
- honeybee_radiance/lib/_loadmodifiers.py +72 -0
- honeybee_radiance/lib/_loadmodifiersets.py +69 -0
- honeybee_radiance/lib/modifiers.py +58 -0
- honeybee_radiance/lib/modifiersets.py +63 -0
- honeybee_radiance/lightpath.py +204 -0
- honeybee_radiance/lightsource/__init__.py +1 -0
- honeybee_radiance/lightsource/_gendaylit.py +479 -0
- honeybee_radiance/lightsource/dictutil.py +49 -0
- honeybee_radiance/lightsource/ground.py +160 -0
- honeybee_radiance/lightsource/sky/__init__.py +7 -0
- honeybee_radiance/lightsource/sky/_skybase.py +177 -0
- honeybee_radiance/lightsource/sky/certainirradiance.py +232 -0
- honeybee_radiance/lightsource/sky/cie.py +378 -0
- honeybee_radiance/lightsource/sky/climatebased.py +501 -0
- honeybee_radiance/lightsource/sky/hemisphere.py +160 -0
- honeybee_radiance/lightsource/sky/skydome.py +113 -0
- honeybee_radiance/lightsource/sky/skymatrix.py +163 -0
- honeybee_radiance/lightsource/sky/strutil.py +34 -0
- honeybee_radiance/lightsource/sky/sunmatrix.py +212 -0
- honeybee_radiance/lightsource/sunpath.py +247 -0
- honeybee_radiance/modifier/__init__.py +3 -0
- honeybee_radiance/modifier/material/__init__.py +30 -0
- honeybee_radiance/modifier/material/absdf.py +477 -0
- honeybee_radiance/modifier/material/antimatter.py +54 -0
- honeybee_radiance/modifier/material/ashik2.py +51 -0
- honeybee_radiance/modifier/material/brtdfunc.py +81 -0
- honeybee_radiance/modifier/material/bsdf.py +292 -0
- honeybee_radiance/modifier/material/dielectric.py +53 -0
- honeybee_radiance/modifier/material/glass.py +431 -0
- honeybee_radiance/modifier/material/glow.py +246 -0
- honeybee_radiance/modifier/material/illum.py +51 -0
- honeybee_radiance/modifier/material/interface.py +49 -0
- honeybee_radiance/modifier/material/light.py +206 -0
- honeybee_radiance/modifier/material/materialbase.py +36 -0
- honeybee_radiance/modifier/material/metal.py +167 -0
- honeybee_radiance/modifier/material/metal2.py +41 -0
- honeybee_radiance/modifier/material/metdata.py +41 -0
- honeybee_radiance/modifier/material/metfunc.py +41 -0
- honeybee_radiance/modifier/material/mirror.py +340 -0
- honeybee_radiance/modifier/material/mist.py +86 -0
- honeybee_radiance/modifier/material/plasdata.py +58 -0
- honeybee_radiance/modifier/material/plasfunc.py +59 -0
- honeybee_radiance/modifier/material/plastic.py +354 -0
- honeybee_radiance/modifier/material/plastic2.py +58 -0
- honeybee_radiance/modifier/material/prism1.py +57 -0
- honeybee_radiance/modifier/material/prism2.py +48 -0
- honeybee_radiance/modifier/material/spotlight.py +50 -0
- honeybee_radiance/modifier/material/trans.py +518 -0
- honeybee_radiance/modifier/material/trans2.py +49 -0
- honeybee_radiance/modifier/material/transdata.py +50 -0
- honeybee_radiance/modifier/material/transfunc.py +53 -0
- honeybee_radiance/modifier/mixture/__init__.py +6 -0
- honeybee_radiance/modifier/mixture/mixdata.py +49 -0
- honeybee_radiance/modifier/mixture/mixfunc.py +54 -0
- honeybee_radiance/modifier/mixture/mixpict.py +52 -0
- honeybee_radiance/modifier/mixture/mixtext.py +66 -0
- honeybee_radiance/modifier/mixture/mixturebase.py +28 -0
- honeybee_radiance/modifier/modifierbase.py +40 -0
- honeybee_radiance/modifier/pattern/__init__.py +9 -0
- honeybee_radiance/modifier/pattern/brightdata.py +49 -0
- honeybee_radiance/modifier/pattern/brightfunc.py +47 -0
- honeybee_radiance/modifier/pattern/brighttext.py +81 -0
- honeybee_radiance/modifier/pattern/colordata.py +56 -0
- honeybee_radiance/modifier/pattern/colorfunc.py +47 -0
- honeybee_radiance/modifier/pattern/colorpict.py +54 -0
- honeybee_radiance/modifier/pattern/colortext.py +73 -0
- honeybee_radiance/modifier/pattern/patternbase.py +34 -0
- honeybee_radiance/modifier/texture/__init__.py +4 -0
- honeybee_radiance/modifier/texture/texdata.py +29 -0
- honeybee_radiance/modifier/texture/texfunc.py +26 -0
- honeybee_radiance/modifier/texture/texturebase.py +27 -0
- honeybee_radiance/modifierset.py +1091 -0
- honeybee_radiance/mutil.py +60 -0
- honeybee_radiance/postprocess/__init__.py +1 -0
- honeybee_radiance/postprocess/annual.py +108 -0
- honeybee_radiance/postprocess/annualdaylight.py +425 -0
- honeybee_radiance/postprocess/annualglare.py +201 -0
- honeybee_radiance/postprocess/annualirradiance.py +187 -0
- honeybee_radiance/postprocess/electriclight.py +119 -0
- honeybee_radiance/postprocess/en17037.py +261 -0
- honeybee_radiance/postprocess/leed.py +304 -0
- honeybee_radiance/postprocess/solartracking.py +90 -0
- honeybee_radiance/primitive.py +554 -0
- honeybee_radiance/properties/__init__.py +1 -0
- honeybee_radiance/properties/_base.py +390 -0
- honeybee_radiance/properties/aperture.py +197 -0
- honeybee_radiance/properties/door.py +198 -0
- honeybee_radiance/properties/face.py +123 -0
- honeybee_radiance/properties/model.py +1291 -0
- honeybee_radiance/properties/room.py +490 -0
- honeybee_radiance/properties/shade.py +186 -0
- honeybee_radiance/properties/shademesh.py +116 -0
- honeybee_radiance/putil.py +44 -0
- honeybee_radiance/reader.py +214 -0
- honeybee_radiance/sensor.py +166 -0
- honeybee_radiance/sensorgrid.py +1008 -0
- honeybee_radiance/view.py +1101 -0
- honeybee_radiance/writer.py +951 -0
- honeybee_radiance-1.66.190.dist-info/METADATA +89 -0
- honeybee_radiance-1.66.190.dist-info/RECORD +152 -0
- honeybee_radiance-1.66.190.dist-info/WHEEL +5 -0
- honeybee_radiance-1.66.190.dist-info/entry_points.txt +2 -0
- honeybee_radiance-1.66.190.dist-info/licenses/LICENSE +661 -0
- honeybee_radiance-1.66.190.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
"""Radiance Plastic Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Plastic
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import division
|
|
6
|
+
|
|
7
|
+
from .materialbase import Material
|
|
8
|
+
import honeybee.typing as typing
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Plastic(Material):
|
|
12
|
+
"""Radiance plastic material.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
16
|
+
or special characters. This will be used to identify the object across
|
|
17
|
+
a model and in the exported Radiance files.
|
|
18
|
+
r_reflectance: Reflectance for red. The value should be between 0 and 1
|
|
19
|
+
(Default: 0).
|
|
20
|
+
g_reflectance: Reflectance for green. The value should be between 0 and 1
|
|
21
|
+
(Default: 0).
|
|
22
|
+
b_reflectance: Reflectance for blue. The value should be between 0 and 1
|
|
23
|
+
(Default: 0).
|
|
24
|
+
specularity: Fraction of specularity. Specularity fractions greater than 0.1
|
|
25
|
+
are not common in non-metallic materials. (Default: 0).
|
|
26
|
+
roughness: Roughness is specified as the rms slope of surface facets. A
|
|
27
|
+
value of 0 corresponds to a perfectly smooth surface, and a value of 1
|
|
28
|
+
would be a very rough surface. Roughness values greater than 0.2 are not
|
|
29
|
+
very realistic. (Default: 0).
|
|
30
|
+
modifier: Material modifier (Default: None).
|
|
31
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
32
|
+
argument is only useful for defining advanced primitives where the
|
|
33
|
+
primitive is defined based on other primitives. (Default: None).
|
|
34
|
+
|
|
35
|
+
Properties:
|
|
36
|
+
* identifier
|
|
37
|
+
* display_name
|
|
38
|
+
* r_reflectance
|
|
39
|
+
* g_reflectance
|
|
40
|
+
* b_reflectance
|
|
41
|
+
* specularity
|
|
42
|
+
* roughness
|
|
43
|
+
* average_reflectance
|
|
44
|
+
* values
|
|
45
|
+
* modifier
|
|
46
|
+
* dependencies
|
|
47
|
+
* is_modifier
|
|
48
|
+
* is_material
|
|
49
|
+
|
|
50
|
+
Usage:
|
|
51
|
+
|
|
52
|
+
.. code-block:: python
|
|
53
|
+
|
|
54
|
+
wall_material = Plastic("generic_wall", .55, .65, .75)
|
|
55
|
+
print(wall_material)
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
__slots__ = ('_r_reflectance', '_g_reflectance', '_b_reflectance',
|
|
59
|
+
'_specularity', '_roughness')
|
|
60
|
+
|
|
61
|
+
def __init__(self, identifier, r_reflectance=0.0, g_reflectance=0.0, b_reflectance=0.0,
|
|
62
|
+
specularity=0.0, roughness=0.0, modifier=None, dependencies=None):
|
|
63
|
+
"""Create plastic material."""
|
|
64
|
+
Material.__init__(self, identifier, modifier=modifier, dependencies=dependencies)
|
|
65
|
+
self.r_reflectance = r_reflectance
|
|
66
|
+
self.g_reflectance = g_reflectance
|
|
67
|
+
self.b_reflectance = b_reflectance
|
|
68
|
+
self.specularity = specularity
|
|
69
|
+
self.roughness = roughness
|
|
70
|
+
|
|
71
|
+
self._update_values()
|
|
72
|
+
|
|
73
|
+
def _update_values(self):
|
|
74
|
+
"update value dictionaries."
|
|
75
|
+
self._values[2] = [
|
|
76
|
+
self.r_reflectance, self.g_reflectance, self.b_reflectance,
|
|
77
|
+
self.specularity, self.roughness
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
if self.specularity > 0.1:
|
|
81
|
+
print("Warning: Specularity values above .1 is uncommon for plastic.")
|
|
82
|
+
if self.roughness > 0.2:
|
|
83
|
+
print("Warning: Roughness values above .2 is uncommon.")
|
|
84
|
+
|
|
85
|
+
@property
|
|
86
|
+
def r_reflectance(self):
|
|
87
|
+
"""Get or set the reflectance for red channel.
|
|
88
|
+
|
|
89
|
+
The value should be between 0 and 1 (Default: 0).
|
|
90
|
+
"""
|
|
91
|
+
return self._r_reflectance
|
|
92
|
+
|
|
93
|
+
@r_reflectance.setter
|
|
94
|
+
def r_reflectance(self, reflectance):
|
|
95
|
+
self._r_reflectance = \
|
|
96
|
+
typing.float_in_range(reflectance, 0, 1, 'red reflectance')
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def g_reflectance(self):
|
|
100
|
+
"""Get or set the reflectance for green channel.
|
|
101
|
+
|
|
102
|
+
The value should be between 0 and 1 (Default: 0).
|
|
103
|
+
"""
|
|
104
|
+
return self._g_reflectance
|
|
105
|
+
|
|
106
|
+
@g_reflectance.setter
|
|
107
|
+
def g_reflectance(self, reflectance):
|
|
108
|
+
self._g_reflectance = \
|
|
109
|
+
typing.float_in_range(reflectance, 0, 1, 'green reflectance')
|
|
110
|
+
|
|
111
|
+
@property
|
|
112
|
+
def b_reflectance(self):
|
|
113
|
+
"""Get or set the reflectance for blue channel.
|
|
114
|
+
|
|
115
|
+
The value should be between 0 and 1 (Default: 0).
|
|
116
|
+
"""
|
|
117
|
+
return self._b_reflectance
|
|
118
|
+
|
|
119
|
+
@b_reflectance.setter
|
|
120
|
+
def b_reflectance(self, reflectance):
|
|
121
|
+
self._b_reflectance = \
|
|
122
|
+
typing.float_in_range(reflectance, 0, 1, 'blue reflectance')
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def specularity(self):
|
|
126
|
+
"""Get or set the fraction of specularity.
|
|
127
|
+
|
|
128
|
+
Specularity fractions greater than 0.1 are not common for non-metallic
|
|
129
|
+
materials. Specularity fractions smaller than 0.9 are not common for
|
|
130
|
+
metallic materials.
|
|
131
|
+
"""
|
|
132
|
+
return self._specularity
|
|
133
|
+
|
|
134
|
+
@specularity.setter
|
|
135
|
+
def specularity(self, spec_value):
|
|
136
|
+
self._specularity = typing.float_in_range(spec_value, 0, 1, 'specularity')
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def roughness(self):
|
|
140
|
+
"""Get or set the roughness as the rms slope of surface facets.
|
|
141
|
+
|
|
142
|
+
A value of 0 corresponds to a perfectly smooth surface, and a value of 1
|
|
143
|
+
would be a very rough surface. Roughness values greater than 0.2 are not
|
|
144
|
+
very realistic. (Default: 0).
|
|
145
|
+
"""
|
|
146
|
+
return self._roughness
|
|
147
|
+
|
|
148
|
+
@roughness.setter
|
|
149
|
+
def roughness(self, roughness_values):
|
|
150
|
+
self._roughness = typing.float_in_range(roughness_values, 0, 1, 'roughness')
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def average_reflectance(self):
|
|
154
|
+
"""Get the average reflectance of the material."""
|
|
155
|
+
return (0.265 * self.r_reflectance + 0.670 * self.g_reflectance +
|
|
156
|
+
0.065 * self.b_reflectance) * (1 - self.specularity) + self.specularity
|
|
157
|
+
|
|
158
|
+
@classmethod
|
|
159
|
+
def from_single_reflectance(
|
|
160
|
+
cls, identifier, rgb_reflectance=0.0, specularity=0.0, roughness=0.0,
|
|
161
|
+
modifier=None, dependencies=None):
|
|
162
|
+
"""Create Plastic material with single reflectance value.
|
|
163
|
+
|
|
164
|
+
Args:
|
|
165
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
166
|
+
or special characters. This will be used to identify the object across
|
|
167
|
+
a model and in the exported Radiance files.
|
|
168
|
+
rgb_reflectance: Reflectance for red, green and blue. The value should be
|
|
169
|
+
between 0 and 1 (Default: 0).
|
|
170
|
+
specularity: Fraction of specularity. Specularity fractions greater than 0.1
|
|
171
|
+
are not common in non-metallic materials (Default: 0).
|
|
172
|
+
roughness: Roughness is specified as the rms slope of surface facets. A value
|
|
173
|
+
of 0 corresponds to a perfectly smooth surface, and a value of 1 would be
|
|
174
|
+
a very rough surface. Roughness values greater than 0.2 are not very
|
|
175
|
+
realistic. (Default: 0).
|
|
176
|
+
modifier: Material modifier (Default: None).
|
|
177
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
178
|
+
argument is only useful for defining advanced primitives where the
|
|
179
|
+
primitive is defined based on other primitives. (Default: None).
|
|
180
|
+
|
|
181
|
+
Usage:
|
|
182
|
+
|
|
183
|
+
.. code-block:: python
|
|
184
|
+
|
|
185
|
+
wall_material = Plastic.from_single_reflectance("generic_wall", .55)
|
|
186
|
+
print(wall_material)
|
|
187
|
+
"""
|
|
188
|
+
return cls(identifier, r_reflectance=rgb_reflectance,
|
|
189
|
+
g_reflectance=rgb_reflectance, b_reflectance=rgb_reflectance,
|
|
190
|
+
specularity=specularity, roughness=roughness,
|
|
191
|
+
modifier=modifier, dependencies=dependencies)
|
|
192
|
+
|
|
193
|
+
@classmethod
|
|
194
|
+
def from_reflected_specularity(
|
|
195
|
+
cls, identifier, r_reflectance=0.0, g_reflectance=0.0, b_reflectance=0.0,
|
|
196
|
+
reflected_specularity=0.0, roughness=0.0, modifier=None, dependencies=None):
|
|
197
|
+
"""Create plastic material from reflected specularity.
|
|
198
|
+
|
|
199
|
+
This method assumes that all of the input fractions for reflectance are
|
|
200
|
+
absolute fractions of the total amount of light hitting the modifier.
|
|
201
|
+
This is different than how Radiance natively interprets the properties.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
205
|
+
or special characters. This will be used to identify the object across
|
|
206
|
+
a model and in the exported Radiance files.
|
|
207
|
+
r_reflectance: Reflectance for red. The value should be between 0 and 1
|
|
208
|
+
(Default: 0).
|
|
209
|
+
g_reflectance: Reflectance for green. The value should be between 0 and 1
|
|
210
|
+
(Default: 0).
|
|
211
|
+
b_reflectance: Reflectance for blue. The value should be between 0 and 1
|
|
212
|
+
(Default: 0).
|
|
213
|
+
reflected_specularity: Fraction of reflected specular. Specularity
|
|
214
|
+
fractions greater than 0.1 are not common in non-metallic
|
|
215
|
+
materials. (Default: 0).
|
|
216
|
+
roughness: Roughness is specified as the rms slope of surface facets. A
|
|
217
|
+
value of 0 corresponds to a perfectly smooth surface, and a value of 1
|
|
218
|
+
would be a very rough surface. Roughness values greater than 0.2 are not
|
|
219
|
+
very realistic. (Default: 0).
|
|
220
|
+
modifier: Material modifier (Default: None).
|
|
221
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
222
|
+
argument is only useful for defining advanced primitives where the
|
|
223
|
+
primitive is defined based on other primitives. (Default: [])
|
|
224
|
+
"""
|
|
225
|
+
cr, cg, cb, rs = \
|
|
226
|
+
r_reflectance, g_reflectance, b_reflectance, reflected_specularity
|
|
227
|
+
|
|
228
|
+
rd = (0.265 * cr + 0.670 * cg + 0.065 * cb)
|
|
229
|
+
|
|
230
|
+
absorb = 1 - rd - rs
|
|
231
|
+
if absorb < 0:
|
|
232
|
+
summ = rd + rs
|
|
233
|
+
msg = 'Sum of Diffuse Reflection (%.3f) and Specular Reflection (%.3f) ' \
|
|
234
|
+
'cannot be more than 1 (%.3f).' % (rd, rs, summ)
|
|
235
|
+
raise ValueError(msg)
|
|
236
|
+
|
|
237
|
+
a1 = cr / ((1 - rs))
|
|
238
|
+
a2 = cg / ((1 - rs))
|
|
239
|
+
a3 = cb / ((1 - rs))
|
|
240
|
+
if a3 > 1 or a2 > 1 or a1 > 1:
|
|
241
|
+
if a1 > 1:
|
|
242
|
+
channel, val = 'Red', a1
|
|
243
|
+
elif a2 > 1:
|
|
244
|
+
channel, val = 'Green', a2
|
|
245
|
+
else:
|
|
246
|
+
channel, val = 'Blue', a3
|
|
247
|
+
raise ValueError(
|
|
248
|
+
'This material has a physically impossible reflectance value for '
|
|
249
|
+
'the {} channel\nwhen specular and diffuse fractions are added '
|
|
250
|
+
'({}).'.format(channel, val))
|
|
251
|
+
|
|
252
|
+
return cls(identifier, a1, a2, a3, rs, roughness,
|
|
253
|
+
modifier=modifier, dependencies=dependencies)
|
|
254
|
+
|
|
255
|
+
@classmethod
|
|
256
|
+
def from_primitive_dict(cls, primitive_dict):
|
|
257
|
+
"""Initialize material from a primitive dict.
|
|
258
|
+
|
|
259
|
+
Args:
|
|
260
|
+
data: A dictionary in the format below.
|
|
261
|
+
|
|
262
|
+
.. code-block:: python
|
|
263
|
+
|
|
264
|
+
{
|
|
265
|
+
"modifier": {}, # primitive modifier (Default: None)
|
|
266
|
+
"type": "", # primitive type
|
|
267
|
+
"identifier": "", # primitive identifier
|
|
268
|
+
"display_name": "", # primitive display name
|
|
269
|
+
"values": [], # values
|
|
270
|
+
"dependencies": []
|
|
271
|
+
}
|
|
272
|
+
"""
|
|
273
|
+
cls._dict_type_check(cls.__name__, primitive_dict)
|
|
274
|
+
modifier, dependencies = cls.filter_dict_input(primitive_dict)
|
|
275
|
+
values = primitive_dict['values'][2]
|
|
276
|
+
cls_ = cls(
|
|
277
|
+
identifier=primitive_dict["identifier"],
|
|
278
|
+
r_reflectance=values[0],
|
|
279
|
+
g_reflectance=values[1],
|
|
280
|
+
b_reflectance=values[2],
|
|
281
|
+
specularity=values[3],
|
|
282
|
+
roughness=values[4],
|
|
283
|
+
modifier=modifier,
|
|
284
|
+
dependencies=dependencies
|
|
285
|
+
)
|
|
286
|
+
if 'display_name' in primitive_dict \
|
|
287
|
+
and primitive_dict['display_name'] is not None:
|
|
288
|
+
cls_.display_name = primitive_dict['display_name']
|
|
289
|
+
|
|
290
|
+
# this might look redundant but it is NOT. see glass for explanation.
|
|
291
|
+
cls_.values = primitive_dict['values']
|
|
292
|
+
return cls_
|
|
293
|
+
|
|
294
|
+
@classmethod
|
|
295
|
+
def from_dict(cls, data):
|
|
296
|
+
"""Initialize material from a dictionary.
|
|
297
|
+
|
|
298
|
+
Args:
|
|
299
|
+
data: A dictionary in the format below.
|
|
300
|
+
|
|
301
|
+
.. code-block:: python
|
|
302
|
+
|
|
303
|
+
{
|
|
304
|
+
"type": "", # Material type
|
|
305
|
+
"identifier": "", # Material identifier
|
|
306
|
+
"display_name": "", # Material display name
|
|
307
|
+
"r_reflectance": float, # Reflectance for red
|
|
308
|
+
"g_reflectance": float, # Reflectance for green
|
|
309
|
+
"b_reflectance": float, # Reflectance for blue
|
|
310
|
+
"specularity": float, # Material specularity
|
|
311
|
+
"roughness": float, # Material roughness
|
|
312
|
+
"modifier": {}, # Material modifier (Default: None)
|
|
313
|
+
"dependencies": []
|
|
314
|
+
}
|
|
315
|
+
"""
|
|
316
|
+
cls._dict_type_check(cls.__name__, data)
|
|
317
|
+
modifier, dependencies = cls.filter_dict_input(data)
|
|
318
|
+
|
|
319
|
+
new_obj = cls(identifier=data["identifier"],
|
|
320
|
+
r_reflectance=data["r_reflectance"],
|
|
321
|
+
g_reflectance=data["g_reflectance"],
|
|
322
|
+
b_reflectance=data["b_reflectance"],
|
|
323
|
+
specularity=data["specularity"],
|
|
324
|
+
roughness=data["roughness"],
|
|
325
|
+
modifier=modifier,
|
|
326
|
+
dependencies=dependencies)
|
|
327
|
+
if 'display_name' in data and data['display_name'] is not None:
|
|
328
|
+
new_obj.display_name = data['display_name']
|
|
329
|
+
return new_obj
|
|
330
|
+
|
|
331
|
+
def to_dict(self):
|
|
332
|
+
"""Translate this object to a dictionary."""
|
|
333
|
+
base = {
|
|
334
|
+
'modifier': self.modifier.to_dict(),
|
|
335
|
+
'type': self.__class__.__name__,
|
|
336
|
+
'identifier': self.identifier,
|
|
337
|
+
'r_reflectance': self.r_reflectance,
|
|
338
|
+
'g_reflectance': self.g_reflectance,
|
|
339
|
+
'b_reflectance': self.b_reflectance,
|
|
340
|
+
'specularity': self.specularity,
|
|
341
|
+
'roughness': self.roughness,
|
|
342
|
+
'dependencies': [dp.to_dict() for dp in self.dependencies]
|
|
343
|
+
}
|
|
344
|
+
if self._display_name is not None:
|
|
345
|
+
base['display_name'] = self.display_name
|
|
346
|
+
return base
|
|
347
|
+
|
|
348
|
+
def __copy__(self):
|
|
349
|
+
mod, depend = self._dup_mod_and_depend()
|
|
350
|
+
new_obj = self.__class__(
|
|
351
|
+
self.identifier, self.r_reflectance, self.g_reflectance, self.b_reflectance,
|
|
352
|
+
self.specularity, self.roughness, mod, depend)
|
|
353
|
+
new_obj._display_name = self._display_name
|
|
354
|
+
return new_obj
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Radiance Plastic2 Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Plastic2
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Plastic2(Material):
|
|
10
|
+
"""Radiance Plastic2 Material.
|
|
11
|
+
|
|
12
|
+
Plastic2 is similar to plastic, but with anisotropic roughness. This means that
|
|
13
|
+
highlights in the surface will appear elliptical rather than round. The orientation
|
|
14
|
+
of the anisotropy is determined by the unnormalized direction vector ux uy uz. These
|
|
15
|
+
three expressions (separated by white space) are evaluated in the context of the
|
|
16
|
+
function file funcfile. If no function file is required (i.e., no special variables
|
|
17
|
+
or functions are required), a period (\'.\') may be given in its place. (See the
|
|
18
|
+
discussion of Function Files in the Auxiliary Files section). The urough value
|
|
19
|
+
defines the roughness along the u vector given projected onto the surface. The vrough
|
|
20
|
+
value defines the roughness perpendicular to this vector. Note that the highlight
|
|
21
|
+
will be narrower in the direction of the smaller roughness value. Roughness values of
|
|
22
|
+
zero are not allowed for efficiency reasons since the behavior would be the same as
|
|
23
|
+
regular plastic in that case.
|
|
24
|
+
|
|
25
|
+
.. code-block:: shell
|
|
26
|
+
|
|
27
|
+
mod plastic2 id
|
|
28
|
+
4+ ux uy uz funcfile transform
|
|
29
|
+
0
|
|
30
|
+
6 red green blue spec urough vrough
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
34
|
+
or special characters. This will be used to identify the object across
|
|
35
|
+
a model and in the exported Radiance files.
|
|
36
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
37
|
+
(Default: None).
|
|
38
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
39
|
+
refer to a line number in the radiance primitive definitions and the
|
|
40
|
+
values in each array correspond to values occurring within each line.
|
|
41
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
42
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
43
|
+
argument is only useful for defining advanced primitives that are
|
|
44
|
+
defined based on other primitives. (Default: []).
|
|
45
|
+
|
|
46
|
+
Properties:
|
|
47
|
+
* identifier
|
|
48
|
+
* display_name
|
|
49
|
+
* values
|
|
50
|
+
* modifier
|
|
51
|
+
* dependencies
|
|
52
|
+
* is_modifier
|
|
53
|
+
* is_material
|
|
54
|
+
* is_opaque
|
|
55
|
+
"""
|
|
56
|
+
__slots__ = ()
|
|
57
|
+
|
|
58
|
+
pass
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Radiance Prism1 Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Prism1
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Prism1(Material):
|
|
10
|
+
"""Radiance Prism1 Material.
|
|
11
|
+
|
|
12
|
+
The prism1 material is for general light redirection from prismatic glazings,
|
|
13
|
+
generating virtual light sources. It can only be used to modify a planar surface
|
|
14
|
+
(i.e., a polygon or disk) and should not result in either light concentration or
|
|
15
|
+
scattering. The new direction of the ray can be on either side of the material, and
|
|
16
|
+
the definitions must have the correct bidirectional properties to work properly with
|
|
17
|
+
virtual light sources. The arguments give the coefficient for the redirected light
|
|
18
|
+
and its direction.
|
|
19
|
+
|
|
20
|
+
.. code-block:: shell
|
|
21
|
+
|
|
22
|
+
mod prism1 id
|
|
23
|
+
5+ coef dx dy dz funcfile transform
|
|
24
|
+
0
|
|
25
|
+
n A1 A2 .. An
|
|
26
|
+
|
|
27
|
+
The new direction variables dx, dy and dz need not produce a normalized vector. For
|
|
28
|
+
convenience, the variables DxA, DyA and DzA are defined as the normalized direction
|
|
29
|
+
to the target light source.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
33
|
+
or special characters. This will be used to identify the object across
|
|
34
|
+
a model and in the exported Radiance files.
|
|
35
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
36
|
+
(Default: None).
|
|
37
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
38
|
+
refer to a line number in the radiance primitive definitions and the
|
|
39
|
+
values in each array correspond to values occurring within each line.
|
|
40
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
41
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
42
|
+
argument is only useful for defining advanced primitives that are
|
|
43
|
+
defined based on other primitives. (Default: []).
|
|
44
|
+
|
|
45
|
+
Properties:
|
|
46
|
+
* identifier
|
|
47
|
+
* display_name
|
|
48
|
+
* values
|
|
49
|
+
* modifier
|
|
50
|
+
* dependencies
|
|
51
|
+
* is_modifier
|
|
52
|
+
* is_material
|
|
53
|
+
* is_opaque
|
|
54
|
+
"""
|
|
55
|
+
__slots__ = ()
|
|
56
|
+
|
|
57
|
+
pass
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Radiance Prism2 Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Prism2
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Prism2(Material):
|
|
10
|
+
"""Radiance Prism2 Material.
|
|
11
|
+
|
|
12
|
+
The material prism2 is identical to prism1 except that it provides for two ray
|
|
13
|
+
redirections rather than one.
|
|
14
|
+
|
|
15
|
+
.. code-block:: shell
|
|
16
|
+
|
|
17
|
+
mod prism2 id
|
|
18
|
+
9+ coef1 dx1 dy1 dz1 coef2 dx2 dy2 dz2 funcfile transform
|
|
19
|
+
0
|
|
20
|
+
n A1 A2 .. An
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
24
|
+
or special characters. This will be used to identify the object across
|
|
25
|
+
a model and in the exported Radiance files.
|
|
26
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
27
|
+
(Default: None).
|
|
28
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
29
|
+
refer to a line number in the radiance primitive definitions and the
|
|
30
|
+
values in each array correspond to values occurring within each line.
|
|
31
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
32
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
33
|
+
argument is only useful for defining advanced primitives that are
|
|
34
|
+
defined based on other primitives. (Default: []).
|
|
35
|
+
|
|
36
|
+
Properties:
|
|
37
|
+
* identifier
|
|
38
|
+
* display_name
|
|
39
|
+
* values
|
|
40
|
+
* modifier
|
|
41
|
+
* dependencies
|
|
42
|
+
* is_modifier
|
|
43
|
+
* is_material
|
|
44
|
+
* is_opaque
|
|
45
|
+
"""
|
|
46
|
+
__slots__ = ()
|
|
47
|
+
|
|
48
|
+
pass
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Radiance Spotlight Material.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Spotlight
|
|
4
|
+
"""
|
|
5
|
+
from .materialbase import Material
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# TODO: Implement the class. It's currently only a generic Radiance Primitive
|
|
9
|
+
class Spotlight(Material):
|
|
10
|
+
"""Radiance Spotlight Material.
|
|
11
|
+
|
|
12
|
+
Spotlight is used for self-luminous surfaces having directed output. As well as
|
|
13
|
+
radiance, the full cone angle (in degrees) and orientation (output direction) vector
|
|
14
|
+
are given. The length of the orientation vector is the distance of the effective
|
|
15
|
+
focus behind the source center (i.e., the focal length).
|
|
16
|
+
|
|
17
|
+
.. code-block:: shell
|
|
18
|
+
|
|
19
|
+
mod spotlight id
|
|
20
|
+
0
|
|
21
|
+
0
|
|
22
|
+
7 red green blue angle xdir ydir zdir
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
identifier: Text string for a unique Material ID. Must not contain spaces
|
|
26
|
+
or special characters. This will be used to identify the object across
|
|
27
|
+
a model and in the exported Radiance files.
|
|
28
|
+
modifier: Modifier. It can be primitive, mixture, texture or pattern.
|
|
29
|
+
(Default: None).
|
|
30
|
+
values: An array 3 arrays for primitive data. Each of the 3 sub-arrays
|
|
31
|
+
refer to a line number in the radiance primitive definitions and the
|
|
32
|
+
values in each array correspond to values occurring within each line.
|
|
33
|
+
is_opaque: A boolean to indicate whether this primitive is opaque.
|
|
34
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
35
|
+
argument is only useful for defining advanced primitives that are
|
|
36
|
+
defined based on other primitives. (Default: []).
|
|
37
|
+
|
|
38
|
+
Properties:
|
|
39
|
+
* identifier
|
|
40
|
+
* display_name
|
|
41
|
+
* values
|
|
42
|
+
* modifier
|
|
43
|
+
* dependencies
|
|
44
|
+
* is_modifier
|
|
45
|
+
* is_material
|
|
46
|
+
* is_opaque
|
|
47
|
+
"""
|
|
48
|
+
__slots__ = ()
|
|
49
|
+
|
|
50
|
+
pass
|