智慧水务管理系统 - 精河县供水工程综合管理平台

PrimitiveGaussianSplatFS.glsl 636B

123456789101112131415161718
  1. //
  2. // Fragment shader for Gaussian splats.
  3. // Renders a Gaussian splat within a quad, discarding fragments outside the unit circle.
  4. // Applies an approximate Gaussian falloff based on distance from the center and outputs
  5. // a color modulated by the alpha and Gaussian weight.
  6. //
  7. void main() {
  8. if (v_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
  9. if (v_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
  10. float A = -dot(v_vertPos, v_vertPos);
  11. if (A < -4.) {
  12. discard;
  13. }
  14. float B = exp(A * 4.) * v_splatColor.a ;
  15. out_FragColor = vec4(v_splatColor.rgb * B , B);
  16. }