Drawing overlapping translucent triangles with stencil buffer

Hi All,

We need a pseudocode of stencil buffer settings to draw the fragment only once.

The objective is to draw a transparent shadow on a plane without the alpha values adding up where triangles overlap.



Come on! You can come up with that yourself easily.