2 # Copyright 2011-2013 Blender Foundation
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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
20 from bpy.props import (BoolProperty,
31 ('CPU', "CPU", "Use CPU for rendering"),
32 ('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in user preferences"),
35 if _cycles.with_network:
36 enum_devices += (('NETWORK', "Networked Device", "Use networked device for rendering"),)
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"),
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"),
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"),
55 ('BOX', "Box", "Box filter"),
56 ('GAUSSIAN', "Gaussian", "Gaussian filter"),
59 enum_aperture_types = (
60 ('RADIUS', "Radius", "Directly change the size of the aperture"),
61 ('FSTOP', "F/stop", "Change the size of the aperture by f/stops"),
64 enum_panorama_types = (
65 ('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
66 ('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
67 ('FISHEYE_EQUISOLID', "Fisheye Equisolid",
68 "Similar to most fisheye modern lens, takes sensor dimensions into consideration"),
71 enum_curve_primitives = (
72 ('TRIANGLES', "Triangles", "Create triangle geometry around strands"),
73 ('LINE_SEGMENTS', "Line Segments", "Use line segment primitives"),
74 ('CURVE_SEGMENTS', "Curve Segments", "Use segmented cardinal curve primitives"),
77 enum_triangle_curves = (
78 ('CAMERA_TRIANGLES', "Planes", "Create individual triangles forming planes that face camera"),
79 ('TESSELLATED_TRIANGLES', "Tessellated", "Create mesh surrounding each strand"),
83 ('RIBBONS', "Ribbons", "Ignore thickness of each strand"),
84 ('THICK', "Thick", "Use thickness of strand when rendering"),
88 ('CENTER', "Center", "Render from center to the edges"),
89 ('RIGHT_TO_LEFT', "Right to Left", "Render from right to left"),
90 ('LEFT_TO_RIGHT', "Left to Right", "Render from left to right"),
91 ('TOP_TO_BOTTOM', "Top to Bottom", "Render from top to bottom"),
92 ('BOTTOM_TO_TOP', "Bottom to Top", "Render from bottom to top"),
95 enum_use_layer_samples = (
96 ('USE', "Use", "Per render layer number of samples override scene samples"),
97 ('BOUNDED', "Bounded", "Bound per render layer number of samples by global samples"),
98 ('IGNORE', "Ignore", "Ignore per render layer number of samples"),
101 enum_sampling_pattern = (
102 ('SOBOL', "Sobol", "Use Sobol random sampling pattern"),
103 ('CORRELATED_MUTI_JITTER', "Correlated Multi-Jitter", "Use Correlated Multi-Jitter random sampling pattern"),
107 ('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"),
108 ('PATH', "Path Tracing", "Pure path tracing integrator"),
111 enum_volume_homogeneous_sampling = (
112 ('DISTANCE', "Distance", "Use Distance Sampling"),
113 ('EQUI_ANGULAR', "Equi-angular", "Use Equi-angular Sampling"),
117 class CyclesRenderSettings(bpy.types.PropertyGroup):
120 bpy.types.Scene.cycles = PointerProperty(
121 name="Cycles Render Settings",
122 description="Cycles render settings",
125 cls.device = EnumProperty(
127 description="Device to use for rendering",
131 cls.feature_set = EnumProperty(
133 description="Feature set to use for rendering",
134 items=enum_feature_set,
137 cls.shading_system = BoolProperty(
138 name="Open Shading Language",
139 description="Use Open Shading Language (CPU rendering only)",
142 cls.progressive = EnumProperty(
144 description="Method to sample lights and materials",
145 items=enum_integrator,
149 cls.volume_homogeneous_sampling = EnumProperty(
150 name="Homogeneous Sampling",
151 description="Sampling method to use for homogeneous volumes",
152 items=enum_volume_homogeneous_sampling,
156 cls.use_square_samples = BoolProperty(
157 name="Square Samples",
158 description="Square sampling values for easier artist control",
162 cls.samples = IntProperty(
164 description="Number of samples to render for each pixel",
165 min=1, max=2147483647,
168 cls.preview_samples = IntProperty(
169 name="Preview Samples",
170 description="Number of samples to render in the viewport, unlimited if 0",
171 min=0, max=2147483647,
174 cls.preview_pause = BoolProperty(
175 name="Pause Preview",
176 description="Pause all viewport preview renders",
179 cls.preview_active_layer = BoolProperty(
180 name="Preview Active Layer",
181 description="Preview active render layer in viewport",
185 cls.aa_samples = IntProperty(
187 description="Number of antialiasing samples to render for each pixel",
191 cls.preview_aa_samples = IntProperty(
193 description="Number of antialiasing samples to render in the viewport, unlimited if 0",
197 cls.diffuse_samples = IntProperty(
198 name="Diffuse Samples",
199 description="Number of diffuse bounce samples to render for each AA sample",
203 cls.glossy_samples = IntProperty(
204 name="Glossy Samples",
205 description="Number of glossy bounce samples to render for each AA sample",
209 cls.transmission_samples = IntProperty(
210 name="Transmission Samples",
211 description="Number of transmission bounce samples to render for each AA sample",
215 cls.ao_samples = IntProperty(
216 name="Ambient Occlusion Samples",
217 description="Number of ambient occlusion samples to render for each AA sample",
221 cls.mesh_light_samples = IntProperty(
222 name="Mesh Light Samples",
223 description="Number of mesh emission light samples to render for each AA sample",
228 cls.subsurface_samples = IntProperty(
229 name="Subsurface Samples",
230 description="Number of subsurface scattering samples to render for each AA sample",
235 cls.volume_samples = IntProperty(
236 name="Volume Samples",
237 description="Number of volume scattering samples to render for each AA sample",
242 cls.sampling_pattern = EnumProperty(
243 name="Sampling Pattern",
244 description="Random sampling pattern used by the integrator",
245 items=enum_sampling_pattern,
249 cls.use_layer_samples = EnumProperty(
250 name="Layer Samples",
251 description="How to use per render layer sample settings",
252 items=enum_use_layer_samples,
255 cls.sample_all_lights_indirect = BoolProperty(
256 name="Sample All Lights",
257 description="Sample all lights (for indirect samples), rather than randomly picking one",
261 cls.no_caustics = BoolProperty(
263 description="Leave out caustics, resulting in a darker image with less noise",
266 cls.blur_glossy = FloatProperty(
267 name="Filter Glossy",
268 description="Adaptively blur glossy shaders after blurry bounces, "
269 "to reduce noise at the cost of accuracy",
274 cls.min_bounces = IntProperty(
276 description="Minimum number of bounces, setting this lower "
277 "than the maximum enables probabilistic path "
278 "termination (faster but noisier)",
282 cls.max_bounces = IntProperty(
284 description="Total maximum number of bounces",
289 cls.diffuse_bounces = IntProperty(
290 name="Diffuse Bounces",
291 description="Maximum number of diffuse reflection bounces, bounded by total maximum",
295 cls.glossy_bounces = IntProperty(
296 name="Glossy Bounces",
297 description="Maximum number of glossy reflection bounces, bounded by total maximum",
301 cls.transmission_bounces = IntProperty(
302 name="Transmission Bounces",
303 description="Maximum number of transmission bounces, bounded by total maximum",
307 cls.volume_bounces = IntProperty(
308 name="Volume Bounces",
309 description="Maximum number of volumetric scattering events",
314 cls.transparent_min_bounces = IntProperty(
315 name="Transparent Min Bounces",
316 description="Minimum number of transparent bounces, setting "
317 "this lower than the maximum enables "
318 "probabilistic path termination (faster but "
323 cls.transparent_max_bounces = IntProperty(
324 name="Transparent Max Bounces",
325 description="Maximum number of transparent bounces",
329 cls.use_transparent_shadows = BoolProperty(
330 name="Transparent Shadows",
331 description="Use transparency of surfaces for rendering shadows",
335 cls.volume_step_size = FloatProperty(
337 description="Distance between volume shader samples when rendering the volume "
338 "(lower values give more accurate and detailed results, but also increased render time)",
340 min=0.0000001, max=100000.0
343 cls.volume_max_steps = IntProperty(
345 description="Maximum number of steps through the volume before giving up, "
346 "to avoid extremely long render times with big objects or small step sizes",
351 cls.film_exposure = FloatProperty(
353 description="Image brightness scale",
357 cls.film_transparent = BoolProperty(
359 description="World background is transparent with premultiplied alpha",
363 cls.filter_type = EnumProperty(
365 description="Pixel filter type",
366 items=enum_filter_types,
369 cls.filter_width = FloatProperty(
371 description="Pixel filter width",
376 cls.seed = IntProperty(
378 description="Seed value for integrator to get different noise patterns",
379 min=0, max=2147483647,
383 cls.sample_clamp_direct = FloatProperty(
385 description="If non-zero, the maximum value for a direct sample, "
386 "higher values will be scaled down to avoid too "
387 "much noise and slow convergence at the cost of accuracy",
392 cls.sample_clamp_indirect = FloatProperty(
393 name="Clamp Indirect",
394 description="If non-zero, the maximum value for an indirect sample, "
395 "higher values will be scaled down to avoid too "
396 "much noise and slow convergence at the cost of accuracy",
401 cls.debug_tile_size = IntProperty(
408 cls.preview_start_resolution = IntProperty(
409 name="Start Resolution",
410 description="Resolution to start rendering preview at, "
411 "progressively increasing it to the full viewport size",
416 cls.debug_reset_timeout = FloatProperty(
417 name="Reset timeout",
422 cls.debug_cancel_timeout = FloatProperty(
423 name="Cancel timeout",
428 cls.debug_text_timeout = FloatProperty(
435 cls.debug_bvh_type = EnumProperty(
436 name="Viewport BVH Type",
437 description="Choose between faster updates, or faster render",
438 items=enum_bvh_types,
439 default='DYNAMIC_BVH',
441 cls.debug_use_spatial_splits = BoolProperty(
442 name="Use Spatial Splits",
443 description="Use BVH spatial splits: longer builder time, faster render",
446 cls.use_cache = BoolProperty(
448 description="Cache last built BVH to disk for faster re-render if no geometry changed",
451 cls.tile_order = EnumProperty(
453 description="Tile order for rendering",
454 items=enum_tile_order,
456 options=set(), # Not animatable!
458 cls.use_progressive_refine = BoolProperty(
459 name="Progressive Refine",
460 description="Instead of rendering each tile until it is finished, "
461 "refine the whole image progressively "
462 "(this renders somewhat slower, "
463 "but time can be saved by manually stopping the render when the noise is low enough)",
469 del bpy.types.Scene.cycles
472 class CyclesCameraSettings(bpy.types.PropertyGroup):
477 bpy.types.Camera.cycles = PointerProperty(
478 name="Cycles Camera Settings",
479 description="Cycles camera settings",
483 cls.aperture_type = EnumProperty(
484 name="Aperture Type",
485 description="Use F/stop number or aperture radius",
486 items=enum_aperture_types,
489 cls.aperture_fstop = FloatProperty(
490 name="Aperture F/stop",
491 description="F/stop ratio (lower numbers give more defocus, higher numbers give a sharper image)",
492 min=0.0, soft_min=0.1, soft_max=64.0,
497 cls.aperture_size = FloatProperty(
498 name="Aperture Size",
499 description="Radius of the aperture for depth of field (higher values give more defocus)",
500 min=0.0, soft_max=10.0,
506 cls.aperture_blades = IntProperty(
507 name="Aperture Blades",
508 description="Number of blades in aperture for polygonal bokeh (at least 3)",
512 cls.aperture_rotation = FloatProperty(
513 name="Aperture Rotation",
514 description="Rotation of blades in aperture",
515 soft_min=-math.pi, soft_max=math.pi,
519 cls.panorama_type = EnumProperty(
520 name="Panorama Type",
521 description="Distortion to use for the calculation",
522 items=enum_panorama_types,
523 default='FISHEYE_EQUISOLID',
525 cls.fisheye_fov = FloatProperty(
526 name="Field of View",
527 description="Field of view for the fisheye lens",
528 min=0.1745, soft_max=2.0 * math.pi, max=10.0 * math.pi,
532 cls.fisheye_lens = FloatProperty(
534 description="Lens focal length (mm)",
535 min=0.01, soft_max=15.0, max=100.0,
541 del bpy.types.Camera.cycles
544 class CyclesMaterialSettings(bpy.types.PropertyGroup):
547 bpy.types.Material.cycles = PointerProperty(
548 name="Cycles Material Settings",
549 description="Cycles material settings",
552 cls.sample_as_light = BoolProperty(
553 name="Multiple Importance Sample",
554 description="Use multiple importance sampling for this material, "
555 "disabling may reduce overall noise for large "
556 "objects that emit little light compared to other light sources",
559 cls.use_transparent_shadow = BoolProperty(
560 name="Transparent Shadows",
561 description="Use transparent shadows for this material if it contains a Transparent BSDF, "
562 "disabling will render faster but not give accurate shadows",
565 cls.homogeneous_volume = BoolProperty(
566 name="Homogeneous Volume",
567 description="When using volume rendering, assume volume has the same density everywhere "
568 "(not using any textures), for faster rendering",
574 del bpy.types.Material.cycles
577 class CyclesLampSettings(bpy.types.PropertyGroup):
580 bpy.types.Lamp.cycles = PointerProperty(
581 name="Cycles Lamp Settings",
582 description="Cycles lamp settings",
585 cls.cast_shadow = BoolProperty(
587 description="Lamp casts shadows",
590 cls.samples = IntProperty(
592 description="Number of light samples to render for each AA sample",
596 cls.use_multiple_importance_sampling = BoolProperty(
597 name="Multiple Importance Sample",
598 description="Use multiple importance sampling for the lamp, "
599 "reduces noise for area lamps and sharp glossy materials",
605 del bpy.types.Lamp.cycles
608 class CyclesWorldSettings(bpy.types.PropertyGroup):
611 bpy.types.World.cycles = PointerProperty(
612 name="Cycles World Settings",
613 description="Cycles world settings",
616 cls.sample_as_light = BoolProperty(
617 name="Multiple Importance Sample",
618 description="Use multiple importance sampling for the environment, "
619 "enabling for non-solid colors is recommended",
622 cls.sample_map_resolution = IntProperty(
623 name="Map Resolution",
624 description="Importance map size is resolution x resolution; "
625 "higher values potentially produce less noise, at the cost of memory and speed",
629 cls.samples = IntProperty(
631 description="Number of light samples to render for each AA sample",
635 cls.homogeneous_volume = BoolProperty(
636 name="Homogeneous Volume",
637 description="When using volume rendering, assume volume has the same density everywhere"
638 "(not using any textures), for faster rendering",
644 del bpy.types.World.cycles
647 class CyclesVisibilitySettings(bpy.types.PropertyGroup):
650 bpy.types.Object.cycles_visibility = PointerProperty(
651 name="Cycles Visibility Settings",
652 description="Cycles visibility settings",
656 bpy.types.World.cycles_visibility = PointerProperty(
657 name="Cycles Visibility Settings",
658 description="Cycles visibility settings",
662 cls.camera = BoolProperty(
664 description="Object visibility for camera rays",
667 cls.diffuse = BoolProperty(
669 description="Object visibility for diffuse reflection rays",
672 cls.glossy = BoolProperty(
674 description="Object visibility for glossy reflection rays",
677 cls.transmission = BoolProperty(
679 description="Object visibility for transmission rays",
682 cls.shadow = BoolProperty(
684 description="Object visibility for shadow rays",
690 del bpy.types.Object.cycles_visibility
691 del bpy.types.World.cycles_visibility
694 class CyclesMeshSettings(bpy.types.PropertyGroup):
697 bpy.types.Mesh.cycles = PointerProperty(
698 name="Cycles Mesh Settings",
699 description="Cycles mesh settings",
702 bpy.types.Curve.cycles = PointerProperty(
703 name="Cycles Mesh Settings",
704 description="Cycles mesh settings",
707 bpy.types.MetaBall.cycles = PointerProperty(
708 name="Cycles Mesh Settings",
709 description="Cycles mesh settings",
713 cls.displacement_method = EnumProperty(
714 name="Displacement Method",
715 description="Method to use for the displacement",
716 items=enum_displacement_methods,
719 cls.use_subdivision = BoolProperty(
720 name="Use Subdivision",
721 description="Subdivide mesh for rendering",
724 cls.dicing_rate = FloatProperty(
727 min=0.001, max=1000.0,
733 del bpy.types.Mesh.cycles
734 del bpy.types.Curve.cycles
735 del bpy.types.MetaBall.cycles
738 class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
741 bpy.types.Scene.cycles_curves = PointerProperty(
742 name="Cycles Hair Rendering Settings",
743 description="Cycles hair rendering settings",
746 cls.primitive = EnumProperty(
748 description="Type of primitive used for hair rendering",
749 items=enum_curve_primitives,
750 default='LINE_SEGMENTS',
752 cls.shape = EnumProperty(
754 description="Form of hair",
755 items=enum_curve_shape,
758 cls.cull_backfacing = BoolProperty(
759 name="Cull back-faces",
760 description="Do not test the back-face of each strand",
763 cls.use_curves = BoolProperty(
764 name="Use Cycles Hair Rendering",
765 description="Activate Cycles hair rendering for particle system",
768 cls.resolution = IntProperty(
770 description="Resolution of generated mesh",
774 cls.minimum_width = FloatProperty(
775 name="Minimal width",
776 description="Minimal pixel width for strands (0 - deactivated)",
780 cls.maximum_width = FloatProperty(
781 name="Maximal width",
782 description="Maximum extension that strand radius can be increased by",
786 cls.subdivisions = IntProperty(
788 description="Number of subdivisions used in Cardinal curve intersection (power of 2)",
795 del bpy.types.Scene.cycles_curves
798 class CyclesCurveSettings(bpy.types.PropertyGroup):
801 bpy.types.ParticleSettings.cycles = PointerProperty(
802 name="Cycles Hair Settings",
803 description="Cycles hair settings",
806 cls.radius_scale = FloatProperty(
807 name="Radius Scaling",
808 description="Multiplier of width properties",
812 cls.root_width = FloatProperty(
814 description="Strand's width at root",
818 cls.tip_width = FloatProperty(
819 name="Tip Multiplier",
820 description="Strand's width at tip",
824 cls.shape = FloatProperty(
826 description="Strand shape parameter",
830 cls.use_closetip = BoolProperty(
832 description="Set tip radius to zero",
838 del bpy.types.ParticleSettings.cycles
842 bpy.utils.register_class(CyclesRenderSettings)
843 bpy.utils.register_class(CyclesCameraSettings)
844 bpy.utils.register_class(CyclesMaterialSettings)
845 bpy.utils.register_class(CyclesLampSettings)
846 bpy.utils.register_class(CyclesWorldSettings)
847 bpy.utils.register_class(CyclesVisibilitySettings)
848 bpy.utils.register_class(CyclesMeshSettings)
849 bpy.utils.register_class(CyclesCurveRenderSettings)
850 bpy.utils.register_class(CyclesCurveSettings)
854 bpy.utils.unregister_class(CyclesRenderSettings)
855 bpy.utils.unregister_class(CyclesCameraSettings)
856 bpy.utils.unregister_class(CyclesMaterialSettings)
857 bpy.utils.unregister_class(CyclesLampSettings)
858 bpy.utils.unregister_class(CyclesWorldSettings)
859 bpy.utils.unregister_class(CyclesMeshSettings)
860 bpy.utils.unregister_class(CyclesVisibilitySettings)
861 bpy.utils.unregister_class(CyclesCurveRenderSettings)
862 bpy.utils.unregister_class(CyclesCurveSettings)