bgfx/examples/38-bloom/fs_bloom_combine.sc
Бранимир Караџић 466c6a4e95 Happy New Year!
2023-01-14 10:05:12 -08:00

25 lines
587 B
Scala

$input v_texcoord0
/*
* Copyright 2011-2023 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);
}