[Blender Export][Adde] Option to disable the denoiser

- Enables the use of old hardware and Debian packages
- You must be extremelly patient

Closes #539
This commit is contained in:
Salvador E. Tropea 2024-01-02 13:30:49 -03:00
parent d074294ea6
commit a48d014541
5 changed files with 15 additions and 0 deletions

View File

@ -64,6 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Camera option to set the clip start (#484)
- Traceback dump when Blender output contains it
- Subdirectory for each output generated (#541)
- Option to disable the denoiser (#539)
- KiKit
- Expand text variables and KiBot %X markers in text objects (see #497)
- PCB Print:

View File

@ -265,6 +265,9 @@ outputs:
# [string='#CCCCE5'] Second color for the background gradient
background2: '#CCCCE5'
# `height` is an alias for `resolution_y`
# [boolean=false] Used to disable the render denoiser on old hardware, or when the functionality isn't compiled.
# Note that the impact in quality is huge, you should increase the amount of samples 10 times
no_denoiser: false
# [number=1280] Width of the image
resolution_x: 1280
# [number=720] Height of the image

View File

@ -97,6 +97,8 @@ Parameters:
- ``background1`` :index:`: <pair: output - blender_export - options - render_options; background1>` [string='#66667F'] First color for the background gradient.
- ``background2`` :index:`: <pair: output - blender_export - options - render_options; background2>` [string='#CCCCE5'] Second color for the background gradient.
- *height* :index:`: <pair: output - blender_export - options - render_options; height>` Alias for resolution_y.
- ``no_denoiser`` :index:`: <pair: output - blender_export - options - render_options; no_denoiser>` [boolean=false] Used to disable the render denoiser on old hardware, or when the functionality isn't compiled.
Note that the impact in quality is huge, you should increase the amount of samples 10 times.
- ``resolution_x`` :index:`: <pair: output - blender_export - options - render_options; resolution_x>` [number=1280] Width of the image.
- ``resolution_y`` :index:`: <pair: output - blender_export - options - render_options; resolution_y>` [number=720] Height of the image.
- *width* :index:`: <pair: output - blender_export - options - render_options; width>` Alias for resolution_x.

View File

@ -370,6 +370,8 @@ def main():
parser.add_argument("-m", "--pcb_material", type=str, choices=["RASTERIZED", "3D"], default="RASTERIZED",
help="Rasterized (Cycles) or 3D (deprecated) [RASTERIZED]")
parser.add_argument("-M", "--dont_merge_materials", action="store_false", help="do not merge materials")
parser.add_argument("-n", "--no_denoiser", action="store_true",
help="Disable the denoiser (poor quality, increase passes)")
parser.add_argument("-o", "--output", type=str, required=True, nargs='+', help="output file name, can be repeated")
parser.add_argument("-r", "--scene", type=str, help="JSON file containing camera, light and render options")
parser.add_argument("-s", "--solder_joints", type=str, choices=["NONE", "SMART", "ALL"], default="SMART",
@ -408,6 +410,8 @@ def main():
del ops["center_pcb"]
ops["center_boards"] = args.dont_center
bpy.ops.pcb2blender.import_pcb3d(**ops)
if args.no_denoiser:
bpy.context.scene.cycles.use_denoising = False
# Apply the scene first scene
c_views = apply_start_scene(args.scene)
c_formats = len(args.format)

View File

@ -197,6 +197,9 @@ class BlenderRenderOptions(Optionable):
self.auto_crop = False
""" When enabled the image will be post-processed to remove the empty space around the image.
In this mode the `background2` is changed to be the same as `background1` """
self.no_denoiser = False
""" Used to disable the render denoiser on old hardware, or when the functionality isn't compiled.
Note that the impact in quality is huge, you should increase the amount of samples 10 times """
self._unknown_is_error = True
@ -634,6 +637,8 @@ class Blender_ExportOptions(BaseOptions):
cmd.extend(['--solder_joints', pi.solder_joints])
if not pi.stack_boards:
cmd.append('--dont_stack_boards')
if self.render_options.no_denoiser:
cmd.append('--no_denoiser')
cmd.append('--format')
for pov in self.point_of_view:
for _ in range(pov.steps):