Skip to content

Instantly share code, notes, and snippets.

@Naxela
Created May 6, 2021 11:53
Show Gist options
  • Save Naxela/4a3a5e9172cade23e0e1f663c155490e to your computer and use it in GitHub Desktop.
Save Naxela/4a3a5e9172cade23e0e1f663c155490e to your computer and use it in GitHub Desktop.
The Lightmapper - Batch denoising
import bpy, thelightmapper, os
from os import listdir
from os.path import isfile, join
baked_image_array = []
#1. UNCOMMENT THIS IF YOU WANT TO POINT TO IT MANUALLY
#bpy.context.scene.TLM_EngineProperties.tlm_lightmap_savedir = "C:/PATH/TO/DENOISER/BINARY"
dirpath = os.path.join(os.path.dirname(bpy.data.filepath), bpy.context.scene.TLM_EngineProperties.tlm_lightmap_savedir)
dirfiles = [f for f in listdir(dirpath) if isfile(join(dirpath, f))]
for file in dirfiles:
if file.endswith("_baked.hdr"):
baked_image_array.append(file)
oidnProperties = bpy.context.scene.TLM_OIDNEngineProperties
denoiser = thelightmapper.addon.utility.denoiser.oidn.TLM_OIDN_Denoise(oidnProperties, baked_image_array, dirpath)
denoiser.denoise()
denoiser.clean()
#2. Afterwards you can just run the Load Lightmaps function from the same folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment