brutpitt / glslsmartdenoise Goto Github PK
View Code? Open in Web Editor NEWFast glsl deNoise spatial filter, with circular gaussian kernel, full configurable
License: BSD 2-Clause "Simplified" License
Fast glsl deNoise spatial filter, with circular gaussian kernel, full configurable
License: BSD 2-Clause "Simplified" License
I noticed this shader is quite similar to a gaussian blur, which is a separable filter (blurring on just the X axis, and then blurring that image on just the Y axis gives the same results as doing a full convolution).
Do you think this could be turned into a separable version? I'm attempting that now, but I may have my math incorrect and I'm not 100% sure if it's even possible. If I come up with something I'll be sure to submit a PR, but I'm curious if you've already evaluated this.
I converted the shadertoy version of the shader to a shader filter for exeldro's obs-shaderfilter and it works great!
Hi BrutPitt,
I just wanted to mention that I'm now using an adoption of your glslSmartDeNoise-algorithm in my project, which is an advanced flame-fractal-generator based on WebGl and Vaadin: https://github.com/thargor6/JWildfireSwan
There is also a live demo: https://herokuapp.overwhale.com/
Thanks for your work and best regards,
Andreas
Hello!
I've noticed a number of peculiar things in the fragment shader code, which I believe are bugs:
float invSigmaQx2PI = INV_PI * invSigmaQx2; // 1.0 / (sqrt(PI) * sigma)
This line is not equal to 1.0 / (sqrt(PI) * sigma), which seems to simply be a comment error. However, this variable is also not used anywhere in the code, see point 3.
vec2 d = vec2(x,y)/size;
Dividing d by the texture size implies that the standard deviation (sigma) is in normalized texture coordinates. In fact, dot(d, d) is so close to zero that the resulting denoised image looks identical if it is simply replaced with 0.0. I believe the correct value should be vec2(x, y);
, without the division.
float blurFactor = exp( -dot(d , d) * invSigmaQx2 ) * invSigmaQx2;
The multiplication by invSigmaQx2 seems incorrect and should be invSigmaQx2PI.
Thanks for the nice and simple denoising filter!
Edit:
Here's my hopefully fixed ShaderToy code, also switched to using texelFetch() instead of texture().
https://pastebin.com/FUScJxgK
Edit2:
Forcing float blurFactor = 1.0;
gives visually indistuingishable results to the original shader, and most likely behaves more like a smart box filter than a smart gaussian blur. It does however still look good, and is presumably a decent bit cheaper to evaluate.
I'm looking at integrating this denoising shader in Godot Engine and was wondering about denoising an HDR viewport. The engine uses a tonemapping shader to convert the viewport into a LDR image for display. For best results, should I run the denoising shader before or after tonemapping? My gut feeling tells me I should do this after tonemapping, but I'm not sure exactly.
This should be documented in the README and/or in the shader code. Thanks in advance for replying ๐
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.