Page 1 of 2

Particles and particle systems

Posted: Mon May 10, 2004 6:52 pm
by yin nadie
Maybe this is how it has been coded, but...

when i rotate a particle system, all the particles rotate with it (they even stop facing the camera)

when i move a particle system, all its particles move with it

when i remove a particle systen all particles are deleted

isn't there a default way to make the particles independant from their system?

Posted: Mon May 10, 2004 7:10 pm
by ZDeveloper
I have the problem with rotateting and the camera, too.
I hope someone can help. :)

Posted: Mon May 10, 2004 8:19 pm
by yin nadie
O_o

ow can you have this problema witha camera?

Posted: Mon May 10, 2004 8:38 pm
by ZDeveloper
I mean if I make Particle to the modell as child and then rotate the modell, than the particles rotate, too, and then you can see the problem. If the angle becomes 180 degree then the particles disapear. And before you see, that the particles are only 2D bitmaps. So I think this problem was meant by facing.

Or do you mean different thing? :? (Sorry I am not so good in english)

Posted: Tue May 11, 2004 10:32 am
by yin nadie
oh, yes. That's exactly the problem

Could please somebidy tell us if there is a way to override this? I would feel pretty stupid if, after implementing a particle system by myself, it happened to be already coded in the engine

Posted: Wed May 12, 2004 5:55 am
by Domarius
Well you should pull apart the examples, because they have particles looking fine from all angles.

Posted: Thu May 13, 2004 12:00 pm
by yin nadie
Well, yes, in all the examples , particles look fine from all the angles, but i don't think there is an example where the ISceneNode::setRotation funcion is used in a IParticleSystemSceneNode object, which is exactly the problem.

Everything works just fine until I start aplying transformations to the particle system node.

Posted: Fri May 14, 2004 3:13 am
by Domarius
Ah okay sorry, I missed that part of your post. Looks like you found a bug I guess.

Posted: Fri May 14, 2004 6:19 pm
by ZDeveloper
I have an idea. It isn't good idea, but i haven't better one.
But we can create our own Particle Emitter. And then we create own particles. But we don't make them 3D. We put three 2D particles in different angles. always in angles of 90 degree. Then we put BackCulling off(But only for Particles). And then it doeas't matter how often you rotate them.

But there is a disadvantage: It is not so fast. It is very slow because of following things:
1) we have to draw for one particle 6 Triangles and not 2. (three times slower I think)
2) if we put off backcullig the graphic card has to draw the particles two times. (one time front and one time back)

So it is twelve times slower, if I calculate right. If not, please say it. :)
And you can't use it often. But for one or two effects it will be ok I think. ;)

If someone has an better idea, say please.

EDIT: Sorry for my bad english.

Posted: Sat May 15, 2004 9:19 am
by yin nadie
Before doing that i would implement my own Particle Emitter node. It would be faster

Also, with that solution, the particles would still be linked to the particle system scene node, so they would move with it, and many effects (fire from the propeller of an airshif, a particle track left by a light sphere) wouldn't work

a pity

Posted: Sun May 16, 2004 10:00 am
by ZDeveloper
yin nadie wrote:Before doing that i would implement my own Particle Emitter node. It would be faster

Also, with that solution, the particles would still be linked to the particle system scene node, so they would move with it, and many effects (fire from the propeller of an airshif, a particle track left by a light sphere) wouldn't work

a pity
Oh Sorry I mean own particle node. Not Emitter. :oops:

Posted: Mon May 24, 2004 3:35 pm
by qwe
This fixes the moving particles problem. Works with point emitters, haven't tried it with box emitters. YMMV

First, in SParticle.h, add a core::vector3df called startPos.

After line 270 of CParticleSystemSceneNode.cpp add:

Code: Select all

array[i].startPos = getAbsolutePosition();

Replace line 296 with:

Code: Select all

Particles[i].pos +=
				 ((Particles[i].startPos - getAbsolutePosition())/2 - (Particles[i].startPos - lastPos)/2) + (Particles[i].vector * scale);
Basically what this does is offset the particle position by the distance between the point where the particle was emitted and the point at which the particle system scene node is currently at. make sense? :)

Please note that doing this requires you to recompile the engine, which requires the DirectX 9 SDK.

Posted: Mon May 24, 2004 8:11 pm
by ZDeveloper
Thanks for help.

But for recompiling you needn't DX SDK, but without DX SDK you must comment out these lines:

Code: Select all

//#define _IRR_COMPILE_WITH_DIRECTX_8_
//#define _IRR_COMPILE_WITH_DIRECTX_9_
they are in IrrCompileConfig.h
lines 26 and 27

EDIT: Someone should mail Nico to fix this bug.
Have someone done it?

EDIT: If you compile the engine without DX SDK then you have no DX Support.

EDIT: Compiling without DX is not good. I have problems to make run new DLL. :( (I use DevC++, but I edit Irrlicht with VC++6)

Posted: Mon May 24, 2004 9:06 pm
by qwe
If you need the directx sdk, I can put it on a cd and send it to you for the cost of media+shipping 8)

Posted: Mon May 24, 2004 9:11 pm
by ZDeveloper
Thanks.
But I have fast internet. I will download it now :).