From f5c128dcd47fa3d3d2186cf640c9c01a34c7fa6c Mon Sep 17 00:00:00 2001 From: Cameron Cooke Date: Fri, 6 May 2022 18:22:06 +0200 Subject: [PATCH] Added options for METAL and OPTIX. --- utils/utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/utils/utils.py b/utils/utils.py index 9d5b427..d8216f7 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -115,6 +115,8 @@ def set_cycles_renderer(scene: bpy.types.Scene, use_motion_blur: bool = False, use_transparent_bg: bool = False, prefer_cuda_use: bool = True, + prefer_metal_use: bool = False, + prefer_optix_use: bool = False, use_adaptive_sampling: bool = False) -> None: scene.camera = camera_object @@ -136,6 +138,18 @@ def set_cycles_renderer(scene: bpy.types.Scene, # Change the preference setting bpy.context.preferences.addons["cycles"].preferences.compute_device_type = "CUDA" + if prefer_metal_use: + bpy.context.scene.cycles.device = "GPU" + + # Change the preference setting + bpy.context.preferences.addons["cycles"].preferences.compute_device_type = "METAL" + + if prefer_optix_use: + bpy.context.scene.cycles.device = "GPU" + + # Change the preference setting + bpy.context.preferences.addons["cycles"].preferences.compute_device_type = "OPTIX" + # Call get_devices() to let Blender detects GPU device (if any) bpy.context.preferences.addons["cycles"].preferences.get_devices()