I'm trying to draw an inner glow/shadow for an object consisting of four cubic Bezier curves. To draw a single Bezier curve I'm splitting it into segments and then calculating distances from current pixel to each line segment and finally I'm blending it with min
:
// No GL_MAX blending mode in OpenGL ES 2.0
d_min = min(d_min, d)
where d
is a distance for every segment. Zoomed in example of blending two line segments:
It works reasonably well when you have ~25 segments representing a short Bezier curve
except for "gutters" in the places where Bezier curves and their respective gradients combine.
Q: How can I avoid these artifacts? Is there a better method for drawing inner glow/shadow?