Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenGL; Overlapping Alpha-Transparent Particles
    text
    copied!<p>I am writing an OpenGL program in C that implements alpha-transparent bill boarding particles that use a PNG (with transparency) as their texture via pnglib. However, I have discovered that a particle's transparent zones will still replace particles called before it that are also behind it. In other words, particles newly called, though transparent in some areas, are completely overlapping some particles called before them when, instead, those previously called particles should be showing through the transparency.</p> <p>In order to visualize the effect this is having, I am attaching a few images to display the problem:</p> <p>Initially I am calling the particles from oldest-to-newest: <img src="https://www.dropbox.com/s/sor6u7gr0c7n53l/overlapping1.png" alt="Front View"></p> <p>However when the view is changed, the overlapping effect is apparent: <img src="https://www.dropbox.com/s/02j9cgcqq9kfl8h/overlapping2.png" alt="Back View"></p> <p>When I decide to reverse the call order I get the opposite: <img src="https://www.dropbox.com/s/9tps951jvfkpbwk/overlapping3.png" alt="Back View Order Reversed"> <img src="https://www.dropbox.com/s/l59ba9nu7e1ynq3/overlapping4.png" alt="Front View Order Reversed"></p> <p>I believe that a solution to this would involve calling the particles in order from farthest from the camera to nearest. However, it is pretty computationally heavy to go through each active particle, order them from furthest-to-nearest, and then call each one every display frame. I am hoping to find an easier, more efficient solution. I've already tried my hand with <code>glBlendFunc()</code> but no <code>sfactor</code> or <code>dfactor</code> seems to work.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload