90 lines
1.9 KiB
GLSL
90 lines
1.9 KiB
GLSL
#version 150
|
|
#define float2 vec2
|
|
#define float3 vec3
|
|
#define float4 vec4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uniform Push
|
|
{
|
|
vec4 SourceSize;
|
|
vec4 OriginalSize;
|
|
vec4 OutputSize;
|
|
uint FrameCount;
|
|
float max_w;
|
|
float min_w;
|
|
float smoot;
|
|
float lumad;
|
|
float mtric;
|
|
}params;
|
|
|
|
#pragma parametermax_w¡0.100.000.200.01
|
|
#pragma parametermin_w¡-0.07-0.150.050.01
|
|
#pragma parametersmoot¡0.550.001.500.01
|
|
#pragma parameterlumad¡0.300.105.000.10
|
|
#pragma parametermtric¡0.700.102.000.10
|
|
|
|
layout(std140) uniform UBO
|
|
{
|
|
mat4 MVP;
|
|
}global;
|
|
|
|
vec3 dt = vec3(1.0, 1.0, 1.0);
|
|
|
|
|
|
float wt(vec3 A, vec3 B)
|
|
{
|
|
return clamp(params . smoot -((6.0 + params . lumad)/ pow(3.0, params . mtric))* pow(dot(pow(abs(A - B), vec3(1.0 / params . mtric)), dt), params . mtric)/(dot(A + B, dt)+ params . lumad), params . min_w, params . max_w);
|
|
}
|
|
|
|
layout(location = 0) in vec2 vTexCoord;
|
|
layout(location = 1) in vec4 t1;
|
|
layout(location = 2) in vec4 t2;
|
|
layout(location = 3) in vec4 t3;
|
|
layout(location = 4) in vec4 t4;
|
|
layout(location = 0) out vec4 FragColor;
|
|
uniform sampler2D Source;
|
|
|
|
void main()
|
|
{
|
|
vec3 c00 = texture(Source, t1 . xy). xyz;
|
|
vec3 c10 = texture(Source, t1 . zw). xyz;
|
|
vec3 c20 = texture(Source, t2 . xy). xyz;
|
|
vec3 c01 = texture(Source, t4 . zw). xyz;
|
|
vec3 c11 = texture(Source, vTexCoord . xy). xyz;
|
|
vec3 c21 = texture(Source, t2 . zw). xyz;
|
|
vec3 c02 = texture(Source, t4 . xy). xyz;
|
|
vec3 c12 = texture(Source, t3 . zw). xyz;
|
|
vec3 c22 = texture(Source, t3 . xy). xyz;
|
|
|
|
float w10 = wt(c11, c10);
|
|
float w21 = wt(c11, c21);
|
|
float w12 = wt(c11, c12);
|
|
float w01 = wt(c11, c01);
|
|
float w00 = wt(c11, c00)* 0.75;
|
|
float w22 = wt(c11, c22)* 0.75;
|
|
float w20 = wt(c11, c20)* 0.75;
|
|
float w02 = wt(c11, c02)* 0.75;
|
|
|
|
FragColor = vec4(w10 * c10 + w21 * c21 + w12 * c12 + w01 * c01 + w00 * c00 + w22 * c22 + w20 * c20 + w02 * c02 +(1.0 - w10 - w21 - w12 - w01 - w00 - w22 - w20 - w02)* c11, 1.0);
|
|
}
|