glowMapGeneration.fragment.fx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifdef DIFFUSE
  2. varying vec2 vUVDiffuse;
  3. uniform sampler2D diffuseSampler;
  4. #endif
  5. #ifdef OPACITY
  6. varying vec2 vUVOpacity;
  7. uniform sampler2D opacitySampler;
  8. uniform float opacityIntensity;
  9. #endif
  10. #ifdef EMISSIVE
  11. varying vec2 vUVEmissive;
  12. uniform sampler2D emissiveSampler;
  13. #endif
  14. #ifdef VERTEXALPHA
  15. varying vec4 vColor;
  16. #endif
  17. uniform vec4 glowColor;
  18. void main(void)
  19. {
  20. vec4 finalColor = glowColor;
  21. // _____________________________ Alpha Information _______________________________
  22. #ifdef DIFFUSE
  23. vec4 albedoTexture = texture2D(diffuseSampler, vUVDiffuse);
  24. finalColor.a *= albedoTexture.a;
  25. #endif
  26. #ifdef OPACITY
  27. vec4 opacityMap = texture2D(opacitySampler, vUVOpacity);
  28. #ifdef OPACITYRGB
  29. finalColor.a *= getLuminance(opacityMap.rgb);
  30. #else
  31. finalColor.a *= opacityMap.a;
  32. #endif
  33. finalColor.a *= opacityIntensity;
  34. #endif
  35. #ifdef VERTEXALPHA
  36. finalColor.a *= vColor.a;
  37. #endif
  38. #ifdef ALPHATEST
  39. if (finalColor.a < ALPHATESTVALUE)
  40. discard;
  41. #endif
  42. #ifdef EMISSIVE
  43. gl_FragColor = texture2D(emissiveSampler, vUVEmissive) * finalColor;
  44. #else
  45. gl_FragColor = finalColor;
  46. #endif
  47. }