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