Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

A recurring problem I get is this one: given two different billboard sets with alpha textures intended to create particle special effects (such as point lights and smoke puffs), rendering them correctly is tedious.

The issue arising in this scenario is that there's no way to use depth writing and make certain billboards obey depth information as they appear in front of others that are clearly closer to the camera. I've described the problem on the Ogre forums several times without any suggestions being given (since the application I'm writing uses their engine).

What could be done then? sort all individual billboards from different billboard sets to avoid writing the depth and still have nice alpha blended results? If yes, please do point out some resources to start with in the frames of the aforementioned Ogre engine. Any other suggestions are welcome!

share|improve this question

3 Answers 3

up vote 3 down vote accepted

Let me give you the bad news straight away: there is no fix for this, not in Ogre, not in any engine.

This website explains the problem nicely:

http://blogs.msdn.com/b/shawnhar/archive/2009/02/18/depth-sorting-alpha-blended-objects.aspx

However, a solution in your case could be to first render all your opaque objects, turn off depth writing, render the particles and turn depth writing back on. This will allow for transparent particles to blend with the background, but unfortunately they cannot blend with each other, unless you render each particle individually.

share|improve this answer
    
Thank you!! That's exactly what I can't do at the moment (render them individually, let one billboard set be aware of other billboards).. I'll have to live with it until I find a way to render them with the least amount of blending artifacts. –  teodron May 25 '12 at 13:05

It can't be done with Ogre. From Sinbad himself, on this thread:

It's basically impossible to sort between particle systems efficiently. The reason is that to sort arbitrarily would require every particle to be rendered independently, which would totally kill performance.

You need to use workarounds like using 'hard' alpha and leaving depth-writing on if you want perfect sorting.

If you have a case where one type of particle system should always be on top of another, you can separate them using render queues. But you can't interleave systems.

share|improve this answer

I think everyone already covered most of the major answers but it is worth noting that if all of your effects are additive then order dependency is no longer a problem.

As soon as you introduce an alpha-blend (or even adding fog to the particles) then it becomes a big unsolvable mess.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.