fs_bokeh_dof_downsample.sc 522 B

123456789101112131415161718192021222324
  1. $input v_texcoord0
  2. /*
  3. * Copyright 2021 elven cache. All rights reserved.
  4. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
  5. */
  6. #include "../common/common.sh"
  7. #include "parameters.sh"
  8. #include "bokeh_dof.sh"
  9. SAMPLER2D(s_color, 0);
  10. SAMPLER2D(s_depth, 1);
  11. void main()
  12. {
  13. vec2 texCoord = v_texcoord0.xy;
  14. vec3 color = texture2D(s_color, texCoord).xyz;
  15. float depth = texture2D(s_depth, texCoord).x;
  16. float blurSize = GetBlurSize(depth, u_focusPoint, u_focusScale);
  17. gl_FragColor = vec4(color, blurSize);
  18. }