1 # SPDX-FileCopyrightText: 2021-2022 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 """Declare rendering properties controllable in UI"""
8 from bpy
.utils
import register_class
, unregister_class
9 from bpy
.types
import PropertyGroup
, Scene
10 from bpy
.props
import (
21 # ---------------------------------------------------------------- #
22 # Scene POV properties.
23 # ---------------------------------------------------------------- #
24 class RenderPovSettingsScene(PropertyGroup
):
26 """Declare scene level properties controllable in UI and translated to POV"""
28 # Linux SDL-window enable
29 sdl_window_enable
: BoolProperty(
30 name
="Enable SDL window", description
="Enable the SDL window in Linux OS", default
=True
33 text_block
: StringProperty(
34 name
="Text Scene Name",
35 description
="Name of POV scene to use. "
36 "Set when clicking Run to render current text only",
39 tempfiles_enable
: BoolProperty(
40 name
="Enable Tempfiles",
41 description
="Enable the OS-Tempfiles. Otherwise set the path where to save the files",
44 pov_editor
: BoolProperty(
46 description
="Don't Close POV editor after rendering (Overridden by /EXIT command)",
49 deletefiles_enable
: BoolProperty(
51 description
="Delete files after rendering. Doesn't work with the image",
54 scene_name
: StringProperty(
56 description
="Name of POV scene to create. Empty name will use "
57 "the name of the blend file",
60 scene_path
: StringProperty(
61 name
="Export scene path",
63 # description="Path to directory where the exported scene "
64 # "(POV and INI) is created",
65 description
="Path to directory where the files are created",
69 renderimage_path
: StringProperty(
70 name
="Rendered image path",
71 description
="Full path to directory where the rendered image is saved",
75 list_lf_enable
: BoolProperty(
77 description
="Enable line breaks in lists (vectors and indices). "
78 "Disabled: lists are exported in one line",
82 # Not a real pov option, just to know if we should write
83 radio_enable
: BoolProperty(
84 name
="Enable Radiosity", description
="Enable POV radiosity calculation", default
=True
87 radio_display_advanced
: BoolProperty(
88 name
="Advanced Options", description
="Show advanced options", default
=False
91 media_enable
: BoolProperty(
92 name
="Enable Media", description
="Enable POV atmospheric media", default
=False
95 media_samples
: IntProperty(
97 description
="Number of samples taken from camera to first object "
98 "encountered along ray path for media calculation",
104 media_scattering_type
: EnumProperty(
105 name
="Scattering Type",
106 description
="Scattering model",
111 "The simplest form of scattering because it is independent of direction.",
116 "For relatively small particles such as "
117 "minuscule water droplets of fog, cloud "
118 "particles, and particles responsible "
119 "for the polluted sky. In this model the"
120 " scattering is extremely directional in"
121 " the forward direction i.e. the amount "
122 "of scattered light is largest when the "
123 "incident light is anti-parallel to the "
124 "viewing direction (the light goes "
125 "directly to the viewer). It is smallest"
126 " when the incident light is parallel to"
127 " the viewing direction. ",
129 ("3", "3 Mie murky", "Like haze but much more directional"),
133 "For extremely small particles such as "
134 "molecules of the air. The amount of "
135 "scattered light depends on the incident"
136 " light angle. It is largest when the "
137 "incident light is parallel or "
138 "anti-parallel to the viewing direction "
139 "and smallest when the incident light is "
140 "perpendicular to viewing direction.",
144 "5 Henyey-Greenstein",
145 "The default eccentricity value "
146 "of zero defines isotropic "
147 "scattering while positive "
148 "values lead to scattering in "
149 "the direction of the light and "
150 "negative values lead to "
151 "scattering in the opposite "
152 "direction of the light. Larger "
153 "values of e (or smaller values "
154 "in the negative case) increase "
155 "the directional property of the"
162 media_diffusion_scale
: FloatProperty(
164 description
="Scale factor of Media Diffusion Color",
172 media_diffusion_color
: FloatVectorProperty(
173 name
="Media Diffusion Color",
174 description
="The atmospheric media color",
179 default
=(0.001, 0.001, 0.001),
180 options
={"ANIMATABLE"},
184 media_absorption_scale
: FloatProperty(
186 description
="Scale factor of Media Absorption Color. "
187 "use 1/depth of media volume in meters",
195 media_absorption_color
: FloatVectorProperty(
196 name
="Media Absorption Color",
197 description
="The atmospheric media absorption color",
202 default
=(0.0, 0.0, 0.0),
203 options
={"ANIMATABLE"},
207 media_eccentricity
: FloatProperty(
208 name
="Media Eccenticity Factor",
209 description
="Positive values lead"
210 " to scattering in the direction of the light and negative "
211 "values lead to scattering in the opposite direction of the "
212 "light. Larger values of e (or smaller values in the negative"
213 " case) increase the directional property of the scattering",
219 options
={"ANIMATABLE"},
222 baking_enable
: BoolProperty(
223 name
="Enable Baking", description
="Enable POV texture baking", default
=False
226 indentation_character
: EnumProperty(
228 description
="Select the indentation type",
230 ("NONE", "None", "No indentation"),
231 ("TAB", "Tabs", "Indentation with tabs"),
232 ("SPACE", "Spaces", "Indentation with spaces"),
237 indentation_spaces
: IntProperty(
238 name
="Quantity of spaces",
239 description
="The number of spaces for indentation",
245 comments_enable
: BoolProperty(
246 name
="Enable Comments", description
="Add comments to pov file", default
=True
250 command_line_switches
: StringProperty(
251 name
="Command Line Switches",
252 description
="Command line switches consist of a + (plus) or - "
253 "(minus) sign, followed by one or more alphabetic "
254 "characters and possibly a numeric value",
258 antialias_enable
: BoolProperty(
259 name
="Anti-Alias", description
="Enable Anti-Aliasing", default
=True
262 antialias_method
: EnumProperty(
264 description
="AA-sampling method. Type 1 is an adaptive, "
265 "non-recursive, super-sampling (as in the plain old render "
266 "bigger and scale down trick. Type 2 is a slightly "
267 "more efficient adaptive and recursive super-sampling. "
268 "Type 3 is a stochastic halton based super-sampling method so "
269 "rather artifact free and sampling rays so depth of field can "
270 "use them at no additional cost, as do area lights and "
271 "subsurface scattering materials, making it the best "
272 "quality / time trade-off in complex scenes",
274 ("0", "non-recursive AA", "Type 1 Sampling in POV"),
275 ("1", "recursive AA", "Type 2 Sampling in POV"),
276 ("2", "stochastic AA", "Type 3 Sampling in POV"),
281 antialias_confidence
: FloatProperty(
282 name
="Antialias Confidence",
283 description
="how surely the computed color "
284 "of a given pixel is indeed"
285 "within the threshold error margin",
292 antialias_depth
: IntProperty(
293 name
="Antialias Depth", description
="Depth of pixel for sampling", min=1, max=9, default
=2
296 antialias_threshold
: FloatProperty(
297 name
="Antialias Threshold",
298 description
="Tolerance for sub-pixels",
306 jitter_enable
: BoolProperty(
308 description
="Enable Jittering. Adds noise into the sampling "
309 "process (it should be avoided to use jitter in "
314 jitter_amount
: FloatProperty(
315 name
="Jitter Amount",
316 description
="Amount of jittering",
324 antialias_gamma
: FloatProperty(
325 name
="Antialias Gamma",
326 description
="POV-Ray compares gamma-adjusted values for super "
327 "sampling. Antialias Gamma sets the Gamma before "
336 alpha_filter
: FloatProperty(
338 description
="User defined color associated background alpha",
346 alpha_mode
: EnumProperty(
348 description
="Representation of alpha information in the RGBA pixels",
350 ("SKY", "Sky", "Transparent pixels are filled with sky color"),
351 ("STRAIGHT", "Straight", "Transparent pixels are not premultiplied"),
355 "World background has user defined premultiplied alpha",
361 use_shadows
: BoolProperty(
362 name
="Shadows", description
="Calculate shadows while rendering", default
=True
365 max_trace_level
: IntProperty(
366 name
="Max Trace Level",
367 description
="Number of reflections/refractions allowed on ray " "path",
373 adc_bailout_enable
: BoolProperty(name
="Enable", description
="", default
=False)
375 adc_bailout
: FloatProperty(
377 description
="Adaptive Depth Control (ADC) to stop computing additional"
378 "reflected or refracted rays when their contribution is insignificant."
379 "The default value is 1/255, or approximately 0.0039, since a change "
380 "smaller than that could not be visible in a 24 bit image. Generally "
381 "this value is fine and should be left alone."
382 "Setting adc_bailout to 0 will disable ADC, relying completely on "
383 "max_trace_level to set an upper limit on the number of rays spawned. ",
386 default
=0.00392156862745,
390 ambient_light_enable
: BoolProperty(name
="Enable", description
="", default
=False)
392 ambient_light
: FloatVectorProperty(
393 name
="Ambient Light",
394 description
="Ambient light is used to simulate the effect of inter-diffuse reflection",
400 options
={"ANIMATABLE"},
403 global_settings_advanced
: BoolProperty(name
="Advanced", description
="", default
=False)
405 irid_wavelength_enable
: BoolProperty(name
="Enable", description
="", default
=False)
407 irid_wavelength
: FloatVectorProperty(
408 name
="Irid Wavelength",
410 "Iridescence calculations depend upon the dominant "
411 "wavelengths of the primary colors of red, green and blue light"
417 default
=(0.25, 0.18, 0.14),
418 options
={"ANIMATABLE"},
422 number_of_waves_enable
: BoolProperty(name
="Enable", description
="", default
=False)
424 number_of_waves
: IntProperty(
427 "The waves and ripples patterns are generated by summing a series of waves, "
428 "each with a slightly different center and size"
435 noise_generator_enable
: BoolProperty(name
="Enable", description
="", default
=False)
437 noise_generator
: IntProperty(
438 name
="Noise Generator",
439 description
="There are three noise generators implemented",
445 # -------- PHOTONS -------- #
446 photon_enable
: BoolProperty(name
="Photons", description
="Enable global photons", default
=False)
448 photon_enable_count
: BoolProperty(
449 name
="Spacing / Count", description
="Enable count photons", default
=False
452 photon_count
: IntProperty(
453 name
="Count", description
="Photons count", min=1, max=100000000, default
=20000
456 photon_spacing
: FloatProperty(
458 description
="Average distance between photons on surfaces. half "
459 "this get four times as many surface photons",
468 photon_max_trace_level
: IntProperty(
469 name
="Max Trace Level",
470 description
="Number of reflections/refractions allowed on ray " "path",
476 photon_adc_bailout
: FloatProperty(
478 description
="The adc_bailout for photons. Use adc_bailout = "
479 "0.01 / brightest_ambient_object for good results",
488 photon_gather_min
: IntProperty(
490 description
="Minimum number of photons gathered" "for each point",
496 photon_gather_max
: IntProperty(
498 description
="Maximum number of photons gathered for each point",
504 photon_map_file_save_load
: EnumProperty(
506 description
="Load or Save photon map file",
507 items
=(("NONE", "None", ""), ("save", "Save", ""), ("load", "Load", "")),
511 photon_map_filename
: StringProperty(name
="Filename", description
="", maxlen
=1024)
513 photon_map_dir
: StringProperty(
514 name
="Directory", description
="", maxlen
=1024, subtype
="DIR_PATH"
517 photon_map_file
: StringProperty(name
="File", description
="", maxlen
=1024, subtype
="FILE_PATH")
519 # -------- RADIOSITY -------- #
520 radio_adc_bailout
: FloatProperty(
522 description
="The adc_bailout for radiosity rays. Use "
523 "adc_bailout = 0.01 / brightest_ambient_object for good results",
532 radio_always_sample
: BoolProperty(
533 name
="Always Sample",
534 description
="Only use the data from the pretrace step and not gather "
535 "any new samples during the final radiosity pass",
539 radio_brightness
: FloatProperty(
541 description
="Amount objects are brightened before being returned "
542 "upwards to the rest of the system",
550 radio_count
: IntProperty(
552 description
="Number of rays for each new radiosity value to be calculated "
553 "(halton sequence over 1600)",
560 radio_error_bound
: FloatProperty(
562 description
="One of the two main speed/quality tuning values, "
563 "lower values are more accurate",
571 radio_gray_threshold
: FloatProperty(
572 name
="Gray Threshold",
573 description
="One of the two main speed/quality tuning values, "
574 "lower values are more accurate",
582 radio_low_error_factor
: FloatProperty(
583 name
="Low Error Factor",
584 description
="Just enough samples is slightly blotchy. Low error changes error "
585 "tolerance for less critical last refining pass",
593 radio_media
: BoolProperty(
594 name
="Media", description
="Radiosity estimation can be affected by media", default
=True
597 radio_subsurface
: BoolProperty(
599 description
="Radiosity estimation can be affected by Subsurface Light Transport",
603 radio_minimum_reuse
: FloatProperty(
604 name
="Minimum Reuse",
605 description
="Fraction of the screen width which sets the minimum radius of reuse "
606 "for each sample point (At values higher than 2% expect errors)",
615 radio_maximum_reuse
: FloatProperty(
616 name
="Maximum Reuse",
617 description
="The maximum reuse parameter works in conjunction with, and is similar to that of minimum reuse, "
618 "the only difference being that it is an upper bound rather than a lower one",
625 radio_nearest_count
: IntProperty(
626 name
="Nearest Count",
627 description
="Number of old ambient values blended together to "
628 "create a new interpolated value",
634 radio_normal
: BoolProperty(
635 name
="Normals", description
="Radiosity estimation can be affected by normals", default
=False
638 radio_recursion_limit
: IntProperty(
639 name
="Recursion Limit",
640 description
="how many recursion levels are used to calculate "
641 "the diffuse inter-reflection",
647 radio_pretrace_start
: FloatProperty(
648 name
="Pretrace Start",
649 description
="Fraction of the screen width which sets the size of the "
650 "blocks in the mosaic preview first pass",
657 # XXX TODO set automatically to pretrace_end = 8 / max (image_width, image_height)
658 # for non advanced mode
659 radio_pretrace_end
: FloatProperty(
661 description
="Fraction of the screen width which sets the size of the blocks "
662 "in the mosaic preview last pass",
672 classes
= (RenderPovSettingsScene
,)
678 Scene
.pov
= PointerProperty(type=RenderPovSettingsScene
)
683 for cls
in reversed(classes
):
684 unregister_class(cls
)