1 # SPDX-License-Identifier: GPL-2.0-or-later
3 """Declare rendering properties controllable in UI"""
6 from bpy
.utils
import register_class
, unregister_class
7 from bpy
.types
import PropertyGroup
, Scene
8 from bpy
.props
import (
19 # ---------------------------------------------------------------- #
20 # Scene POV properties.
21 # ---------------------------------------------------------------- #
22 class RenderPovSettingsScene(PropertyGroup
):
24 """Declare scene level properties controllable in UI and translated to POV"""
26 # Linux SDL-window enable
27 sdl_window_enable
: BoolProperty(
28 name
="Enable SDL window", description
="Enable the SDL window in Linux OS", default
=True
31 text_block
: StringProperty(
32 name
="Text Scene Name",
33 description
="Name of POV scene to use. "
34 "Set when clicking Run to render current text only",
37 tempfiles_enable
: BoolProperty(
38 name
="Enable Tempfiles",
39 description
="Enable the OS-Tempfiles. Otherwise set the path where to save the files",
42 pov_editor
: BoolProperty(
44 description
="Don't Close POV editor after rendering (Overridden by /EXIT command)",
47 deletefiles_enable
: BoolProperty(
49 description
="Delete files after rendering. Doesn't work with the image",
52 scene_name
: StringProperty(
54 description
="Name of POV scene to create. Empty name will use "
55 "the name of the blend file",
58 scene_path
: StringProperty(
59 name
="Export scene path",
61 # description="Path to directory where the exported scene "
62 # "(POV and INI) is created",
63 description
="Path to directory where the files are created",
67 renderimage_path
: StringProperty(
68 name
="Rendered image path",
69 description
="Full path to directory where the rendered image is saved",
73 list_lf_enable
: BoolProperty(
75 description
="Enable line breaks in lists (vectors and indices). "
76 "Disabled: lists are exported in one line",
80 # Not a real pov option, just to know if we should write
81 radio_enable
: BoolProperty(
82 name
="Enable Radiosity", description
="Enable POV radiosity calculation", default
=True
85 radio_display_advanced
: BoolProperty(
86 name
="Advanced Options", description
="Show advanced options", default
=False
89 media_enable
: BoolProperty(
90 name
="Enable Media", description
="Enable POV atmospheric media", default
=False
93 media_samples
: IntProperty(
95 description
="Number of samples taken from camera to first object "
96 "encountered along ray path for media calculation",
102 media_scattering_type
: EnumProperty(
103 name
="Scattering Type",
104 description
="Scattering model",
109 "The simplest form of scattering because it is independent of direction.",
114 "For relatively small particles such as "
115 "minuscule water droplets of fog, cloud "
116 "particles, and particles responsible "
117 "for the polluted sky. In this model the"
118 " scattering is extremely directional in"
119 " the forward direction i.e. the amount "
120 "of scattered light is largest when the "
121 "incident light is anti-parallel to the "
122 "viewing direction (the light goes "
123 "directly to the viewer). It is smallest"
124 " when the incident light is parallel to"
125 " the viewing direction. ",
127 ("3", "3 Mie murky", "Like haze but much more directional"),
131 "For extremely small particles such as "
132 "molecules of the air. The amount of "
133 "scattered light depends on the incident"
134 " light angle. It is largest when the "
135 "incident light is parallel or "
136 "anti-parallel to the viewing direction "
137 "and smallest when the incident light is "
138 "perpendicular to viewing direction.",
142 "5 Henyey-Greenstein",
143 "The default eccentricity value "
144 "of zero defines isotropic "
145 "scattering while positive "
146 "values lead to scattering in "
147 "the direction of the light and "
148 "negative values lead to "
149 "scattering in the opposite "
150 "direction of the light. Larger "
151 "values of e (or smaller values "
152 "in the negative case) increase "
153 "the directional property of the"
160 media_diffusion_scale
: FloatProperty(
162 description
="Scale factor of Media Diffusion Color",
170 media_diffusion_color
: FloatVectorProperty(
171 name
="Media Diffusion Color",
172 description
="The atmospheric media color",
177 default
=(0.001, 0.001, 0.001),
178 options
={"ANIMATABLE"},
182 media_absorption_scale
: FloatProperty(
184 description
="Scale factor of Media Absorption Color. "
185 "use 1/depth of media volume in meters",
193 media_absorption_color
: FloatVectorProperty(
194 name
="Media Absorption Color",
195 description
="The atmospheric media absorption color",
200 default
=(0.0, 0.0, 0.0),
201 options
={"ANIMATABLE"},
205 media_eccentricity
: FloatProperty(
206 name
="Media Eccenticity Factor",
207 description
="Positive values lead"
208 " to scattering in the direction of the light and negative "
209 "values lead to scattering in the opposite direction of the "
210 "light. Larger values of e (or smaller values in the negative"
211 " case) increase the directional property of the scattering",
217 options
={"ANIMATABLE"},
220 baking_enable
: BoolProperty(
221 name
="Enable Baking", description
="Enable POV texture baking", default
=False
224 indentation_character
: EnumProperty(
226 description
="Select the indentation type",
228 ("NONE", "None", "No indentation"),
229 ("TAB", "Tabs", "Indentation with tabs"),
230 ("SPACE", "Spaces", "Indentation with spaces"),
235 indentation_spaces
: IntProperty(
236 name
="Quantity of spaces",
237 description
="The number of spaces for indentation",
243 comments_enable
: BoolProperty(
244 name
="Enable Comments", description
="Add comments to pov file", default
=True
248 command_line_switches
: StringProperty(
249 name
="Command Line Switches",
250 description
="Command line switches consist of a + (plus) or - "
251 "(minus) sign, followed by one or more alphabetic "
252 "characters and possibly a numeric value",
256 antialias_enable
: BoolProperty(
257 name
="Anti-Alias", description
="Enable Anti-Aliasing", default
=True
260 antialias_method
: EnumProperty(
262 description
="AA-sampling method. Type 1 is an adaptive, "
263 "non-recursive, super-sampling (as in the plain old render "
264 "bigger and scale down trick. Type 2 is a slightly "
265 "more efficient adaptive and recursive super-sampling. "
266 "Type 3 is a stochastic halton based super-sampling method so "
267 "rather artifact free and sampling rays so depth of field can "
268 "use them at no additional cost, as do area lights and "
269 "subsurface scattering materials, making it the best "
270 "quality / time trade-off in complex scenes",
272 ("0", "non-recursive AA", "Type 1 Sampling in POV"),
273 ("1", "recursive AA", "Type 2 Sampling in POV"),
274 ("2", "stochastic AA", "Type 3 Sampling in POV"),
279 antialias_confidence
: FloatProperty(
280 name
="Antialias Confidence",
281 description
="how surely the computed color "
282 "of a given pixel is indeed"
283 "within the threshold error margin",
290 antialias_depth
: IntProperty(
291 name
="Antialias Depth", description
="Depth of pixel for sampling", min=1, max=9, default
=2
294 antialias_threshold
: FloatProperty(
295 name
="Antialias Threshold",
296 description
="Tolerance for sub-pixels",
304 jitter_enable
: BoolProperty(
306 description
="Enable Jittering. Adds noise into the sampling "
307 "process (it should be avoided to use jitter in "
312 jitter_amount
: FloatProperty(
313 name
="Jitter Amount",
314 description
="Amount of jittering",
322 antialias_gamma
: FloatProperty(
323 name
="Antialias Gamma",
324 description
="POV-Ray compares gamma-adjusted values for super "
325 "sampling. Antialias Gamma sets the Gamma before "
334 alpha_filter
: FloatProperty(
336 description
="User defined color associated background alpha",
344 alpha_mode
: EnumProperty(
346 description
="Representation of alpha information in the RGBA pixels",
348 ("SKY", "Sky", "Transparent pixels are filled with sky color"),
349 ("STRAIGHT", "Straight", "Transparent pixels are not premultiplied"),
353 "World background has user defined premultiplied alpha",
359 use_shadows
: BoolProperty(
360 name
="Shadows", description
="Calculate shadows while rendering", default
=True
363 max_trace_level
: IntProperty(
364 name
="Max Trace Level",
365 description
="Number of reflections/refractions allowed on ray " "path",
371 adc_bailout_enable
: BoolProperty(name
="Enable", description
="", default
=False)
373 adc_bailout
: FloatProperty(
375 description
="Adaptive Depth Control (ADC) to stop computing additional"
376 "reflected or refracted rays when their contribution is insignificant."
377 "The default value is 1/255, or approximately 0.0039, since a change "
378 "smaller than that could not be visible in a 24 bit image. Generally "
379 "this value is fine and should be left alone."
380 "Setting adc_bailout to 0 will disable ADC, relying completely on "
381 "max_trace_level to set an upper limit on the number of rays spawned. ",
384 default
=0.00392156862745,
388 ambient_light_enable
: BoolProperty(name
="Enable", description
="", default
=False)
390 ambient_light
: FloatVectorProperty(
391 name
="Ambient Light",
392 description
="Ambient light is used to simulate the effect of inter-diffuse reflection",
398 options
={"ANIMATABLE"},
401 global_settings_advanced
: BoolProperty(name
="Advanced", description
="", default
=False)
403 irid_wavelength_enable
: BoolProperty(name
="Enable", description
="", default
=False)
405 irid_wavelength
: FloatVectorProperty(
406 name
="Irid Wavelength",
408 "Iridescence calculations depend upon the dominant "
409 "wavelengths of the primary colors of red, green and blue light"
415 default
=(0.25, 0.18, 0.14),
416 options
={"ANIMATABLE"},
420 number_of_waves_enable
: BoolProperty(name
="Enable", description
="", default
=False)
422 number_of_waves
: IntProperty(
425 "The waves and ripples patterns are generated by summing a series of waves, "
426 "each with a slightly different center and size"
433 noise_generator_enable
: BoolProperty(name
="Enable", description
="", default
=False)
435 noise_generator
: IntProperty(
436 name
="Noise Generator",
437 description
="There are three noise generators implemented",
443 # -------- PHOTONS -------- #
444 photon_enable
: BoolProperty(name
="Photons", description
="Enable global photons", default
=False)
446 photon_enable_count
: BoolProperty(
447 name
="Spacing / Count", description
="Enable count photons", default
=False
450 photon_count
: IntProperty(
451 name
="Count", description
="Photons count", min=1, max=100000000, default
=20000
454 photon_spacing
: FloatProperty(
456 description
="Average distance between photons on surfaces. half "
457 "this get four times as many surface photons",
466 photon_max_trace_level
: IntProperty(
467 name
="Max Trace Level",
468 description
="Number of reflections/refractions allowed on ray " "path",
474 photon_adc_bailout
: FloatProperty(
476 description
="The adc_bailout for photons. Use adc_bailout = "
477 "0.01 / brightest_ambient_object for good results",
486 photon_gather_min
: IntProperty(
488 description
="Minimum number of photons gathered" "for each point",
494 photon_gather_max
: IntProperty(
496 description
="Maximum number of photons gathered for each point",
502 photon_map_file_save_load
: EnumProperty(
504 description
="Load or Save photon map file",
505 items
=(("NONE", "None", ""), ("save", "Save", ""), ("load", "Load", "")),
509 photon_map_filename
: StringProperty(name
="Filename", description
="", maxlen
=1024)
511 photon_map_dir
: StringProperty(
512 name
="Directory", description
="", maxlen
=1024, subtype
="DIR_PATH"
515 photon_map_file
: StringProperty(name
="File", description
="", maxlen
=1024, subtype
="FILE_PATH")
517 # -------- RADIOSITY -------- #
518 radio_adc_bailout
: FloatProperty(
520 description
="The adc_bailout for radiosity rays. Use "
521 "adc_bailout = 0.01 / brightest_ambient_object for good results",
530 radio_always_sample
: BoolProperty(
531 name
="Always Sample",
532 description
="Only use the data from the pretrace step and not gather "
533 "any new samples during the final radiosity pass",
537 radio_brightness
: FloatProperty(
539 description
="Amount objects are brightened before being returned "
540 "upwards to the rest of the system",
548 radio_count
: IntProperty(
550 description
="Number of rays for each new radiosity value to be calculated "
551 "(halton sequence over 1600)",
558 radio_error_bound
: FloatProperty(
560 description
="One of the two main speed/quality tuning values, "
561 "lower values are more accurate",
569 radio_gray_threshold
: FloatProperty(
570 name
="Gray Threshold",
571 description
="One of the two main speed/quality tuning values, "
572 "lower values are more accurate",
580 radio_low_error_factor
: FloatProperty(
581 name
="Low Error Factor",
582 description
="Just enough samples is slightly blotchy. Low error changes error "
583 "tolerance for less critical last refining pass",
591 radio_media
: BoolProperty(
592 name
="Media", description
="Radiosity estimation can be affected by media", default
=True
595 radio_subsurface
: BoolProperty(
597 description
="Radiosity estimation can be affected by Subsurface Light Transport",
601 radio_minimum_reuse
: FloatProperty(
602 name
="Minimum Reuse",
603 description
="Fraction of the screen width which sets the minimum radius of reuse "
604 "for each sample point (At values higher than 2% expect errors)",
613 radio_maximum_reuse
: FloatProperty(
614 name
="Maximum Reuse",
615 description
="The maximum reuse parameter works in conjunction with, and is similar to that of minimum reuse, "
616 "the only difference being that it is an upper bound rather than a lower one",
623 radio_nearest_count
: IntProperty(
624 name
="Nearest Count",
625 description
="Number of old ambient values blended together to "
626 "create a new interpolated value",
632 radio_normal
: BoolProperty(
633 name
="Normals", description
="Radiosity estimation can be affected by normals", default
=False
636 radio_recursion_limit
: IntProperty(
637 name
="Recursion Limit",
638 description
="how many recursion levels are used to calculate "
639 "the diffuse inter-reflection",
645 radio_pretrace_start
: FloatProperty(
646 name
="Pretrace Start",
647 description
="Fraction of the screen width which sets the size of the "
648 "blocks in the mosaic preview first pass",
655 # XXX TODO set automatically to pretrace_end = 8 / max (image_width, image_height)
656 # for non advanced mode
657 radio_pretrace_end
: FloatProperty(
659 description
="Fraction of the screen width which sets the size of the blocks "
660 "in the mosaic preview last pass",
670 classes
= (RenderPovSettingsScene
,)
676 Scene
.pov
= PointerProperty(type=RenderPovSettingsScene
)
681 for cls
in reversed(classes
):
682 unregister_class(cls
)