fs_oit_wb_separate_blit.sc 465 B

12345678910111213141516171819
  1. $input v_texcoord0
  2. /*
  3. * Copyright 2011-2025 Branimir Karadzic. All rights reserved.
  4. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
  5. */
  6. #include "../common/common.sh"
  7. SAMPLER2D(s_texColor0, 0);
  8. SAMPLER2D(s_texColor1, 1);
  9. void main()
  10. {
  11. vec4 accum = texture2D(s_texColor0, v_texcoord0);
  12. float opacity = accum.w;
  13. float weight = texture2D(s_texColor1, v_texcoord0).x;
  14. gl_FragColor = vec4(accum.xyz / clamp(weight, 1e-4, 5e4), opacity);
  15. }