Giter Site home page Giter Site logo

brutpitt / glslsmartdenoise Goto Github PK

View Code? Open in Web Editor NEW
243.0 8.0 25.0 19.48 MB

Fast glsl deNoise spatial filter, with circular gaussian kernel, full configurable

License: BSD 2-Clause "Simplified" License

CMake 0.28% GLSL 0.26% HTML 0.08% Batchfile 0.02% C++ 80.96% C 18.40%
glsl filter denoise denoising gaussian

glslsmartdenoise's Introduction

Hi there ๐Ÿ‘‹

glslsmartdenoise's People

Contributors

brutpitt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

glslsmartdenoise's Issues

Is this shader separable?

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.

Potential issues in the shader

Hello!

I've noticed a number of peculiar things in the fragment shader code, which I believe are bugs:

  1. 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.

  2. 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.

  3. 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.

Using this shader with HDR tonemapping image: before or after?

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 ๐Ÿ™‚

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.