-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
75 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#version 300 es | ||
precision highp float; | ||
precision mediump sampler2D; | ||
uniform sampler2D InputBuffer; | ||
uniform sampler2D NoiseMap; | ||
uniform int kernel; | ||
uniform float isofactor; | ||
uniform ivec2 size; | ||
uniform ivec2 tpose; | ||
#define M_PI 3.1415926535897932384626433832795 | ||
|
||
//#define sigma (0.05) | ||
//const int kernel = 6; | ||
const int window = 2; | ||
#import interpolation | ||
#define luminocity(x) ((((x.r+x.g+x.b)/3.0))+0.001) | ||
/*float luminocity(vec3 color) { | ||
return (color.r+color.g+color.b)/3.0; | ||
}*/ | ||
#define distribute(x,dev,sigma) ((exp(-(x-dev) * (x-dev) / (2.0 * sigma * sigma)) / (sqrt(2.0 * M_PI) * sigma))) | ||
|
||
float nlmeans(ivec2 coords) { | ||
float processed = 0.0; | ||
float weights = 0.0; | ||
float noisefactor = clamp((textureBicubic(NoiseMap, vec2(coords)/vec2(size)).r)*0.55*isofactor,0.0005,1.0); | ||
noisefactor*=noisefactor; | ||
noisefactor*=0.6; | ||
for(int i = -kernel; i < kernel; i++) { | ||
for(int j = -kernel; j < kernel; j++) { | ||
ivec2 patchCoord = coords + ivec2(i, j); | ||
//float w = comparePatches(patchCoord, coords,0.01*0.5 + noisefactor*0.35); | ||
float sigma = (0.01*0.5 + noisefactor*0.35); | ||
float w = distribute(luminocity(texelFetch(InputBuffer, coords,0).rgb), | ||
luminocity(texelFetch(InputBuffer,patchCoord,0).rgb),sigma); | ||
w/=((2.0 * float(window) + 1.0) * (2.0 * float(window) + 1.0)); | ||
processed += w * luminocity(texelFetch(InputBuffer, patchCoord,0).rgb); | ||
weights += w; | ||
} | ||
} | ||
return processed / weights; | ||
} | ||
|
||
////////////////////////////////////////////////////////////////////////////////// | ||
out vec3 Output; | ||
uniform int yOffset; | ||
void main() { | ||
ivec2 xy = ivec2(gl_FragCoord.xy); | ||
xy+=ivec2(0,yOffset); | ||
vec3 xyz = (texelFetch(InputBuffer, xy,0).rgb)+0.001; | ||
float br = (xyz.r+xyz.g+xyz.b)/3.0; | ||
xyz/=br; | ||
br = nlmeans(xy); | ||
Output = clamp(xyz*br,0.0,1.0); | ||
//float noisefactor = clamp(textureLinear(NoiseMap, vec2(xy)/vec2(size)).r,0.0005,0.6); | ||
//Output = vec3(noisefactor*1.9); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
#Thu Dec 17 02:57:51 MSK 2020 | ||
VERSION_BUILD=2485 | ||
#Thu Dec 17 05:05:16 MSK 2020 | ||
VERSION_BUILD=2514 |