2

I need help with DirectX 11 or 12 to blend 2 transparent triangles as shown in the figure:

Fig 1 shows what I understand to be the blend of the 1st transparent triangle.

Fig 2 shows the blend of the 2nd transparent triangle (that is what I got so far).

But I want to achieve Fig 3. Is that possible?

Blend of 2 transparent triangles

MarcioAB
  • 601
  • 1
  • 5
  • 11
  • 1
    Its possible yes. But it depends heavily on how many such triangles you have in your scene and how much work (as in CPU cycles) you're willing to invest. Possible solutions would be cutting the triangles at the intersection or manual blending in the pixel shader. – tkausl Feb 03 '23 at 14:37
  • Right now it is only a test and each triangle is just a single element. By your comment, I understand it is not possible unless I cut these elements, correct? – MarcioAB Feb 03 '23 at 14:46
  • 1
    You could get it to work with manual blending in the pixel shader, could be quite nasty though, I'd just cut them such that no triangle intersects any other triangle. And then just render back to front, as usual for transparency. – tkausl Feb 03 '23 at 14:49
  • Maybe overkill for your use case, but for that type of effects (order independent transparency), there is the option of using Per Pixel linked list (or a dense grid). – mrvux Feb 04 '23 at 15:29

0 Answers0