diff --git a/__pycache__/operators.cpython-311.pyc b/__pycache__/operators.cpython-311.pyc new file mode 100644 index 0000000..48a3edf Binary files /dev/null and b/__pycache__/operators.cpython-311.pyc differ diff --git a/__pycache__/panel.cpython-311.pyc b/__pycache__/panel.cpython-311.pyc new file mode 100644 index 0000000..c6a90f0 Binary files /dev/null and b/__pycache__/panel.cpython-311.pyc differ diff --git a/__pycache__/properties.cpython-311.pyc b/__pycache__/properties.cpython-311.pyc new file mode 100644 index 0000000..049ddfb Binary files /dev/null and b/__pycache__/properties.cpython-311.pyc differ diff --git a/operators.py b/operators.py index aa37f0a..8ae485f 100644 --- a/operators.py +++ b/operators.py @@ -111,7 +111,13 @@ class SCENERENDERER_OT_render_all(bpy.types.Operator): c = scene.cycles c.samples = 1 if settings["test_mode"] else settings["samples"] - + c.use_adaptive_sampling = settings["use_noise_threshold"] + if c.use_adaptive_sampling: + c.adaptive_threshold = settings["noise_threshold"] + c.use_denoising = settings["use_denoising"] + if hasattr(c, 'max_bounces'): + c.max_bounces = settings["max_bounces"] + if settings["exposure"] != 0.0: scene.view_settings.exposure = settings["exposure"] scene.cycles.film_exposure = 2.0 ** settings["exposure"] @@ -180,6 +186,10 @@ class SCENERENDERER_OT_render_all(bpy.types.Operator): "skip_existing": settings.skip_existing, "use_cpu": settings.use_cpu, "samples": settings.samples, + "use_noise_threshold": settings.use_noise_threshold, + "noise_threshold": settings.noise_threshold, + "use_denoising": settings.use_denoising, + "max_bounces": settings.max_bounces, "exposure": settings.exposure, "look": settings.look, } diff --git a/panel.py b/panel.py index 933e4dc..b86006f 100644 --- a/panel.py +++ b/panel.py @@ -17,7 +17,18 @@ class SCENERENDERER_PT_panel(bpy.types.Panel): row.prop(settings, "skip_existing", toggle=True) layout.prop(settings, "use_cpu") - layout.prop(settings, "samples") + box = layout.box() + box.label(text="Cycles Render", icon='SCENE_DATA') + box.prop(settings, "samples") + + row = box.row() + row.prop(settings, "use_noise_threshold", text="Noise Threshold") + sub = row.row() + sub.active = settings.use_noise_threshold + sub.prop(settings, "noise_threshold", text="") + + box.prop(settings, "use_denoising") + box.prop(settings, "max_bounces") box = layout.box() box.label(text="Color", icon='SHADING_RENDERED') diff --git a/properties.py b/properties.py index 465d799..c837f1f 100644 --- a/properties.py +++ b/properties.py @@ -22,6 +22,26 @@ class SceneRendererSettings(bpy.types.PropertyGroup): description="Cycles render samples", default=4096, min=1, max=65536, ) + use_noise_threshold: bpy.props.BoolProperty( + name="Use Noise Threshold", + description="Stop sampling when the noise is below this threshold", + default=True, + ) + noise_threshold: bpy.props.FloatProperty( + name="Noise Threshold", + description="Noise threshold for adaptive sampling", + default=0.01, min=0.0001, max=1.0, precision=4, + ) + use_denoising: bpy.props.BoolProperty( + name="Use Denoising", + description="Enable denoising for final render", + default=True, + ) + max_bounces: bpy.props.IntProperty( + name="Max Bounces", + description="Total maximum number of light bounces", + default=12, min=0, max=1024, + ) exposure: bpy.props.FloatProperty( name="Exposure", description="Exposure boost in stops",