-Paul

]]>Instead of checking for zero length, you could also add 0.0001 to afwidth to prevent this. As a single MADD instruction, this would not change performance. Also, I noticed that the shader misbehaves when you rotate the shape between 45 and 135 degrees, because then the X and Y derivatives are swapped. I fixed this by using:

grad = vec2(grad_dist.x * max( Jdx.x, Jdx.y ) + grad_dist.y * max( Jdy.x, Jdy.y), grad_dist.x * min( Jdx.x, Jdx.y ) + grad_dist.y * min( Jdy.x, Jdy.y ) );

-Paul

]]>Steve – thanks, I’ll correct it.

Rob – I think we’ve already communicated about this. I can make the source code for the Second Edition available for anyone who needs it. The source code for the Third Edition will be hosted on GitHub, and should be live by the end of the month.

]]>There’s currently a small typo in a couple of the code snippets:

grad = vec2(grad_dist.x * Jdx.x + grad_dist.y*Jdy.y, grad_dist.x * Jdx.y + grad_dist.y*Jdy.y);

The first Jdy.y should be Jdy.x (according to the Skia code anyway!)

]]>