0

I am drawing text on top of a rectangle.

  1. Rectangle z position is 0
  2. Text z Position is 1

If we render opaque rectagle first and than draw text the rendering comes fine.

enter image description here

if we reverse the order we first draw text and than the geometry than transparent areas of the text cut through the rectangle which is drawn behind.

enter image description here

How can we draw in this order.

Summit
  • 2,112
  • 2
  • 12
  • 36
  • 3
    because correct transparency requires depth sorting... if this is 2D then use sprites instead of transparency you know you can `discard;` fragments based on their color or alpha channel in fragment shaders ... – Spektre Dec 01 '21 at 09:45
  • @Spektre this is 3d and also the same issue comes up with geometry like cylinder when images with alpha are mapped on them , the front of the cylinder cuts through the back side of cylinder. – Summit Dec 01 '21 at 10:05
  • 1
    see [OpenGL - How to create Order Independent transparency?](https://stackoverflow.com/a/37783085/2521214) its far from perfect but solves a lot of issues ... – Spektre Dec 01 '21 at 14:42

0 Answers0