From 70da7c2287f9fce6835f66ec6e4729c58ca5f6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tur=C3=A1nszki=20J=C3=A1nos?= Date: Sat, 13 Sep 2025 08:36:20 +0200 Subject: [PATCH] added some more post processing support for path tracing renderer --- WickedEngine/wiRenderPath3D_PathTracing.cpp | 78 +++++++++++++++++++-- WickedEngine/wiVersion.cpp | 2 +- 2 files changed, 72 insertions(+), 8 deletions(-) diff --git a/WickedEngine/wiRenderPath3D_PathTracing.cpp b/WickedEngine/wiRenderPath3D_PathTracing.cpp index 9c3ba76c8..50526d16d 100644 --- a/WickedEngine/wiRenderPath3D_PathTracing.cpp +++ b/WickedEngine/wiRenderPath3D_PathTracing.cpp @@ -565,11 +565,33 @@ namespace wi device->RenderPassEnd(cmd); } + // Post processing: + const Texture* rt_read = &rtMain; + const Texture* rt_write = &rtPostprocess; + + for (auto& x : custom_post_processes) + { + if (x.stage == CustomPostprocess::Stage::BeforeTonemap) + { + wi::renderer::Postprocess_Custom( + x.computeshader, + *rt_read, + *rt_write, + cmd, + x.params0, + x.params1, + x.name.c_str() + ); + + std::swap(rt_read, rt_write); + } + } + if (getEyeAdaptionEnabled()) { wi::renderer::ComputeLuminance( luminanceResources, - rtMain, + *rt_read, cmd, getEyeAdaptionRate(), getEyeAdaptionKey() @@ -579,7 +601,7 @@ namespace wi { wi::renderer::ComputeBloom( bloomResources, - rtMain, + *rt_read, cmd, getBloomThreshold(), getExposure(), @@ -588,8 +610,8 @@ namespace wi } wi::renderer::Postprocess_Tonemap( - rtMain, - rtPostprocess, + *rt_read, + *rt_write, cmd, getExposure(), getBrightness(), @@ -605,7 +627,49 @@ namespace wi &distortion_overlay, getHDRCalibration() ); - lastPostprocessRT = &rtPostprocess; + std::swap(rt_read, rt_write); + + for (auto& x : custom_post_processes) + { + if (x.stage == CustomPostprocess::Stage::AfterTonemap) + { + wi::renderer::Postprocess_Custom( + x.computeshader, + *rt_read, + *rt_write, + cmd, + x.params0, + x.params1, + x.name.c_str() + ); + + std::swap(rt_read, rt_write); + } + } + + if (getSharpenFilterEnabled()) + { + wi::renderer::Postprocess_Sharpen(*rt_read, *rt_write, cmd, getSharpenFilterAmount()); + + std::swap(rt_read, rt_write); + } + + if (getFXAAEnabled()) + { + wi::renderer::Postprocess_FXAA(*rt_read, *rt_write, cmd); + + std::swap(rt_read, rt_write); + } + + if (getChromaticAberrationEnabled()) + { + wi::renderer::Postprocess_Chromatic_Aberration(*rt_read, *rt_write, cmd, getChromaticAberrationAmount()); + + std::swap(rt_read, rt_write); + } + + lastPostprocessRT = rt_read; + // GUI Background blurring: { @@ -617,7 +681,7 @@ namespace wi device->EventEnd(cmd); wi::profiler::EndRange(range); } - }); + }); RenderPath2D::Render(); @@ -636,7 +700,7 @@ namespace wi fx.enableFullScreen(); fx.blendFlag = wi::enums::BLENDMODE_OPAQUE; fx.quality = wi::image::QUALITY_LINEAR; - wi::image::Draw(&rtPostprocess, fx, cmd); + wi::image::Draw(lastPostprocessRT, fx, cmd); device->EventEnd(cmd); diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index d8671c94b..ec5281e54 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wi::version // minor features, major updates, breaking compatibility changes const int minor = 71; // minor bug fixes, alterations, refactors, updates - const int revision = 823; + const int revision = 824; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);