Fix T48301: Cycles incorrect render with CMJ and viewport samples 0.
[blender-staging.git] / intern / cycles / blender / addon / properties.py
1 #
2 # Copyright 2011-2013 Blender Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 # <pep8 compliant>
18
19 import bpy
20 from bpy.props import (BoolProperty,
21                        EnumProperty,
22                        FloatProperty,
23                        IntProperty,
24                        PointerProperty)
25
26 # enums
27
28 import _cycles
29
30 enum_devices = (
31     ('CPU', "CPU", "Use CPU for rendering"),
32     ('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in user preferences"),
33     )
34
35 if _cycles.with_network:
36     enum_devices += (('NETWORK', "Networked Device", "Use networked device for rendering"),)
37
38 enum_feature_set = (
39     ('SUPPORTED', "Supported", "Only use finished and supported features"),
40     ('EXPERIMENTAL', "Experimental", "Use experimental and incomplete features that might be broken or change in the future", 'ERROR', 1),
41     )
42
43 enum_displacement_methods = (
44     ('BUMP', "Bump", "Bump mapping to simulate the appearance of displacement"),
45     ('TRUE', "True", "Use true displacement only, requires fine subdivision"),
46     ('BOTH', "Both", "Combination of displacement and bump mapping"),
47     )
48
49 enum_subdivision_types = (
50     ('NONE', "None", "No subdivision"),
51     ('LINEAR', "Linear", "Use linear subdivision"),
52     ('CATMULL_CLARK', "Catmull–Clark", "Use Catmull-Clark subdivision"),
53     )
54
55 enum_bvh_types = (
56     ('DYNAMIC_BVH', "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"),
57     ('STATIC_BVH', "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"),
58     )
59
60 enum_filter_types = (
61     ('BOX', "Box", "Box filter"),
62     ('GAUSSIAN', "Gaussian", "Gaussian filter"),
63     ('BLACKMAN_HARRIS', "Blackman-Harris", "Blackman-Harris filter"),
64     )
65
66 enum_aperture_types = (
67     ('RADIUS', "Radius", "Directly change the size of the aperture"),
68     ('FSTOP', "F-stop", "Change the size of the aperture by f-stop"),
69     )
70
71 enum_panorama_types = (
72     ('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
73     ('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
74     ('FISHEYE_EQUISOLID', "Fisheye Equisolid",
75                           "Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
76     ('MIRRORBALL', "Mirror Ball", "Uses the mirror ball mapping"),
77     )
78
79 enum_curve_primitives = (
80     ('TRIANGLES', "Triangles", "Create triangle geometry around strands"),
81     ('LINE_SEGMENTS', "Line Segments", "Use line segment primitives"),
82     ('CURVE_SEGMENTS', "Curve Segments", "Use segmented cardinal curve primitives"),
83     )
84
85 enum_triangle_curves = (
86     ('CAMERA_TRIANGLES', "Planes", "Create individual triangles forming planes that face camera"),
87     ('TESSELLATED_TRIANGLES', "Tessellated", "Create mesh surrounding each strand"),
88     )
89
90 enum_curve_shape = (
91     ('RIBBONS', "Ribbons", "Ignore thickness of each strand"),
92     ('THICK', "Thick", "Use thickness of strand when rendering"),
93     )
94
95 enum_tile_order = (
96     ('CENTER', "Center", "Render from center to the edges"),
97     ('RIGHT_TO_LEFT', "Right to Left", "Render from right to left"),
98     ('LEFT_TO_RIGHT', "Left to Right", "Render from left to right"),
99     ('TOP_TO_BOTTOM', "Top to Bottom", "Render from top to bottom"),
100     ('BOTTOM_TO_TOP', "Bottom to Top", "Render from bottom to top"),
101     ('HILBERT_SPIRAL', "Hilbert Spiral", "Render in a Hilbert Spiral"),
102     )
103
104 enum_use_layer_samples = (
105     ('USE', "Use", "Per render layer number of samples override scene samples"),
106     ('BOUNDED', "Bounded", "Bound per render layer number of samples by global samples"),
107     ('IGNORE', "Ignore", "Ignore per render layer number of samples"),
108     )
109
110 enum_sampling_pattern = (
111     ('SOBOL', "Sobol", "Use Sobol random sampling pattern"),
112     ('CORRELATED_MUTI_JITTER', "Correlated Multi-Jitter", "Use Correlated Multi-Jitter random sampling pattern"),
113     )
114
115 enum_integrator = (
116     ('BRANCHED_PATH', "Branched Path Tracing", "Path tracing integrator that branches on the first bounce, giving more control over the number of light and material samples"),
117     ('PATH', "Path Tracing", "Pure path tracing integrator"),
118     )
119
120 enum_volume_sampling = (
121     ('DISTANCE', "Distance", "Use distance sampling, best for dense volumes with lights far away"),
122     ('EQUIANGULAR', "Equiangular", "Use equiangular sampling, best for volumes with low density with light inside or near the volume"),
123     ('MULTIPLE_IMPORTANCE', "Multiple Importance", "Combine distance and equi-angular sampling for volumes where neither method is ideal"),
124     )
125
126 enum_volume_interpolation = (
127     ('LINEAR', "Linear", "Good smoothness and speed"),
128     ('CUBIC', "Cubic", "Smoothed high quality interpolation, but slower")
129     )
130
131
132 class CyclesRenderSettings(bpy.types.PropertyGroup):
133     @classmethod
134     def register(cls):
135         bpy.types.Scene.cycles = PointerProperty(
136                 name="Cycles Render Settings",
137                 description="Cycles render settings",
138                 type=cls,
139                 )
140         cls.device = EnumProperty(
141                 name="Device",
142                 description="Device to use for rendering",
143                 items=enum_devices,
144                 default='CPU',
145                 )
146         cls.feature_set = EnumProperty(
147                 name="Feature Set",
148                 description="Feature set to use for rendering",
149                 items=enum_feature_set,
150                 default='SUPPORTED',
151                 )
152         cls.shading_system = BoolProperty(
153                 name="Open Shading Language",
154                 description="Use Open Shading Language (CPU rendering only)",
155                 )
156
157         cls.progressive = EnumProperty(
158                 name="Integrator",
159                 description="Method to sample lights and materials",
160                 items=enum_integrator,
161                 default='PATH',
162                 )
163
164         cls.use_square_samples = BoolProperty(
165                 name="Square Samples",
166                 description="Square sampling values for easier artist control",
167                 default=False,
168                 )
169
170         cls.samples = IntProperty(
171                 name="Samples",
172                 description="Number of samples to render for each pixel",
173                 min=1, max=2147483647,
174                 default=128,
175                 )
176         cls.preview_samples = IntProperty(
177                 name="Preview Samples",
178                 description="Number of samples to render in the viewport, unlimited if 0",
179                 min=0, max=2147483647,
180                 default=32,
181                 )
182         cls.preview_pause = BoolProperty(
183                 name="Pause Preview",
184                 description="Pause all viewport preview renders",
185                 default=False,
186                 )
187         cls.preview_active_layer = BoolProperty(
188                 name="Preview Active Layer",
189                 description="Preview active render layer in viewport",
190                 default=False,
191                 )
192
193         cls.aa_samples = IntProperty(
194                 name="AA Samples",
195                 description="Number of antialiasing samples to render for each pixel",
196                 min=1, max=2097151,
197                 default=4,
198                 )
199         cls.preview_aa_samples = IntProperty(
200                 name="AA Samples",
201                 description="Number of antialiasing samples to render in the viewport, unlimited if 0",
202                 min=0, max=2097151,
203                 default=4,
204                 )
205         cls.diffuse_samples = IntProperty(
206                 name="Diffuse Samples",
207                 description="Number of diffuse bounce samples to render for each AA sample",
208                 min=1, max=1024,
209                 default=1,
210                 )
211         cls.glossy_samples = IntProperty(
212                 name="Glossy Samples",
213                 description="Number of glossy bounce samples to render for each AA sample",
214                 min=1, max=1024,
215                 default=1,
216                 )
217         cls.transmission_samples = IntProperty(
218                 name="Transmission Samples",
219                 description="Number of transmission bounce samples to render for each AA sample",
220                 min=1, max=1024,
221                 default=1,
222                 )
223         cls.ao_samples = IntProperty(
224                 name="Ambient Occlusion Samples",
225                 description="Number of ambient occlusion samples to render for each AA sample",
226                 min=1, max=1024,
227                 default=1,
228                 )
229         cls.mesh_light_samples = IntProperty(
230                 name="Mesh Light Samples",
231                 description="Number of mesh emission light samples to render for each AA sample",
232                 min=1, max=1024,
233                 default=1,
234                 )
235
236         cls.subsurface_samples = IntProperty(
237                 name="Subsurface Samples",
238                 description="Number of subsurface scattering samples to render for each AA sample",
239                 min=1, max=1024,
240                 default=1,
241                 )
242
243         cls.volume_samples = IntProperty(
244                 name="Volume Samples",
245                 description="Number of volume scattering samples to render for each AA sample",
246                 min=1, max=1024,
247                 default=1,
248                 )
249
250         cls.sampling_pattern = EnumProperty(
251                 name="Sampling Pattern",
252                 description="Random sampling pattern used by the integrator",
253                 items=enum_sampling_pattern,
254                 default='SOBOL',
255                 )
256
257         cls.use_layer_samples = EnumProperty(
258                 name="Layer Samples",
259                 description="How to use per render layer sample settings",
260                 items=enum_use_layer_samples,
261                 default='USE',
262                 )
263
264         cls.sample_all_lights_direct = BoolProperty(
265                 name="Sample All Direct Lights",
266                 description="Sample all lights (for direct samples), rather than randomly picking one",
267                 default=True,
268                 )
269
270         cls.sample_all_lights_indirect = BoolProperty(
271                 name="Sample All Indirect Lights",
272                 description="Sample all lights (for indirect samples), rather than randomly picking one",
273                 default=True,
274                 )
275
276         cls.caustics_reflective = BoolProperty(
277                 name="Reflective Caustics",
278                 description="Use reflective caustics, resulting in a brighter image (more noise but added realism)",
279                 default=True,
280                 )
281
282         cls.caustics_refractive = BoolProperty(
283                 name="Refractive Caustics",
284                 description="Use refractive caustics, resulting in a brighter image (more noise but added realism)",
285                 default=True,
286                 )
287
288         cls.blur_glossy = FloatProperty(
289                 name="Filter Glossy",
290                 description="Adaptively blur glossy shaders after blurry bounces, "
291                             "to reduce noise at the cost of accuracy",
292                 min=0.0, max=10.0,
293                 default=0.0,
294                 )
295
296         cls.min_bounces = IntProperty(
297                 name="Min Bounces",
298                 description="Minimum number of bounces, setting this lower "
299                             "than the maximum enables probabilistic path "
300                             "termination (faster but noisier)",
301                 min=0, max=1024,
302                 default=3,
303                 )
304         cls.max_bounces = IntProperty(
305                 name="Max Bounces",
306                 description="Total maximum number of bounces",
307                 min=0, max=1024,
308                 default=12,
309                 )
310
311         cls.diffuse_bounces = IntProperty(
312                 name="Diffuse Bounces",
313                 description="Maximum number of diffuse reflection bounces, bounded by total maximum",
314                 min=0, max=1024,
315                 default=4,
316                 )
317         cls.glossy_bounces = IntProperty(
318                 name="Glossy Bounces",
319                 description="Maximum number of glossy reflection bounces, bounded by total maximum",
320                 min=0, max=1024,
321                 default=4,
322                 )
323         cls.transmission_bounces = IntProperty(
324                 name="Transmission Bounces",
325                 description="Maximum number of transmission bounces, bounded by total maximum",
326                 min=0, max=1024,
327                 default=12,
328                 )
329         cls.volume_bounces = IntProperty(
330                 name="Volume Bounces",
331                 description="Maximum number of volumetric scattering events",
332                 min=0, max=1024,
333                 default=0,
334                 )
335
336         cls.transparent_min_bounces = IntProperty(
337                 name="Transparent Min Bounces",
338                 description="Minimum number of transparent bounces, setting "
339                             "this lower than the maximum enables "
340                             "probabilistic path termination (faster but "
341                             "noisier)",
342                 min=0, max=1024,
343                 default=8,
344                 )
345         cls.transparent_max_bounces = IntProperty(
346                 name="Transparent Max Bounces",
347                 description="Maximum number of transparent bounces",
348                 min=0, max=1024,
349                 default=8,
350                 )
351         cls.use_transparent_shadows = BoolProperty(
352                 name="Transparent Shadows",
353                 description="Use transparency of surfaces for rendering shadows",
354                 default=True,
355                 )
356
357         cls.volume_step_size = FloatProperty(
358                 name="Step Size",
359                 description="Distance between volume shader samples when rendering the volume "
360                             "(lower values give more accurate and detailed results, but also increased render time)",
361                 default=0.1,
362                 min=0.0000001, max=100000.0, soft_min=0.01, soft_max=1.0
363                 )
364
365         cls.volume_max_steps = IntProperty(
366                 name="Max Steps",
367                 description="Maximum number of steps through the volume before giving up, "
368                             "to avoid extremely long render times with big objects or small step sizes",
369                 default=1024,
370                 min=2, max=65536
371                 )
372
373         cls.dicing_rate = FloatProperty(
374                 name="Dicing Rate",
375                 description="Size of a micropolygon in pixels",
376                 min=0.1, max=1000.0,
377                 default=1.0,
378                 )
379         cls.preview_dicing_rate = FloatProperty(
380                 name="Preview Dicing Rate",
381                 description="Size of a micropolygon in pixels during preview render",
382                 min=0.1, max=1000.0,
383                 default=8.0,
384                 )
385
386         cls.max_subdivisions = IntProperty(
387                 name="Max Subdivisions",
388                 description="Stop subdividing when this level is reached even if the dice rate would produce finer tessellation",
389                 min=0, max=16,
390                 default=12,
391                 )
392
393         cls.film_exposure = FloatProperty(
394                 name="Exposure",
395                 description="Image brightness scale",
396                 min=0.0, max=10.0,
397                 default=1.0,
398                 )
399         cls.film_transparent = BoolProperty(
400                 name="Transparent",
401                 description="World background is transparent with premultiplied alpha",
402                 default=False,
403                 )
404
405         # Really annoyingly, we have to keep it around for a few releases,
406         # otherwise forward compatibility breaks in really bad manner: CRASH!
407         #
408         # TODO(sergey): Remove this during 2.8x series of Blender.
409         cls.filter_type = EnumProperty(
410                 name="Filter Type",
411                 description="Pixel filter type",
412                 items=enum_filter_types,
413                 default='BLACKMAN_HARRIS',
414                 )
415
416         cls.pixel_filter_type = EnumProperty(
417                 name="Filter Type",
418                 description="Pixel filter type",
419                 items=enum_filter_types,
420                 default='BLACKMAN_HARRIS',
421                 )
422
423         cls.filter_width = FloatProperty(
424                 name="Filter Width",
425                 description="Pixel filter width",
426                 min=0.01, max=10.0,
427                 default=1.5,
428                 )
429
430         cls.seed = IntProperty(
431                 name="Seed",
432                 description="Seed value for integrator to get different noise patterns",
433                 min=0, max=2147483647,
434                 default=0,
435                 )
436
437         cls.use_animated_seed = BoolProperty(
438                 name="Use Animated Seed",
439                 description="Use different seed values (and hence noise patterns) at different frames",
440                 default=False,
441                 )
442
443         cls.sample_clamp_direct = FloatProperty(
444                 name="Clamp Direct",
445                 description="If non-zero, the maximum value for a direct sample, "
446                             "higher values will be scaled down to avoid too "
447                             "much noise and slow convergence at the cost of accuracy",
448                 min=0.0, max=1e8,
449                 default=0.0,
450                 )
451
452         cls.sample_clamp_indirect = FloatProperty(
453                 name="Clamp Indirect",
454                 description="If non-zero, the maximum value for an indirect sample, "
455                             "higher values will be scaled down to avoid too "
456                             "much noise and slow convergence at the cost of accuracy",
457                 min=0.0, max=1e8,
458                 default=0.0,
459                 )
460
461         cls.debug_tile_size = IntProperty(
462                 name="Tile Size",
463                 description="",
464                 min=1, max=4096,
465                 default=1024,
466                 )
467
468         cls.preview_start_resolution = IntProperty(
469                 name="Start Resolution",
470                 description="Resolution to start rendering preview at, "
471                             "progressively increasing it to the full viewport size",
472                 min=8, max=16384,
473                 default=64,
474                 )
475
476         cls.debug_reset_timeout = FloatProperty(
477                 name="Reset timeout",
478                 description="",
479                 min=0.01, max=10.0,
480                 default=0.1,
481                 )
482         cls.debug_cancel_timeout = FloatProperty(
483                 name="Cancel timeout",
484                 description="",
485                 min=0.01, max=10.0,
486                 default=0.1,
487                 )
488         cls.debug_text_timeout = FloatProperty(
489                 name="Text timeout",
490                 description="",
491                 min=0.01, max=10.0,
492                 default=1.0,
493                 )
494
495         cls.debug_bvh_type = EnumProperty(
496                 name="Viewport BVH Type",
497                 description="Choose between faster updates, or faster render",
498                 items=enum_bvh_types,
499                 default='DYNAMIC_BVH',
500                 )
501         cls.debug_use_spatial_splits = BoolProperty(
502                 name="Use Spatial Splits",
503                 description="Use BVH spatial splits: longer builder time, faster render",
504                 default=False,
505                 )
506         cls.tile_order = EnumProperty(
507                 name="Tile Order",
508                 description="Tile order for rendering",
509                 items=enum_tile_order,
510                 default='HILBERT_SPIRAL',
511                 options=set(),  # Not animatable!
512                 )
513         cls.use_progressive_refine = BoolProperty(
514                 name="Progressive Refine",
515                 description="Instead of rendering each tile until it is finished, "
516                             "refine the whole image progressively "
517                             "(this renders somewhat slower, "
518                             "but time can be saved by manually stopping the render when the noise is low enough)",
519                 default=False,
520                 )
521
522         cls.bake_type = EnumProperty(
523             name="Bake Type",
524             default='COMBINED',
525             description="Type of pass to bake",
526             items=(
527                 ('COMBINED', "Combined", ""),
528                 ('AO', "Ambient Occlusion", ""),
529                 ('SHADOW', "Shadow", ""),
530                 ('NORMAL', "Normal", ""),
531                 ('UV', "UV", ""),
532                 ('EMIT', "Emit", ""),
533                 ('ENVIRONMENT', "Environment", ""),
534                 ('DIFFUSE', "Diffuse", ""),
535                 ('GLOSSY', "Glossy", ""),
536                 ('TRANSMISSION', "Transmission", ""),
537                 ('SUBSURFACE', "Subsurface", ""),
538                 ),
539             )
540
541         cls.use_camera_cull = BoolProperty(
542                 name="Use Camera Cull",
543                 description="Allow objects to be culled based on the camera frustum",
544                 default=False,
545                 )
546
547         cls.camera_cull_margin = FloatProperty(
548                 name="Camera Cull Margin",
549                 description="Margin for the camera space culling",
550                 default=0.1,
551                 min=0.0, max=5.0
552                 )
553
554         cls.motion_blur_position = EnumProperty(
555             name="Motion Blur Position",
556             default='CENTER',
557             description="Offset for the shutter's time interval, allows to change the motion blur trails",
558             items=(
559                 ('START', "Start on Frame", "The shutter opens at the current frame"),
560                 ('CENTER', "Center on Frame", "The shutter is open during the current frame"),
561                 ('END', "End on Frame", "The shutter closes at the current frame"),
562                 ),
563             )
564
565         cls.rolling_shutter_type = EnumProperty(
566             name="Shutter Type",
567             default='NONE',
568             description="Type of rolling shutter effect matching CMOS-based cameras",
569             items=(
570                 ('NONE', "None", "No rolling shutter effect used"),
571                 ('TOP', "Top-Bottom", "Sensor is being scanned from top to bottom")
572                 # TODO(seergey): Are there real cameras with different scanning direction?
573                 ),
574             )
575
576         cls.rolling_shutter_duration = FloatProperty(
577             name="Rolling Shutter Duration",
578             description="Scanline \"exposure\" time for the rolling shutter effect",
579             default=0.1,
580             min=0.0, max=1.0,
581             )
582
583         # Various fine-tuning debug flags
584
585         def devices_update_callback(self, context):
586             import _cycles
587             scene = context.scene.as_pointer()
588             return _cycles.debug_flags_update(scene)
589
590         cls.debug_use_cpu_avx2 = BoolProperty(name="AVX2", default=True)
591         cls.debug_use_cpu_avx = BoolProperty(name="AVX", default=True)
592         cls.debug_use_cpu_sse41 = BoolProperty(name="SSE41", default=True)
593         cls.debug_use_cpu_sse3 = BoolProperty(name="SSE3", default=True)
594         cls.debug_use_cpu_sse2 = BoolProperty(name="SSE2", default=True)
595         cls.debug_use_qbvh = BoolProperty(name="QBVH", default=True)
596
597         cls.debug_opencl_kernel_type = EnumProperty(
598             name="OpenCL Kernel Type",
599             default='DEFAULT',
600             items=(
601                 ('DEFAULT', "Default", ""),
602                 ('MEGA', "Mega", ""),
603                 ('SPLIT', "Split", ""),
604                 ),
605             update=devices_update_callback
606             )
607
608         cls.debug_opencl_device_type = EnumProperty(
609             name="OpenCL Device Type",
610             default='ALL',
611             items=(
612                 ('NONE', "None", ""),
613                 ('ALL', "All", ""),
614                 ('DEFAULT', "Default", ""),
615                 ('CPU', "CPU", ""),
616                 ('GPU', "GPU", ""),
617                 ('ACCELERATOR', "Accelerator", ""),
618                 ),
619             update=devices_update_callback
620             )
621
622         cls.debug_use_opencl_debug = BoolProperty(name="Debug OpenCL", default=False)
623
624     @classmethod
625     def unregister(cls):
626         del bpy.types.Scene.cycles
627
628
629 class CyclesCameraSettings(bpy.types.PropertyGroup):
630     @classmethod
631     def register(cls):
632         import math
633
634         bpy.types.Camera.cycles = PointerProperty(
635                 name="Cycles Camera Settings",
636                 description="Cycles camera settings",
637                 type=cls,
638                 )
639
640         cls.aperture_type = EnumProperty(
641                 name="Aperture Type",
642                 description="Use f-stop number or aperture radius",
643                 items=enum_aperture_types,
644                 default='RADIUS',
645                 )
646         cls.aperture_fstop = FloatProperty(
647                 name="Aperture f-stop",
648                 description="F-stop ratio (lower numbers give more defocus, higher numbers give a sharper image)",
649                 min=0.0, soft_min=0.1, soft_max=64.0,
650                 default=5.6,
651                 step=10,
652                 precision=1,
653                 )
654         cls.aperture_size = FloatProperty(
655                 name="Aperture Size",
656                 description="Radius of the aperture for depth of field (higher values give more defocus)",
657                 min=0.0, soft_max=10.0,
658                 default=0.0,
659                 step=1,
660                 precision=4,
661                 subtype='DISTANCE',
662                 )
663         cls.aperture_blades = IntProperty(
664                 name="Aperture Blades",
665                 description="Number of blades in aperture for polygonal bokeh (at least 3)",
666                 min=0, max=100,
667                 default=0,
668                 )
669         cls.aperture_rotation = FloatProperty(
670                 name="Aperture Rotation",
671                 description="Rotation of blades in aperture",
672                 soft_min=-math.pi, soft_max=math.pi,
673                 subtype='ANGLE',
674                 default=0,
675                 )
676         cls.aperture_ratio = FloatProperty(
677                 name="Aperture Ratio",
678                 description="Distortion to simulate anamorphic lens bokeh",
679                 min=0.01, soft_min=1.0, soft_max=2.0,
680                 default=1.0,
681                 precision=4,
682                 )
683         cls.panorama_type = EnumProperty(
684                 name="Panorama Type",
685                 description="Distortion to use for the calculation",
686                 items=enum_panorama_types,
687                 default='FISHEYE_EQUISOLID',
688                 )
689         cls.fisheye_fov = FloatProperty(
690                 name="Field of View",
691                 description="Field of view for the fisheye lens",
692                 min=0.1745, soft_max=2.0 * math.pi, max=10.0 * math.pi,
693                 subtype='ANGLE',
694                 default=math.pi,
695                 )
696         cls.fisheye_lens = FloatProperty(
697                 name="Fisheye Lens",
698                 description="Lens focal length (mm)",
699                 min=0.01, soft_max=15.0, max=100.0,
700                 default=10.5,
701                 )
702         cls.latitude_min = FloatProperty(
703                 name="Min Latitude",
704                 description="Minimum latitude (vertical angle) for the equirectangular lens",
705                 min=-0.5 * math.pi, max=0.5 * math.pi,
706                 subtype='ANGLE',
707                 default=-0.5 * math.pi,
708                 )
709         cls.latitude_max = FloatProperty(
710                 name="Max Latitude",
711                 description="Maximum latitude (vertical angle) for the equirectangular lens",
712                 min=-0.5 * math.pi, max=0.5 * math.pi,
713                 subtype='ANGLE',
714                 default=0.5 * math.pi,
715                 )
716         cls.longitude_min = FloatProperty(
717                 name="Min Longitude",
718                 description="Minimum longitude (horizontal angle) for the equirectangular lens",
719                 min=-math.pi, max=math.pi,
720                 subtype='ANGLE',
721                 default=-math.pi,
722                 )
723         cls.longitude_max = FloatProperty(
724                 name="Max Longitude",
725                 description="Maximum longitude (horizontal angle) for the equirectangular lens",
726                 min=-math.pi, max=math.pi,
727                 subtype='ANGLE',
728                 default=math.pi,
729                 )
730
731     @classmethod
732     def unregister(cls):
733         del bpy.types.Camera.cycles
734
735
736 class CyclesMaterialSettings(bpy.types.PropertyGroup):
737     @classmethod
738     def register(cls):
739         bpy.types.Material.cycles = PointerProperty(
740                 name="Cycles Material Settings",
741                 description="Cycles material settings",
742                 type=cls,
743                 )
744         cls.sample_as_light = BoolProperty(
745                 name="Multiple Importance Sample",
746                 description="Use multiple importance sampling for this material, "
747                             "disabling may reduce overall noise for large "
748                             "objects that emit little light compared to other light sources",
749                 default=True,
750                 )
751         cls.use_transparent_shadow = BoolProperty(
752                 name="Transparent Shadows",
753                 description="Use transparent shadows for this material if it contains a Transparent BSDF, "
754                             "disabling will render faster but not give accurate shadows",
755                 default=True,
756                 )
757         cls.homogeneous_volume = BoolProperty(
758                 name="Homogeneous Volume",
759                 description="When using volume rendering, assume volume has the same density everywhere "
760                             "(not using any textures), for faster rendering",
761                 default=False,
762                 )
763         cls.volume_sampling = EnumProperty(
764                 name="Volume Sampling",
765                 description="Sampling method to use for volumes",
766                 items=enum_volume_sampling,
767                 default='MULTIPLE_IMPORTANCE',
768                 )
769
770         cls.volume_interpolation = EnumProperty(
771                 name="Volume Interpolation",
772                 description="Interpolation method to use for smoke/fire volumes",
773                 items=enum_volume_interpolation,
774                 default='LINEAR',
775                 )
776
777     @classmethod
778     def unregister(cls):
779         del bpy.types.Material.cycles
780
781
782 class CyclesLampSettings(bpy.types.PropertyGroup):
783     @classmethod
784     def register(cls):
785         bpy.types.Lamp.cycles = PointerProperty(
786                 name="Cycles Lamp Settings",
787                 description="Cycles lamp settings",
788                 type=cls,
789                 )
790         cls.cast_shadow = BoolProperty(
791                 name="Cast Shadow",
792                 description="Lamp casts shadows",
793                 default=True,
794                 )
795         cls.samples = IntProperty(
796                 name="Samples",
797                 description="Number of light samples to render for each AA sample",
798                 min=1, max=10000,
799                 default=1,
800                 )
801         cls.max_bounces = IntProperty(
802                 name="Max Bounces",
803                 description="Maximum number of bounces the light will contribute to the render",
804                 min=0, max=1024,
805                 default=1024,
806                 )
807         cls.use_multiple_importance_sampling = BoolProperty(
808                 name="Multiple Importance Sample",
809                 description="Use multiple importance sampling for the lamp, "
810                             "reduces noise for area lamps and sharp glossy materials",
811                 default=True,
812                 )
813         cls.is_portal = BoolProperty(
814                 name="Is Portal",
815                 description="Use this area lamp to guide sampling of the background, "
816                             "note that this will make the lamp invisible",
817                 default=False,
818                 )
819
820     @classmethod
821     def unregister(cls):
822         del bpy.types.Lamp.cycles
823
824
825 class CyclesWorldSettings(bpy.types.PropertyGroup):
826     @classmethod
827     def register(cls):
828         bpy.types.World.cycles = PointerProperty(
829                 name="Cycles World Settings",
830                 description="Cycles world settings",
831                 type=cls,
832                 )
833         cls.sample_as_light = BoolProperty(
834                 name="Multiple Importance Sample",
835                 description="Use multiple importance sampling for the environment, "
836                             "enabling for non-solid colors is recommended",
837                 default=True,
838                 )
839         cls.sample_map_resolution = IntProperty(
840                 name="Map Resolution",
841                 description="Importance map size is resolution x resolution; "
842                             "higher values potentially produce less noise, at the cost of memory and speed",
843                 min=4, max=8192,
844                 default=1024,
845                 )
846         cls.samples = IntProperty(
847                 name="Samples",
848                 description="Number of light samples to render for each AA sample",
849                 min=1, max=10000,
850                 default=1,
851                 )
852         cls.max_bounces = IntProperty(
853                 name="Max Bounces",
854                 description="Maximum number of bounces the background light will contribute to the render",
855                 min=0, max=1024,
856                 default=1024,
857                 )
858         cls.homogeneous_volume = BoolProperty(
859                 name="Homogeneous Volume",
860                 description="When using volume rendering, assume volume has the same density everywhere"
861                             "(not using any textures), for faster rendering",
862                 default=False,
863                 )
864         cls.volume_sampling = EnumProperty(
865                 name="Volume Sampling",
866                 description="Sampling method to use for volumes",
867                 items=enum_volume_sampling,
868                 default='EQUIANGULAR',
869                 )
870
871         cls.volume_interpolation = EnumProperty(
872                 name="Volume Interpolation",
873                 description="Interpolation method to use for volumes",
874                 items=enum_volume_interpolation,
875                 default='LINEAR',
876                 )
877
878     @classmethod
879     def unregister(cls):
880         del bpy.types.World.cycles
881
882
883 class CyclesVisibilitySettings(bpy.types.PropertyGroup):
884     @classmethod
885     def register(cls):
886         bpy.types.Object.cycles_visibility = PointerProperty(
887                 name="Cycles Visibility Settings",
888                 description="Cycles visibility settings",
889                 type=cls,
890                 )
891
892         bpy.types.World.cycles_visibility = PointerProperty(
893                 name="Cycles Visibility Settings",
894                 description="Cycles visibility settings",
895                 type=cls,
896                 )
897
898         cls.camera = BoolProperty(
899                 name="Camera",
900                 description="Object visibility for camera rays",
901                 default=True,
902                 )
903         cls.diffuse = BoolProperty(
904                 name="Diffuse",
905                 description="Object visibility for diffuse reflection rays",
906                 default=True,
907                 )
908         cls.glossy = BoolProperty(
909                 name="Glossy",
910                 description="Object visibility for glossy reflection rays",
911                 default=True,
912                 )
913         cls.transmission = BoolProperty(
914                 name="Transmission",
915                 description="Object visibility for transmission rays",
916                 default=True,
917                 )
918         cls.shadow = BoolProperty(
919                 name="Shadow",
920                 description="Object visibility for shadow rays",
921                 default=True,
922                 )
923         cls.scatter = BoolProperty(
924                 name="Volume Scatter",
925                 description="Object visibility for volume scatter rays",
926                 default=True,
927                 )
928
929     @classmethod
930     def unregister(cls):
931         del bpy.types.Object.cycles_visibility
932         del bpy.types.World.cycles_visibility
933
934
935 class CyclesMeshSettings(bpy.types.PropertyGroup):
936     @classmethod
937     def register(cls):
938         bpy.types.Mesh.cycles = PointerProperty(
939                 name="Cycles Mesh Settings",
940                 description="Cycles mesh settings",
941                 type=cls,
942                 )
943         bpy.types.Curve.cycles = PointerProperty(
944                 name="Cycles Mesh Settings",
945                 description="Cycles mesh settings",
946                 type=cls,
947                 )
948         bpy.types.MetaBall.cycles = PointerProperty(
949                 name="Cycles Mesh Settings",
950                 description="Cycles mesh settings",
951                 type=cls,
952                 )
953
954         cls.displacement_method = EnumProperty(
955                 name="Displacement Method",
956                 description="Method to use for the displacement",
957                 items=enum_displacement_methods,
958                 default='BUMP',
959                 )
960         cls.subdivision_type = EnumProperty(
961                 name="Subdivision Type",
962                 description="Type of subdivision to use",
963                 items=enum_subdivision_types,
964                 default='NONE',
965                 )
966         cls.dicing_rate = FloatProperty(
967                 name="Dicing Rate",
968                 description="Multiplier for scene dicing rate",
969                 min=0.1, max=1000.0,
970                 default=1.0,
971                 )
972
973     @classmethod
974     def unregister(cls):
975         del bpy.types.Mesh.cycles
976         del bpy.types.Curve.cycles
977         del bpy.types.MetaBall.cycles
978
979
980 class CyclesObjectBlurSettings(bpy.types.PropertyGroup):
981
982     @classmethod
983     def register(cls):
984
985         bpy.types.Object.cycles = PointerProperty(
986                 name="Cycles Object Settings",
987                 description="Cycles object settings",
988                 type=cls,
989                 )
990
991         cls.use_motion_blur = BoolProperty(
992                 name="Use Motion Blur",
993                 description="Use motion blur for this object",
994                 default=True,
995                 )
996
997         cls.use_deform_motion = BoolProperty(
998                 name="Use Deformation Motion",
999                 description="Use deformation motion blur for this object",
1000                 default=True,
1001                 )
1002
1003         cls.motion_steps = IntProperty(
1004                 name="Motion Steps",
1005                 description="Control accuracy of deformation motion blur, more steps gives more memory usage (actual number of steps is 2^(steps - 1))",
1006                 min=1, soft_max=8,
1007                 default=1,
1008                 )
1009
1010         cls.use_camera_cull = BoolProperty(
1011                 name="Use Camera Cull",
1012                 description="Allow this object and its duplicators to be culled by camera space culling",
1013                 default=False,
1014                 )
1015
1016     @classmethod
1017     def unregister(cls):
1018         del bpy.types.Object.cycles
1019
1020
1021 class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
1022     @classmethod
1023     def register(cls):
1024         bpy.types.Scene.cycles_curves = PointerProperty(
1025                 name="Cycles Hair Rendering Settings",
1026                 description="Cycles hair rendering settings",
1027                 type=cls,
1028                 )
1029         cls.primitive = EnumProperty(
1030                 name="Primitive",
1031                 description="Type of primitive used for hair rendering",
1032                 items=enum_curve_primitives,
1033                 default='LINE_SEGMENTS',
1034                 )
1035         cls.shape = EnumProperty(
1036                 name="Shape",
1037                 description="Form of hair",
1038                 items=enum_curve_shape,
1039                 default='THICK',
1040                 )
1041         cls.cull_backfacing = BoolProperty(
1042                 name="Cull back-faces",
1043                 description="Do not test the back-face of each strand",
1044                 default=True,
1045                 )
1046         cls.use_curves = BoolProperty(
1047                 name="Use Cycles Hair Rendering",
1048                 description="Activate Cycles hair rendering for particle system",
1049                 default=True,
1050                 )
1051         cls.resolution = IntProperty(
1052                 name="Resolution",
1053                 description="Resolution of generated mesh",
1054                 min=3, max=64,
1055                 default=3,
1056                 )
1057         cls.minimum_width = FloatProperty(
1058                 name="Minimal width",
1059                 description="Minimal pixel width for strands (0 - deactivated)",
1060                 min=0.0, max=100.0,
1061                 default=0.0,
1062                 )
1063         cls.maximum_width = FloatProperty(
1064                 name="Maximal width",
1065                 description="Maximum extension that strand radius can be increased by",
1066                 min=0.0, max=100.0,
1067                 default=0.1,
1068                 )
1069         cls.subdivisions = IntProperty(
1070                 name="Subdivisions",
1071                 description="Number of subdivisions used in Cardinal curve intersection (power of 2)",
1072                 min=0, max=24,
1073                 default=4,
1074                 )
1075
1076     @classmethod
1077     def unregister(cls):
1078         del bpy.types.Scene.cycles_curves
1079
1080
1081 class CyclesCurveSettings(bpy.types.PropertyGroup):
1082     @classmethod
1083     def register(cls):
1084         bpy.types.ParticleSettings.cycles = PointerProperty(
1085                 name="Cycles Hair Settings",
1086                 description="Cycles hair settings",
1087                 type=cls,
1088                 )
1089         cls.radius_scale = FloatProperty(
1090                 name="Radius Scaling",
1091                 description="Multiplier of width properties",
1092                 min=0.0, max=1000.0,
1093                 default=0.01,
1094                 )
1095         cls.root_width = FloatProperty(
1096                 name="Root Size",
1097                 description="Strand's width at root",
1098                 min=0.0, max=1000.0,
1099                 default=1.0,
1100                 )
1101         cls.tip_width = FloatProperty(
1102                 name="Tip Multiplier",
1103                 description="Strand's width at tip",
1104                 min=0.0, max=1000.0,
1105                 default=0.0,
1106                 )
1107         cls.shape = FloatProperty(
1108                 name="Strand Shape",
1109                 description="Strand shape parameter",
1110                 min=-1.0, max=1.0,
1111                 default=0.0,
1112                 )
1113         cls.use_closetip = BoolProperty(
1114                 name="Close tip",
1115                 description="Set tip radius to zero",
1116                 default=True,
1117                 )
1118
1119     @classmethod
1120     def unregister(cls):
1121         del bpy.types.ParticleSettings.cycles
1122
1123
1124 def register():
1125     bpy.utils.register_class(CyclesRenderSettings)
1126     bpy.utils.register_class(CyclesCameraSettings)
1127     bpy.utils.register_class(CyclesMaterialSettings)
1128     bpy.utils.register_class(CyclesLampSettings)
1129     bpy.utils.register_class(CyclesWorldSettings)
1130     bpy.utils.register_class(CyclesVisibilitySettings)
1131     bpy.utils.register_class(CyclesMeshSettings)
1132     bpy.utils.register_class(CyclesCurveRenderSettings)
1133     bpy.utils.register_class(CyclesCurveSettings)
1134
1135
1136 def unregister():
1137     bpy.utils.unregister_class(CyclesRenderSettings)
1138     bpy.utils.unregister_class(CyclesCameraSettings)
1139     bpy.utils.unregister_class(CyclesMaterialSettings)
1140     bpy.utils.unregister_class(CyclesLampSettings)
1141     bpy.utils.unregister_class(CyclesWorldSettings)
1142     bpy.utils.unregister_class(CyclesMeshSettings)
1143     bpy.utils.unregister_class(CyclesVisibilitySettings)
1144     bpy.utils.unregister_class(CyclesCurveRenderSettings)
1145     bpy.utils.unregister_class(CyclesCurveSettings)