1 # SPDX-FileCopyrightText: 2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 """Declare shading properties exported to POV textures."""
7 from bpy
.utils
import register_class
, unregister_class
8 from bpy
.types
import PropertyGroup
9 from bpy
.props
import (
20 class MaterialRaytraceTransparency(PropertyGroup
):
21 """Declare transparency panel properties controllable in UI and translated to POV."""
25 description
="Maximum allowed number of light inter-refractions",
31 depth_max
: FloatProperty(
33 description
="Maximum depth for light to travel through the "
34 "transparent material before becoming fully filtered (0.0 is disabled)",
40 falloff
: FloatProperty(
42 description
="Falloff power for transmissivity filter effect (1.0 is linear)",
49 filter: FloatProperty(
51 description
="Amount to blend in the material’s diffuse color in raytraced "
52 "transparency (simulating absorption)",
59 fresnel
: FloatProperty(
61 description
="Power of Fresnel for transparency (Ray or ZTransp)",
70 fresnel_factor
: FloatProperty(
72 description
="Blending factor for Fresnel",
81 gloss_factor
: FloatProperty(
83 description
="The clarity of the refraction. "
84 "(values < 1.0 give diffuse, blurry refractions)",
93 gloss_samples
: IntProperty(
95 description
="frequency of the noise sample used for blurry refractions",
101 gloss_threshold
: FloatProperty(
103 description
="Threshold for adaptive sampling (if a sample "
104 "contributes less than this amount [as a percentage], "
105 "sampling is stopped)",
116 description
="Sets angular index of refraction for raytraced refraction",
125 class MaterialRaytraceMirror(PropertyGroup
):
126 """Declare reflection panel properties controllable in UI and translated to POV."""
128 bl_description
= ("Raytraced reflection settings for the Material",)
130 use
: BoolProperty(name
="Mirror", description
="Enable raytraced reflections", default
=False)
134 description
="Maximum allowed number of light inter-reflections",
140 distance
: FloatProperty(
142 description
="Maximum distance of reflected rays "
143 "(reflections further than this range "
144 "fade to sky color or material color)",
153 fade_to
: EnumProperty(
155 ("FADE_TO_SKY", "Fade to sky", ""),
156 ("FADE_TO_MATERIAL", "Fade to material color", ""),
158 name
="Fade-out Color",
159 description
="The color that rays with no intersection within the "
160 "Max Distance take (material color can be best for "
161 "indoor scenes, sky color for outdoor)",
162 default
="FADE_TO_SKY",
165 fresnel
: FloatProperty(
167 description
="Power of Fresnel for mirror reflection",
176 fresnel_factor
: FloatProperty(
178 description
="Blending factor for Fresnel",
187 gloss_anisotropic
: FloatProperty(
189 description
="The shape of the reflection, from 0.0 (circular) "
190 "to 1.0 (fully stretched along the tangent",
199 gloss_factor
: FloatProperty(
201 description
="The shininess of the reflection "
202 "(values < 1.0 give diffuse, blurry reflections)",
211 gloss_samples
: IntProperty(
213 description
="Frequency of the noise pattern bumps averaged for blurry reflections",
219 gloss_threshold
: FloatProperty(
221 description
="Threshold for adaptive sampling (if a sample "
222 "contributes less than this amount [as a percentage], "
223 "sampling is stopped)",
232 mirror_color
: FloatVectorProperty(
234 description
="Mirror color of the material",
237 default
=(1.0, 1.0, 1.0),
238 options
={"ANIMATABLE"},
242 reflect_factor
: FloatProperty(
244 description
="Amount of mirror reflection for raytrace",
254 class MaterialSubsurfaceScattering(PropertyGroup
):
255 """Declare SSS/SSTL properties controllable in UI and translated to POV."""
257 bl_description
= ("Subsurface scattering settings for the material",)
260 name
="Subsurface Scattering",
261 description
="Enable diffuse subsurface scatting " "effects in a material",
267 description
="Back scattering weight",
276 color
: FloatVectorProperty(
277 name
="Scattering color",
278 description
="Scattering color",
281 default
=(0.604, 0.604, 0.604),
282 options
={"ANIMATABLE"},
286 color_factor
: FloatProperty(
288 description
="Blend factor for SSS colors",
297 error_threshold
: FloatProperty(
299 description
="Error tolerance (low values are slower and higher quality)",
304 front
: FloatProperty(
306 description
="Front scattering weight",
317 description
="Index of refraction (higher values are denser)",
325 radius
: FloatVectorProperty(
327 description
="Mean red/green/blue scattering path length",
331 default
=(1.0, 1.0, 1.0),
332 options
={"ANIMATABLE"},
335 scale
: FloatProperty(
336 name
="Scale", description
="Object scale factor", default
=0.100, precision
=3
339 texture_factor
: FloatProperty(
341 description
="Texture scattering blend factor",
351 MaterialRaytraceTransparency
,
352 MaterialRaytraceMirror
,
353 MaterialSubsurfaceScattering
,
360 bpy
.types
.Material
.pov_raytrace_transparency
= PointerProperty(
361 type=MaterialRaytraceTransparency
363 bpy
.types
.Material
.pov_subsurface_scattering
= PointerProperty(
364 type=MaterialSubsurfaceScattering
366 bpy
.types
.Material
.pov_raytrace_mirror
= PointerProperty(type=MaterialRaytraceMirror
)
370 del bpy
.types
.Material
.pov_subsurface_scattering
371 del bpy
.types
.Material
.pov_raytrace_mirror
372 del bpy
.types
.Material
.pov_raytrace_transparency
374 for cls
in reversed(classes
):
375 unregister_class(cls
)