fs_gdr_instanced_indirect_rendering.sc 448 B

1234567891011121314151617181920212223242526
  1. $input v_materialID
  2. /*
  3. * Copyright 2018 Kostas Anagnostou. All rights reserved.
  4. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
  5. */
  6. #include "../common/common.sh"
  7. uniform vec4 u_color[32];
  8. void main()
  9. {
  10. vec4 color = u_color[uint(v_materialID)];
  11. if (color.w < 1.0f)
  12. {
  13. //render dithered alpha
  14. if ( (int(gl_FragCoord.x) % 2) == (int(gl_FragCoord.y) % 2) )
  15. {
  16. discard;
  17. }
  18. }
  19. gl_FragColor = vec4(color.xyz, 1.0);
  20. }