fs_assao_gbuffer.sc 487 B

12345678910111213141516171819202122
  1. $input v_normal, v_texcoord0
  2. /*
  3. * Copyright 2018 Attila Kocsis. All rights reserved.
  4. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
  5. */
  6. #include "../common/common.sh"
  7. SAMPLER2D(s_albedo, 0);
  8. void main()
  9. {
  10. vec3 normalWorldSpace = v_normal;
  11. // Write normal
  12. gl_FragData[0].xyz = normalWorldSpace.xyz; // Normal is already compressed to [0,1] so can fit in gbuffer
  13. gl_FragData[0].w = 0.0;
  14. // Write color
  15. gl_FragData[1] = texture2D(s_albedo, v_texcoord0);
  16. }