I am trying to find a way to smooth the edges of a not regular mesh like a mask feather.
I have tried building a function that increases the resolution of the mesh but that’s not really helpful on straight lines.
Ideally I would need a way to control the alpha on the pixels around the edges. the further they are from the center the more transparent they are.
I found this code but I can’t manage to make it work. I am stuck at
connectivityGraph[i] and I am not even sure it’s what I need.
I would appreciate any help, really even just an hint on how to start this.
maybe by mapping a texture on to the mesh you can prepare you texture already with the correct alpha gradient.
@stephanschulz thanks for replying.
I eventually used some openGL. The option of the texture with the alpha gradient was another solution considered.
is it possible for you to share your solution?
@stephanschulz I used this addon https://github.com/microcosm/ofxLayerMask
As far as I understand, it uses openGL to manage masks. I find it very intuitive and easy to use.
In my specific case, I abandoned the former idea of smoothing the mask mesh as I wasn’t getting anywhere. I used a shader as a mask instead, that had some smooth edges already in it. I initially took the shader from http://glslsandbox.com/ and worked on that code to make it as I wanted.
I am enclosing the frag and vert of the shader that I usedshader.zip (2.2 KB)
I hope this helps and let me know if you need more/different info