Shadertoy-Shaders/pathtracing/reverse/image.glsl

30 lines
647 B
GLSL

float luminance(vec3 v)
{
return dot(v, vec3(0.2126f, 0.7152f, 0.0722f));
}
vec3 reinhard_jodie(vec3 v)
{
float l = luminance(v);
vec3 tv = v / (1.0f + v);
return mix(v / (1.0f + l), tv, tv);
}
float tentKernel(in vec2 xy, in float r)
{
return (1.0 - abs(xy.x/r)) * (1.0 - abs(xy.y/r)) / (r*r);
}
float gaussianWeight(in float delta, in float sigma)
{
return exp(-delta*delta/(2.0 * sigma * sigma)) * 2.5 * sigma;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord)
{
vec2 uv = fragCoord.xy/iResolution.xy;
vec3 color = texture(iChannel0, uv).rgb;
fragColor = vec4(reinhard_jodie(color), 1);
}