The Lightmapper – Batch denoising

Home   »   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

Leave a Reply

Your email address will not be published. Required fields are marked *