1 # SPDX-FileCopyrightText: 2021-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 """Declare stage set and surrounding (camera, lights, environment) properties controllable in UI"""
7 from bpy
.utils
import register_class
, unregister_class
8 from bpy
.types
import PropertyGroup
9 from bpy
.props
import (
19 from .shading_properties
import (
23 # ---------------------------------------------------------------- #
24 # Camera POV properties.
25 # ---------------------------------------------------------------- #
28 class RenderPovSettingsCamera(PropertyGroup
):
30 """Declare camera properties controllable in UI and translated to POV."""
33 dof_enable
: BoolProperty(
34 name
="Depth Of Field", description
="Enable POV Depth Of Field ", default
=False
37 # Aperture (Intensity of the Blur)
38 dof_aperture
: FloatProperty(
40 description
="Similar to a real camera's aperture effect over focal blur (though not "
41 "in physical units and independent of focal length). "
42 "Increase to get more blur",
48 # Aperture adaptive sampling
49 dof_samples_min
: IntProperty(
51 description
="Minimum number of rays to use for each pixel",
57 dof_samples_max
: IntProperty(
59 description
="Maximum number of rays to use for each pixel",
65 dof_variance
: IntProperty(
67 description
="Minimum threshold (fractional value) for adaptive DOF sampling (up "
68 "increases quality and render time). The value for the variance should "
69 "be in the range of the smallest displayable color difference",
76 dof_confidence
: FloatProperty(
78 description
="Probability to reach the real color value. Larger confidence values "
79 "will lead to more samples, slower traces and better images",
85 normal_enable
: BoolProperty(name
="Perturbated Camera", default
=False)
87 cam_normal
: FloatProperty(name
="Normal Strength", min=0.0, max=1.0, default
=0.001)
89 normal_patterns
: EnumProperty(
93 ("agate", "Agate", ""),
94 ("boxed", "Boxed", ""),
95 ("bumps", "Bumps", ""),
96 ("cells", "Cells", ""),
97 ("crackle", "Crackle", ""),
98 ("dents", "Dents", ""),
99 ("granite", "Granite", ""),
100 ("leopard", "Leopard", ""),
101 ("marble", "Marble", ""),
102 ("onion", "Onion", ""),
103 ("pavement", "Pavement", ""),
104 ("planar", "Planar", ""),
105 ("quilted", "Quilted", ""),
106 ("ripples", "Ripples", ""),
107 ("radial", "Radial", ""),
108 ("spherical", "Spherical", ""),
109 ("spiral1", "Spiral1", ""),
110 ("spiral2", "Spiral2", ""),
111 ("spotted", "Spotted", ""),
112 ("square", "Square", ""),
113 ("tiling", "Tiling", ""),
114 ("waves", "Waves", ""),
115 ("wood", "Wood", ""),
116 ("wrinkles", "Wrinkles", ""),
121 turbulence
: FloatProperty(name
="Turbulence", min=0.0, max=100.0, default
=0.1)
123 scale
: FloatProperty(name
="Scale", min=0.0, default
=1.0)
125 # ----------------------------------- CustomPOV Code ----------------------------------- #
126 # Only DUMMIES below for now:
127 replacement_text
: StringProperty(
128 name
="Texts in blend file",
129 description
="Type the declared name in custom POV code or an external .inc "
130 "it points at. camera {} expected",
135 # ---------------------------------------------------------------- #
136 # Light POV properties.
137 # ---------------------------------------------------------------- #
138 class RenderPovSettingsLight(PropertyGroup
):
140 """Declare light properties controllable in UI and translated to POV."""
142 # former Space properties from removed Blender Internal
143 use_limited_texture_context
: BoolProperty(
145 description
="Use the limited version of texture user (for ‘old shading’ mode)",
149 texture_context
: EnumProperty(
150 name
="Texture context",
151 description
="Type of texture data to display and edit",
153 ("MATERIAL", "", "Show material textures", "MATERIAL", 0), # "Show material textures"
154 ("WORLD", "", "Show world textures", "WORLD", 1), # "Show world textures"
155 ("LAMP", "", "Show lamp textures", "LIGHT", 2), # "Show lamp textures"
159 "Show particles textures",
162 ), # "Show particles textures"
166 "Show linestyle textures",
169 ), # "Show linestyle textures"
173 "Show other data textures",
176 ), # "Show other data textures"
181 shadow_method
: EnumProperty(
185 ("NOSHADOW", "No Shadow", "No Shadow"),
186 ("RAY_SHADOW", "Ray Shadow", "Ray Shadow, Use ray tracing for shadow"),
188 default
="RAY_SHADOW",
191 active_texture_index
: IntProperty(name
="Index for texture_slots", default
=0)
193 use_halo
: BoolProperty(
194 name
="Halo", description
="Render spotlight with a volumetric halo", default
=False
197 halo_intensity
: FloatProperty(
198 name
="Halo intensity",
199 description
="Brightness of the spotlight halo cone",
205 shadow_ray_samples_x
: IntProperty(
206 name
="Number of samples taken extra (samples x samples)", min=1, soft_max
=64, default
=1
209 shadow_ray_samples_y
: IntProperty(
210 name
="Number of samples taken extra (samples x samples)", min=1, soft_max
=64, default
=1
213 shadow_ray_sample_method
: EnumProperty(
215 description
="Method for generating shadow samples: Adaptive QMC is fastest,"
216 "Constant QMC is less noisy but slower",
218 ("ADAPTIVE_QMC", "", "Halton samples distribution", "", 0),
219 ("CONSTANT_QMC", "", "QMC samples distribution", "", 1),
223 "Uses POV jitter keyword",
226 ), # "Show other data textures"
228 default
="CONSTANT_JITTERED",
231 use_jitter
: BoolProperty(
233 description
="Use noise for sampling (Constant Jittered sampling)",
238 # ---------------------------------------------------------------- #
239 # World POV properties.
240 # ---------------------------------------------------------------- #
241 class RenderPovSettingsWorld(PropertyGroup
):
243 """Declare world properties controllable in UI and translated to POV."""
245 # former Space properties from removed Blender Internal
246 use_limited_texture_context
: BoolProperty(
248 description
="Use the limited version of texture user (for ‘old shading’ mode)",
252 texture_context
: EnumProperty(
253 name
="Texture context",
254 description
="Type of texture data to display and edit",
256 ("MATERIAL", "", "Show material textures", "MATERIAL", 0), # "Show material textures"
257 ("WORLD", "", "Show world textures", "WORLD", 1), # "Show world textures"
258 ("LIGHT", "", "Show lamp textures", "LIGHT", 2), # "Show lamp textures"
262 "Show particles textures",
265 ), # "Show particles textures"
269 "Show linestyle textures",
272 ), # "Show linestyle textures"
276 "Show other data textures",
279 ), # "Show other data textures"
284 use_sky_blend
: BoolProperty(
286 description
="Render background with natural progression from horizon to zenith",
290 use_sky_paper
: BoolProperty(
291 name
="Paper Sky", description
="Flatten blend or texture coordinates", default
=False
294 use_sky_real
: BoolProperty(
296 description
="Render background with a real horizon, relative to the camera angle",
300 horizon_color
: FloatVectorProperty(
301 name
="Horizon Color",
302 description
="Color at the horizon",
307 default
=(0.050876, 0.050876, 0.050876),
308 options
={"ANIMATABLE"},
312 zenith_color
: FloatVectorProperty(
314 description
="Color at the zenith",
319 default
=(0.0, 0.0, 0.0),
320 options
={"ANIMATABLE"},
324 ambient_color
: FloatVectorProperty(
325 name
="Ambient Color",
326 description
="Ambient color of the world",
331 default
=(0.0, 0.0, 0.0),
332 options
={"ANIMATABLE"},
335 active_texture_index
: IntProperty(
336 name
="Index for texture_slots", default
=0, update
=brush_texture_update
341 RenderPovSettingsCamera
,
342 RenderPovSettingsLight
,
343 RenderPovSettingsWorld
,
351 bpy
.types
.Camera
.pov
= PointerProperty(type=RenderPovSettingsCamera
)
352 bpy
.types
.Light
.pov
= PointerProperty(type=RenderPovSettingsLight
)
353 bpy
.types
.World
.pov
= PointerProperty(type=RenderPovSettingsWorld
)
357 del bpy
.types
.Camera
.pov
358 del bpy
.types
.Light
.pov
359 del bpy
.types
.World
.pov
361 for cls
in reversed(classes
):
362 unregister_class(cls
)