opengl - Inner outline shader algorithm -
opengl - Inner outline shader algorithm -
ive been trying create inner outline shader growable thickness.
i tried several things.
checking surrounding pixels, if transparent color current pixel black (or chosen outline color). if want command thickness of outline, need check n pixels in each direction of current pixel (north, south, east, west, northwest, northeast, , on), n desired thickness. having performance issues approach though.
copy image, , shrink command outline thickness. ever outside smaller re-create colored black (outline color), , ever within set original image. works basic shapes though, imagine doughnut shaped image hollow center, shrinking image outline outer ring not inner ring.
same (2), instead of shrinking copy, blur re-create (to command thickness) , trim pixels alpha != 1. has worked best, not perfect complex shapes. areas have thicker stroke other, when want consistent.
what other algorithm try? general approach, how photoshop implement it? first algorithm accurate of three, unable create work pixel shader 2 because of loop requires.
you create mesh "hole" or "inside mesh". i.e. mesh everywhere within original mesh desired radius.
then render stencil buffer , after render original mesh outline color if stencil bits not set. like in stencil outlining.
you need new "inside mesh" each different "inner outline thickness, "growable" hard achieve.
opengl directx glsl shader hlsl
Comments
Post a Comment