Particle problems

Here is the video capture of a simple particle effect I created:

I have encountered 3 problems.

  1. How to reuse particleeffect object ? This questions seem has been asked several times, but I can’t find a good answer. I don’t want to recreate the ParticleEffect object because it is quite slow, as you can see in the video.

I don’t want to disable it immediately, so I called softStop(). But I am not able to start it again in the next fire action. I have to re-create the ParticleEffect object.

  1. The particle seems follow the mouth of the lady to rotate around. I called:

so I tried to call with render as the render:
self.particle.start(, render)

It is not working. Note that actually the lady is not walking. It is just the grass moving.

  1. The hair of the lady sometimes disappear if the fire particle is in front of it. How can I prevent it ?

Thank you.

hehe nice - does she eat chili at lunch?
[OT] OMG the 3D water surface simulation!!! I really hope you’ll find a place for it in the Demomaster!

As to the issue of the particles following the character’s head, I suspect that you were on the right track with having them render relative to, well, render.

However, instead of what you had, perhaps try the following:

self.particle.start(render) #Note that this only mentions render

I’m not absolutely sure, but I think that the above should do the trick.

As to starting and stopping the particle effect, I’m afraid that I don’t know, offhand. :confused:

As to the character’s hair, that sounds like a sorting issue - are you perhaps specifying a bin for the hair and particles? I’m afraid that I forget the default sorting order, but for such things I think that it should be back-to-front (that is, more distant objects before nearer ones).

The problem of re-starting a ParticleEffect has always given us some grief. It does try pretty aggressively to clean itself up, especially if you call reset() or cleanup(). But I’m surprised that softStop() / softStart() are not doing the trick for you.

For your second test, it may be just the ForceGroup that was in the wrong space. Does Thaumaturge’s suggestion help?

The rendering order is certainly the issue with fire particles in front of the hair. This is a common problem when you have multiple transparent objects in close proximity to each other. There are lots of possible solutions. In your case, you might want to try something like
rp.setBin(‘fixed’, 0), where rp is a special node that is created to be the particle’s renderParent, and you attach rp to render or whatever. The idea is to ensure that the particles render last in the scene, which putting them in the fixed bin will generally guarantee. There are other possible solutions too, and we can go on for days about the pros and cons of all of them.


I should add that I’m also surprised that creating a new ParticleEffect is expensive. It’s just a Python class object, and I don’t see what should be particularly expensive about creating a new one. What code are you using to create your ParticleEffect?


Thank you for your replies. I do more tests and fix some problems.

Thaumaturge’s suggestion cannot fix the problem. I finally figure out the force definition of the particle system is relative to the render parent. Actually the original api is correct. I just need to change the direction of the applied forces in the particle definition.

To reuse the particleeffect, I control the birth rate instead of calling softstart,reset,cleanup,…etc. By calling setBirthRate, I can control the particle system to do soft start and stop.
Originally I called cleanup and then create the particleeffect again. I believe the cleanup call is expensive? Anyway I no longer clean it up.

The setBin cannot fix the issue yet. I look at the scene graph and find it quite interesting. … directlink

I tried setBin on some nodepath but so far not able to fix it. Any suggestion ?

The setBin() needs to be applied to the render node. If you apply it to the wrong node, nothing much will happen to the particles. :slight_smile: Try hide() to prove that you’ve got the right node.

Another thing to try, once you’ve found the correct node, is rp.setDepthWrite(False).


It works ! Thanks a lot.

Well, the render node is under render, not sure what will be the case if there are several particleeffect created:

particlerender = render.find(“BaseParticleRenderer render node”)
particlerender.setBin(‘fixed’, 0)

Rather than finding the node created internally to the ParticleEffect, create your own node, and pass that node as the renderParent. That way you maintain control, and you can share that node among all related ParticleEffects.


That’s a good suggestion. It gives much better control now.