| How to Make two Global transform on particles | |
|
|
Author | Message |
---|
DEMonRouge
Messages : 9 Date d'inscription : 2010-09-06
| Subject: How to Make two Global transform on particles Sun Jan 16, 2011 5:37 pm | |
| Hi. I have a very complicated request.
It is possibile to spark render particles using two different transformation matrices?
This is needed by my infinite world game engine.
1) All particles are rendered with the transformation 1 (I use irrlicht, but in openGL is easy, just a pushmatrix) 2) I retranslate the world when i reach a certain point, so I update the transformation 1 of particels in a way that they seem to be always in their location 3) New particels are now rendered with transformation 2 and in few time particles with transformation 1 will end their life. 4) When i reach again world section limit I retranslate the whole world and also particles with transformation 2 5) Now new particles are rendered again with transformation 1.
I hope i have explained well my idea. any suggestion is wellcome
Theorically this is not too complicated, but I have also to do that thinking to the irrlicht rendering API. and Spark_IRR | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: How to Make two Global transform on particles Mon Jan 17, 2011 5:14 am | |
| Hi,
I supposed your using world transformed particles (and not local transformed particles) ?
If you're using world transformed particles, the transform has no effect on particles once emitted but only on the emitters/modifiers... So if you want to translate already emitted particles, you ve got to translate their position one by one.
If you're using local transformed particles, changing the transform of the system will change the position of all particles, so particles will be well translated anyway.
PS : I have moved this discussion to "Questions" | |
|
| |
DEMonRouge
Messages : 9 Date d'inscription : 2010-09-06
| Subject: Re: How to Make two Global transform on particles Mon Jan 17, 2011 2:19 pm | |
| The pg move around the world. when it is too far from absolute origin the whole world is retranslated into the origin. So i can make local transformation usign irrlicht and move the particles?
The system i use works for scenenodes. I guess if it is possible treat the whole (or half) of rendered particles as a single scene node using only 1 transformation. (or better use 2 scene nodes wich will contain the whole particle system) | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: How to Make two Global transform on particles Mon Jan 17, 2011 2:30 pm | |
| Try creating your IRRSystem with worldTransformed to false (its a parameter of the constructor). In that way, when applying a transform to the system, particles will be transformed as well so it basically works as any Irrlicht SceneNode
When having the worldTransformed set to true (the default value), when a system is transformed, its emitters, modifiers... are transformed but not the particles which are emitted in the world coordinate system. | |
|
| |
DEMonRouge
Messages : 9 Date d'inscription : 2010-09-06
| Subject: Re: How to Make two Global transform on particles Mon Jan 17, 2011 2:33 pm | |
| OK i'll try to do that thank very much | |
|
| |
DEMonRouge
Messages : 9 Date d'inscription : 2010-09-06
| Subject: Re: How to Make two Global transform on particles Thu Feb 24, 2011 7:19 am | |
| OK i got it working. I have 2 IRRsystems. One system is transformed global. So particles will be translated with it parents the other system emits transformed particles but emitted ones stay where they are. I'm using it in a space shooter game. Have I to use a system for every space ship? Or there is a way for add transformation also to groups? The player space ship is shooting correctly and particles are translated with it when the space ship is being translated. But every enemy use a different transformation. And i don't think using N IRRsystems is very clockwise. Can I do the following?: 1 IRRsytem has many groups(1 group for each irrlicht scene node) for every group: - Code:
-
ISceneNode* IrrlichtSceneNode=this;
matrix=IrrlichtSceneNode->getTransform(); emitter->setTransform(matrix); group->setTransform(matrix); modifier->setTransform(matrix);
| |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: How to Make two Global transform on particles Mon Feb 28, 2011 5:04 pm | |
| Well you can use one system per enemy. Or you can regroup all the particles effect for enemies into one system. Note that you can transform groups if you want (as they derived from transformable) but having n systems with each 1 group or 1 system with one group wont change a lot of things in terms of performance as systems are actually just a container of groups, there wont be more batching. What you can do if you want to batch the update and rendering is to use 1 system of 1 groups with n emitters ; one emitter per enemy. As you can transform emitters either, for each enemy you'll be able to set its emitter's transform. However note that batching this way may improve performance but can decrease them in some case :
- If you are culling on a per enemy basis, with n systems you can cull individually. With 1 system, you must update and render all particles at each frame.
- If you are using some algo with a complexity that is not linear (for instance particle sorting, or particle against particle collisions), you will lose performance.
| |
|
| |
Sponsored content
| Subject: Re: How to Make two Global transform on particles | |
| |
|
| |
| How to Make two Global transform on particles | |
|