bgfx/examples/38-bloom/fs_bloom_combine.sc
Бранимир Караџић 4581f14cd4 Happy New Year!
2022-01-15 11:59:06 -08:00

25 lines
587 B
Scala

$input v_texcoord0
/*
* Copyright 2011-2022 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
#include "../common/common.sh"
SAMPLER2D(s_albedo, 0);
SAMPLER2D(s_light, 1);
void main()
{
vec3 hdrColor = texture2D(s_albedo, v_texcoord0).rgb;
hdrColor += texture2D(s_light, v_texcoord0).rgb;
// instead of some fancy tonemapping operator, we just clamp it, to keep it simple.
vec3 finalColor = clamp(hdrColor, 0.0, 1.0);
float g = 2.2;
gl_FragColor = vec4(pow(finalColor, vec3(1.0 / g, 1.0 / g, 1.0 / g) ), 1.0);
}