Question about single surface particles

Blitz3D Forums/Blitz3D Programming/Question about single surface particles

JKP(Posted 2004) [#1]
Hi, I have coded a simple particle system for something I'm working on. I want to create some fire using emitters and to make it look more realistic I need to add some smoke. I was wondering how I should do this.

I tried creating separate meshes, one for fire and one for smoke. The fire was set to "add" mode and the smoke used the normal blend mode. The problem is that it doesn't work properly and the colour of the entire surface used for the fire is affected. Would using two separate surfaces from the same mesh solve this? I have seen screenshots from the leading particles systems for Blitz and they seem to manage to blend smoke and fire together properly.


Ross C(Posted 2004) [#2]
Some approaches have each emittor being a different mesh altogether, so each can have their own fx properties.


JKP(Posted 2004) [#3]
As I said in the first post, I already tried using separate meshes.

Something I didn't mention before is that I'm using vertex alpha on both the smoke and the fire.


JKP(Posted 2004) [#4]
*BUMP*


sswift(Posted 2004) [#5]
Your question doesn't make any sense.

1. You created seperate meshes for fire and smoke.
2. The fire was set to add.
3. The smoke was left in the normal blending mode.
4. You use vertex alpha to adjust transparency of the particles.
5. The color of the entire fire surface is affected?

Affected by what? Affected how? That doesn't make any sense.


JKP(Posted 2004) [#6]
I mean that when I added the smoke emitter, it made every single quad of the fire mesh darker, even those that were unobscured by quads from the smoke mesh. Removing the smoke emitter immediately made all of the fire particles bright again.


sswift(Posted 2004) [#7]
Wait I think I know what you are asking...

I think you are saying that the smoke and fire particles are intermixed... That is, they occupy the same space. Some smoke particles are behind some fire particles, and some fire particles are in front of some smoke particles.

But you are seeing only smoke in front of fire, or fire in front of smoke regardless of where the particles are in space... The particles aren't drawing in the order you expeect them to be.

Making these two sets of particles different surfaces in the same mesh won't solve your problem. In fact it will make it worse because then even if the fire is really far behind the smoke it will still draw in front of it. At least with the fire being in a seperate entity, you get... eh I'll invent a new term... "macro-sorting" right.

"micro-sorting" the particles amongst themselves (another new term I just invented) is unfortunately, not possible in a single surface particle system. You can sort smoke particles with other smoke particles so long as they are part of the same mesh, but you can't intermix smoke and fire particles.

The particle system I used to sell avoided this issue entirely by just making each particle a seperate entity. The screenshots you have seen that mix particles, if they are from stuff made in Blitz, probably used a similar method. Unfortunately, one entity per particle means one surface per particle, and that comes at a much bigger speed penalty per particle than a single surface particle system. Of course it does allow you to use 3D particles which can look better than 2D particles in some cases.


sswift(Posted 2004) [#8]
"I mean that when I added the smoke emitter, it made every single quad of the fire mesh darker, even those that were unobscured by quads from the smoke mesh."

Um... well that doesn't sound at all like what I just described.

Reboot your PC. Then look for bugs in your code. Ceating a second mesh and then changing it's properties should not affect the appearance of the fire mesh at all other than when it's being drawn on the screen on top of it.

If you post some simple code that demonstrates the problem, then maybe we can find the problem. Otherwise I don't think we can help you.

Um.... are you sure your smoke particle quads aren't overlapping the fire mesh at all? Have you tried toggling wireframe mode while this is going on?


JKP(Posted 2004) [#9]
I guess I could post the code, but there is quite a lot of it and most of it is completely unoptimised.

Or perhaps a screenshot might illustrate the problem better?


sswift(Posted 2004) [#10]
Well you can try a screenshot, but I think the code would be better.


JKP(Posted 2004) [#11]
OK, sorry I was a bit vague with my descriptions. Anyway, I've experimented a bit and it seems that if I create two emitters in the same position but at different times, the particles from the second emitter appear in front of the other emitter's particles.

Screenshot:





Shows the effect of creating the emitters in a different order. In the second screenshot the fire is almost completely obscured.


sswift(Posted 2004) [#12]
Well then that's the effect I said would occur with a single surface particle system.

You're pretty much stuck with that unless you go with a particle system where each particle is an individual entity.

Of course, there is nothing preventing you from making a hybrid system so you can use regular particles in these special cases and a single surface system for the rest of your effects.


Ross C(Posted 2004) [#13]
You might find the fire particles texture, changes into a smoke texture after it reaches a certain distance from the emittor, giving the impression of two emittors.