bgfx/examples/19-oit/fs_oit_wb_separate_blit.sc

20 lines
466 B
Python
Raw Normal View History

2014-03-27 01:01:22 -04:00
$input v_texcoord0
/*
2016-01-01 03:11:04 -05:00
* Copyright 2011-2016 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
2014-03-27 01:01:22 -04:00
*/
#include "../common/common.sh"
2015-10-25 01:34:11 -04:00
SAMPLER2D(s_texColor0, 0);
SAMPLER2D(s_texColor1, 1);
2014-03-27 01:01:22 -04:00
void main()
{
2015-10-25 01:34:11 -04:00
vec4 accum = texture2D(s_texColor0, v_texcoord0);
2014-03-27 01:01:22 -04:00
float opacity = accum.w;
2015-10-25 01:34:11 -04:00
float weight = texture2D(s_texColor1, v_texcoord0).x;
2014-03-27 01:01:22 -04:00
gl_FragColor = vec4(accum.xyz / clamp(weight, 1e-4, 5e4), opacity);
}