glowMapMerge.fragment.fx 648 B

12345678910111213141516171819202122232425262728
  1. // Samplers
  2. varying vec2 vUV;
  3. uniform sampler2D textureSampler;
  4. #ifdef EMISSIVE
  5. uniform sampler2D textureSampler2;
  6. #endif
  7. // Offset
  8. uniform float offset;
  9. void main(void) {
  10. vec4 baseColor = texture2D(textureSampler, vUV);
  11. #ifdef EMISSIVE
  12. baseColor += texture2D(textureSampler2, vUV);
  13. baseColor *= offset;
  14. #else
  15. baseColor.a = abs(offset - baseColor.a);
  16. #ifdef STROKE
  17. float alpha = smoothstep(.0, .1, baseColor.a);
  18. baseColor.a = alpha;
  19. baseColor.rgb = baseColor.rgb * alpha;
  20. #endif
  21. #endif
  22. gl_FragColor = baseColor;
  23. }