I am trying to simulate realistic effects like spark using particles, that need to z-layer properly with other objects in the scene.

I am looking into using a particle system that consists of a mesh where each vertex is particle. I believe this would allow simulating the particles on the GPU by using a vertex shader.

I am running into issues with the particle not being rendered with the right depth; i.e. some particles appear "behind" or "in front of" other objects when they shouldn't be.

Additionally, this would never allow the particles to interact with other objects in the scene.

Should I consider instead, simulating each particle as its own sprite object in the scene, and manipulate the physics using CPU code? Or is there another way to solve the issues with my GPU particles?

  • \$\begingroup\$ Hi ahaas, and welcome to GameDev.StackExchange. If you want us to help you solve the depth ordering problem you're having with your particles, you'll need to show us the specific symptoms you're observing and code that's causing it. Use the edit button to add more details to your question. \$\endgroup\$ – DMGregory Mar 13 '18 at 20:03
  • \$\begingroup\$ The question is about effective methods of implementing particle systems for specific game scenarios. Looking at existing game engines could give insight about strategies for implementation, specifically using CPU vs GPU computation. \$\endgroup\$ – ahaas Mar 14 '18 at 21:02
  • \$\begingroup\$ And if you'd like to do that research, please do. We won't stop you. Our Q&A format here isn't the right venue for competitive research though. Instead, we're optimized for problem-solving. Describe your particular depth ordering problem in detail, and we should be able to help you solve it. If some offered solutions happen to include "Here's a technique they used to solve it in Source/Unreal/etc" that's good too, but in general solutions to your problem in your codebase might take an entirely different form. \$\endgroup\$ – DMGregory Mar 14 '18 at 21:14

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.