Hi! I'm pretty new to irrlicht and loving it so far, I'm making a brush sketching tool and I got stuck on this issue:
I'd like for each of my strokes to never show overlapping alpha with itself, thus avoid the artifacts visible in this image:
What I'd like to achieve instead, is having each stroke to overlap only with subsequent or previous strokes, based on Z depth, because it's a 3d paint app.
Also, in this app there's no shading or lights, all flat. Not sure if it helps solving the issue or not.
I've read it might be necessary to use the stencil buffer, but to be honest I'm no openGL expert, I can pretty much work my way around a GLSL shader but I can't write one of my own, especially with advanced techniques, so I'm hoping someone will be able to help here!
Thanks!
Andre
discard overlapping transparent pixels?
Re: discard overlapping transparent pixels?
Maybe https://en.wikipedia.org/wiki/Alpha_compositing can help a little bit. It's a tricky problem.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: discard overlapping transparent pixels?
Thanks!
It looks like someone figured it out in Unity using a vertex+fragment shader and stencil buffers, here's the post:
https://mispy.me/unity-alpha-blending-overlap/
What I desperately need from this community is guidelines to do the following (because I really can't find my way around this):
1) add a CG shader that uses the stencil buffer
2) set the blend function to this: SrcAlpha OneMinusSrcAlpha
Eventually I guess I'll figure it out, looking at the shadows implementation in irrlicht, but it might take me a while...please help : )
It looks like someone figured it out in Unity using a vertex+fragment shader and stencil buffers, here's the post:
https://mispy.me/unity-alpha-blending-overlap/
What I desperately need from this community is guidelines to do the following (because I really can't find my way around this):
1) add a CG shader that uses the stencil buffer
2) set the blend function to this: SrcAlpha OneMinusSrcAlpha
Eventually I guess I'll figure it out, looking at the shadows implementation in irrlicht, but it might take me a while...please help : )