I am supposed to use bilateral filter to denoise my image rendered with Vulkan. I wonder how I should implement the method. Should I add the rendered image to another frag shader as a texture and denoise the image there before drawing it on the screen? or are there simpler methods? Should I do it through CPU after rendering instead of GPU?
1 Answer
$\begingroup$
$\endgroup$
2
Bilateral filter can be implemented as a fragment shader, once you have the full rendered image.
https://www.shadertoy.com/view/4dfGDH
The first option should be much faster than downloading the rendered frame to main memory and performing the calculations in CPU.
-
$\begingroup$ I wonder how I can add a cs after fs in my pipeline. I want to implement bilateral filtering in the compute shader. $\endgroup$ Commented Aug 18, 2022 at 7:43
-
$\begingroup$ The code for the compute shader is not too different from the fragment shader. However, Lilyliyren, you should open a different question about how you can add a compute shader after fragment shader in Vulkan. It goes beyond the original question you posted here. Please, vote the answer if you consider it useful inside the context of the original question. $\endgroup$– DavidCommented Aug 22, 2022 at 19:53