Particles and particle systems

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
yin nadie
Posts: 43
Joined: Wed Mar 31, 2004 1:03 pm
Location: Seville, Spain
Contact:

Particles and particle systems

Post 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?
ZDeveloper
Posts: 35
Joined: Wed Mar 24, 2004 2:34 pm
Location: Germany
Contact:

Post by ZDeveloper »

I have the problem with rotateting and the camera, too.
I hope someone can help. :)
Look at http://www.z-software.de for interesting games.
yin nadie
Posts: 43
Joined: Wed Mar 31, 2004 1:03 pm
Location: Seville, Spain
Contact:

Post by yin nadie »

O_o

ow can you have this problema witha camera?
ZDeveloper
Posts: 35
Joined: Wed Mar 24, 2004 2:34 pm
Location: Germany
Contact:

Post 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)
Look at http://www.z-software.de for interesting games.
yin nadie
Posts: 43
Joined: Wed Mar 31, 2004 1:03 pm
Location: Seville, Spain
Contact:

Post 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
Domarius
Posts: 178
Joined: Thu Mar 11, 2004 9:51 am
Location: Brisbane, QLD, Australia

Post by Domarius »

Well you should pull apart the examples, because they have particles looking fine from all angles.
yin nadie
Posts: 43
Joined: Wed Mar 31, 2004 1:03 pm
Location: Seville, Spain
Contact:

Post 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.
Domarius
Posts: 178
Joined: Thu Mar 11, 2004 9:51 am
Location: Brisbane, QLD, Australia

Post by Domarius »

Ah okay sorry, I missed that part of your post. Looks like you found a bug I guess.
ZDeveloper
Posts: 35
Joined: Wed Mar 24, 2004 2:34 pm
Location: Germany
Contact:

Post 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.
Look at http://www.z-software.de for interesting games.
yin nadie
Posts: 43
Joined: Wed Mar 31, 2004 1:03 pm
Location: Seville, Spain
Contact:

Post 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
ZDeveloper
Posts: 35
Joined: Wed Mar 24, 2004 2:34 pm
Location: Germany
Contact:

Post 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:
Look at http://www.z-software.de for interesting games.
qwe
Posts: 112
Joined: Sun Dec 28, 2003 12:54 am
Location: Oregon, USA

Post 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.
ZDeveloper
Posts: 35
Joined: Wed Mar 24, 2004 2:34 pm
Location: Germany
Contact:

Post 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)
Look at http://www.z-software.de for interesting games.
qwe
Posts: 112
Joined: Sun Dec 28, 2003 12:54 am
Location: Oregon, USA

Post 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)
ZDeveloper
Posts: 35
Joined: Wed Mar 24, 2004 2:34 pm
Location: Germany
Contact:

Post by ZDeveloper »

Thanks.
But I have fast internet. I will download it now :).
Look at http://www.z-software.de for interesting games.
Post Reply