You have a zoffset problem, you must set the zOffset
property so that the decal is drawn a bit in front of the underlying object:
It’s the same thing for your first PG but it is a bit more problematic because the polygons extend on big areas over the sphere so you need to use a big zOffset
value to fix the z-fighting, but then you have artifacts when you rotate (I have set a zOffset
value on the red poly only):
Disabling z-testing and enabling backface culling almost work:
There are some thin triangle artifacts when we rotate because the polys only approximate the sphere. Maybe by triangulating differently / with more triangles you could improve things…
For a shader solution, maybe you can adapt this algorithm for the sphere case but I’m not sure it is easy and that it will be enough for your needs: