mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
feat(ugc): denoise=oidn traces icons' occlusion per pixel and denoises it (optional build)
Intel Open Image Denoise 2 (Apache-2.0) behind the CMake option DLU_OIDN (off): an installed OIDN is used when found, else Intel's release package (pinned by hash) is downloaded and its libraries copied next to the servers. A denoiser only removes noise that differs from pixel to pixel; the icons' occlusion comes from the bake, per vertex, which it leaves as it is (checked: white noise 0.17 -> 0.006 relative spread, per-vertex blocks unchanged). So with denoise=oidn a model's icon is drawn from model.noao.nif (its colors before the bake) with its occlusion traced per pixel of the supersampled image (denoise_samples rays, default 4, with the bake's distance and strength and the ray backend), box filtered and denoised at the icon's size, guided by the colors and normals. The model keeps its baked occlusion. Icons drawn again from stored files use the stored model.noao.nif the same way. OIDN works on a thread of its own; its time is charged to the job's thread (UgcThrottle::Charge), so the CPU budget and the recorded CPU time include it. Check: configure with -DDLU_OIDN=ON; UgcServer --make-model x.lxfml out oidn and compare its icon.png with one made with off; an OFF build leaves icons as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
29
thirdparty/CMakeLists.txt
vendored
29
thirdparty/CMakeLists.txt
vendored
@@ -179,3 +179,32 @@ function(dlu_fetch_embree)
|
||||
endforeach()
|
||||
endfunction()
|
||||
dlu_fetch_embree()
|
||||
|
||||
# Intel Open Image Denoise 2 (Apache-2.0), the UGC server's denoise=oidn: optional, off by default (it brings TBB and
|
||||
# large neural network weights). An installed one is used when CMake finds it, else Intel's release package (prebuilt,
|
||||
# with its TBB) is downloaded and its libraries are copied next to the servers.
|
||||
option(DLU_OIDN "Build the UGC server with Intel Open Image Denoise (the denoise=oidn setting)" OFF)
|
||||
if(DLU_OIDN)
|
||||
# Its imported targets are used by the UGC server, in another directory
|
||||
set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL ON)
|
||||
find_package(OpenImageDenoise 2 CONFIG QUIET)
|
||||
if(NOT OpenImageDenoise_FOUND)
|
||||
if(WIN32)
|
||||
set(DLU_OIDN_URL "https://github.com/RenderKit/oidn/releases/download/v2.4.1/oidn-2.4.1.x64.windows.zip")
|
||||
set(DLU_OIDN_SHA256 "682d94ba57525ed177d73412e0ed903f576867bd048f830a5c6f63c56b25e8b8")
|
||||
set(DLU_OIDN_LIBRARIES "bin/*.dll")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
|
||||
set(DLU_OIDN_URL "https://github.com/RenderKit/oidn/releases/download/v2.4.1/oidn-2.4.1.x86_64.linux.tar.gz")
|
||||
set(DLU_OIDN_SHA256 "b69ca2443a226ef692ca46bdc4f89995b1e99091f2665b906cbe07e9673e48cc")
|
||||
set(DLU_OIDN_LIBRARIES "lib/*.so*")
|
||||
else()
|
||||
message(FATAL_ERROR "DLU_OIDN: install Open Image Denoise 2 (no release package for this platform)")
|
||||
endif()
|
||||
FetchContent_Declare(oidn URL ${DLU_OIDN_URL} URL_HASH SHA256=${DLU_OIDN_SHA256} DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
|
||||
FetchContent_MakeAvailable(oidn)
|
||||
find_package(OpenImageDenoise 2 CONFIG REQUIRED PATHS "${oidn_SOURCE_DIR}" NO_DEFAULT_PATH)
|
||||
file(GLOB DLU_OIDN_FILES "${oidn_SOURCE_DIR}/${DLU_OIDN_LIBRARIES}")
|
||||
file(COPY ${DLU_OIDN_FILES} DESTINATION "${CMAKE_BINARY_DIR}")
|
||||
endif()
|
||||
message(STATUS "Open Image Denoise ${OpenImageDenoise_VERSION}: the UGC server can denoise icons")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user