2018-09-19 22:24:52 +03:00
|
|
|
$input v_texcoord0
|
|
|
|
|
|
|
|
/*
|
2019-01-14 04:13:25 +03:00
|
|
|
* Copyright 2011-2019 Branimir Karadzic. All rights reserved.
|
2018-09-19 22:24:52 +03:00
|
|
|
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "../common/common.sh"
|
|
|
|
|
|
|
|
SAMPLER2D(s_albedo, 0);
|
|
|
|
SAMPLER2D(s_light, 1);
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
vec3 hdrColor = texture2D(s_albedo, v_texcoord0).rgb;
|
2018-09-21 01:49:56 +03:00
|
|
|
|
2018-09-19 22:24:52 +03:00
|
|
|
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);
|
2018-09-21 01:49:56 +03:00
|
|
|
|
2018-09-19 22:24:52 +03:00
|
|
|
float g = 2.2;
|
2018-09-21 01:49:56 +03:00
|
|
|
gl_FragColor = vec4(pow(finalColor, vec3(1.0 / g, 1.0 / g, 1.0 / g) ), 1.0);
|
2018-09-19 22:24:52 +03:00
|
|
|
}
|