| Spark2 Irrlicht integration | |
|
|
|
Author | Message |
---|
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Spark2 Irrlicht integration Sat Jun 23, 2012 11:37 pm | |
| I have been using spark particle engine integrated with irrlicht to leave trails behind moving objects and lately i jumped to spark 2 and i can't replicate the old behaviour. - Code:
-
SPK::Ref<SPK::IRR::IRRQuadRenderer> particleRenderer = SPK::IRR::IRRQuadRenderer::create(device); particleRenderer->setTexture(device->getVideoDriver()->getTexture("res\\explosion.png")); particleRenderer->setTexturingMode(TEXTURE_MODE_2D); particleRenderer->setScale(2.5f,2.5f); particleRenderer->setBlendMode(BLEND_MODE_ALPHA); particleRenderer->setAtlasDimensions(2,2); particleRenderer->enableRenderingOption(SPK::RENDERING_OPTION_DEPTH_WRITE,false);
// Model // Emitter particleEmitter = SPK::SphericEmitter::create(Vector3D(0.0f,0.0f,-1.0f),0.1f * PI,0.1f * PI); particleEmitter->setZone(Point::create(Vector3D(0.0f,0.02f,0.0f))); particleEmitter->setFlow(10); particleEmitter->setForce(0.1f,0.5f); particleSystem = SPK::System::create(false); // Group SPK::Ref<SPK::Group> particleGroup = particleSystem->createGroup(1100); particleGroup->addEmitter(particleEmitter); particleGroup->setRenderer(particleRenderer); particleGroup->setParamInterpolator(SPK::PARAM_TEXTURE_INDEX,SPK::FloatRandomInitializer::create(0.0f,4.0f)); particleGroup->setLifeTime(80.0f,0.0f); particleGroup->setRadius(1.15f); //particleGroup->setGravity(gravity); particleSystem->enableAABBComputation(true); particleSystem->initialize(); this->Powerlvl = 1000; irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(particleSystem,Node, device->getSceneManager(),false); system->setAutomaticCulling(EAC_OFF); system->setID(42); this is my currend code and it's just not working. | |
|
| |
Darktib Committer
Messages : 389 Date d'inscription : 2009-07-20 Localisation : A coté de Paris
| Subject: Re: Spark2 Irrlicht integration Sun Jun 24, 2012 9:51 am | |
| Hello,
What was your old code ? | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Mon Jun 25, 2012 2:12 am | |
| - Code:
-
IRRQuadRenderer* particleRenderer = IRRQuadRenderer::create(device); particleRenderer->setTexture(driver->getTexture("res\\explosion.png")); particleRenderer->setTexturingMode(TEXTURE_2D); particleRenderer->setScale(2.5f,2.5f); particleRenderer->setBlending(BLENDING_ALPHA); particleRenderer->setAtlasDimensions(2,2); particleRenderer->enableRenderingHint(DEPTH_WRITE,false);
// Model Model* particleModel = Model::create(FLAG_RED | FLAG_GREEN | FLAG_BLUE | FLAG_ALPHA |FLAG_TEXTURE_INDEX); //particleModel->setParam(PARAM_ALPHA,0.8f); // constant alpha particleModel->setLifeTime(0.0f,80.0f); particleModel->setParam(PARAM_TEXTURE_INDEX,0.0f,4.0f); // Emitter particleEmitter = SphericEmitter::create(Vector3D(0.0f,0.0f,-1.0f),0.1f * PI,0.1f * PI); particleEmitter->setZone(Point::create(Vector3D(0.0f,0.02f,0.0f))); particleEmitter->setFlow(10); particleEmitter->setForce(0.1f,0.5f);
// Group Group* particleGroup = Group::create(particleModel,1100); particleGroup->addEmitter(particleEmitter); particleGroup->setRenderer(particleRenderer); //particleGroup->addModifier(obstacle); particleGroup->setGravity(gravity); particleGroup->enableAABBComputing(true); particleSystem = IRRSystem::create(Node,smgr); particleSystem->addGroup(particleGroup); particleSystem->enableAABBComputing(true); this was my old code and i was using something like spark 1.5 i think | |
|
| |
Darktib Committer
Messages : 389 Date d'inscription : 2009-07-20 Localisation : A coté de Paris
| Subject: Re: Spark2 Irrlicht integration Mon Jun 25, 2012 12:12 pm | |
| Sorry, forgot to ask before: what is "not working" ? PS: setLifeTime(80,0) is not correct, because its setLifeTime(0,80) . BTW, it does not changes a lot of things. | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Mon Jun 25, 2012 3:15 pm | |
| I was about to post a video of the effet i was creating befor but i need to be a member for more then 7 days ....
w------------ww.youtube.com/watch?v=gSwFZu42MHY&feature=g-upl
This is what i was doing with the previous version now i'm unable to recreate the effect ethier the particles don't show up at all or they are in the ship local space. | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: Spark2 Irrlicht integration Mon Jun 25, 2012 4:37 pm | |
| Hi, If you dont want particles to be in system's space, pass true to the constructor as 3rd parameter. Moreover it is more advised, as the documentation states, to use the constructor of CSPKParticleSystemNode that creates the SPARK system for you : - Code:
-
CSPKParticleSystemNode(ISceneNode* parent,ISceneManager* mgr,bool worldTransformed = true,bool initialize = true,s32 id=-1); Then you have createSPKGroup(int) to create a group and attach it to the system and getSPKSystem to retrieve the underlying system. For gravity, you can add it in SPARK 2 using a Modifier which is called Gravity | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Mon Jun 25, 2012 10:05 pm | |
| Even when passing true the particle don't show up at all i swaped the values and tryed using you way to set it up - Code:
-
irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(Node, device->getSceneManager(),true,true,42); //system->initializeSPK(); system->setParent(this->Node); //Vector3D gravity(0.0f,0.0f,0.0f); SPK::Ref<SPK::IRR::IRRQuadRenderer> particleRenderer = SPK::IRR::IRRQuadRenderer::create(device); particleRenderer->setTexture(device->getVideoDriver()->getTexture("res\\explosion.png")); particleRenderer->setTexturingMode(TEXTURE_MODE_2D); particleRenderer->setScale(2.5f,2.5f); particleRenderer->setBlendMode(BLEND_MODE_ALPHA); particleRenderer->setAtlasDimensions(2,2); particleRenderer->enableRenderingOption(SPK::RENDERING_OPTION_DEPTH_WRITE,false);
// Model SPK::Ref<SPK::Sphere> explosionSphere = SPK::Sphere::create(SPK::Vector3D(0.0f,0.0f,0.0f),0.4f); // Emitter particleEmitter = SPK::SphericEmitter::create(Vector3D(0.0f,0.0f,-1.0f),0.1f * PI,0.1f * PI); particleEmitter->setZone(explosionSphere); particleEmitter->setFlow(10); particleEmitter->setForce(0.1f,0.5f); // Group SPK::Ref<SPK::Group> particleGroup = Group::create(1100); particleGroup->addEmitter(particleEmitter); particleGroup->setRenderer(particleRenderer); particleGroup->setParamInterpolator(SPK::PARAM_TEXTURE_INDEX,SPK::FloatRandomInitializer::create(0.0f,4.0f)); particleGroup->setLifeTime(1.0f,80.0f); particleGroup->setRadius(1.15f); system->addSPKGroup(particleGroup); //particleGroup->setGravity(gravity); this->Powerlvl = 1000; system->setAutomaticCulling(EAC_OFF); and the particle just don't show up at all | |
|
| |
Juff Developer
Messages : 539 Date d'inscription : 2009-07-14 Age : 42
| Subject: Re: Spark2 Irrlicht integration Tue Jun 26, 2012 3:48 am | |
| Ok, i ll try to make your code work and come back to you. Which version of Irrlicht do you use ? | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Tue Jun 26, 2012 10:17 am | |
| | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Thu Jun 28, 2012 9:30 pm | |
| I think i hit the jack pot. i tryed compiling irrlicht with suport for 16 texture and then i started having issue and even when rolling back the only change i made i still get this when trying to compile my project - Code:
-
e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(45): error C3857: 'irr::core::ConstIterator': multiple template parameter lists are not allowed 1>e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Iterator.h(177): error C2248: 'SPK::Particle::Particle' : cannot access private member declared in class 'SPK::Particle' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(221) : see declaration of 'SPK::Particle::Particle' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(39) : see declaration of 'SPK::Particle' 1>e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Iterator.h(196): error C2248: 'SPK::Particle::index' : cannot access private member declared in class 'SPK::Particle' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(224) : see declaration of 'SPK::Particle::index' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(39) : see declaration of 'SPK::Particle' 1>e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Iterator.h(210): error C2248: 'SPK::Particle::index' : cannot access private member declared in class 'SPK::Particle' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(224) : see declaration of 'SPK::Particle::index' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(39) : see declaration of 'SPK::Particle' 1>e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Iterator.h(210): error C2248: 'SPK::Particle::group' : cannot access private member declared in class 'SPK::Particle' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(223) : see declaration of 'SPK::Particle::group' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(39) : see declaration of 'SPK::Particle' 1>e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(45): error C3857: 'irr::core::ConstIterator': multiple template parameter lists are not allowed 1>e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Iterator.h(177): error C2248: 'SPK::Particle::Particle' : cannot access private member declared in class 'SPK::Particle' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(221) : see declaration of 'SPK::Particle::Particle' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(39) : see declaration of 'SPK::Particle' 1>e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Iterator.h(196): error C2248: 'SPK::Particle::index' : cannot access private member declared in class 'SPK::Particle' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(224) : see declaration of 'SPK::Particle::index' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(39) : see declaration of 'SPK::Particle' 1>e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Iterator.h(210): error C2248: 'SPK::Particle::index' : cannot access private member declared in class 'SPK::Particle' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(224) : see declaration of 'SPK::Particle::index' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(39) : see declaration of 'SPK::Particle' 1>e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Iterator.h(210): error C2248: 'SPK::Particle::group' : cannot access private member declared in class 'SPK::Particle' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(223) : see declaration of 'SPK::Particle::group' 1> e:\users\david\documents\visual studio 2010\projects\sparkengine\spark2\include\Core/SPK_Particle.h(39) : see declaration of 'SPK::Particle' | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Sun Jul 22, 2012 4:21 am | |
| After a while i came back to spark and tested it some more it would seem particle are only emited in local space | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Sun Jul 22, 2012 12:54 pm | |
| est que je devrais ouvrir un topic dans la section francais?
Car il sempblerai que le parametre pour emetre les particule dans le "worldspace" ne fonctione pas et je ne comprend pas pourquoi | |
|
| |
Darktib Committer
Messages : 389 Date d'inscription : 2009-07-20 Localisation : A coté de Paris
| Subject: Re: Spark2 Irrlicht integration Mon Jul 23, 2012 4:49 am | |
| There is a small bug in CSPKParticleSystem: 2 boolean parameters are inverted in the constructor between header and source. It's fixed on my local repo, but not commited. For the moment, you have to do the following: - Code:
-
// Notice the 'true' added here, it's for the parameter 'initialize'. // |||| // vvvv system = CSPKParticleSystemNode(parentSceneNode,smgr, true,worldTransformed);
| |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Mon Jul 23, 2012 1:00 pm | |
| i have always used it this way but no the bug is even worst - Code:
-
irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(NULL, device->getSceneManager(),false,true,43); irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(NULL, device->getSceneManager(),true,true,43); this no particle show up at all - Code:
-
irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(NULL, device->getSceneManager(),false,false,43); irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(NULL, device->getSceneManager(),true,false,43); particle show up in local space | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Sun Jul 29, 2012 2:26 pm | |
| anyone suceedded at having a moving node leave particle behind as it move with spark 2? because for now this is a complete mistery | |
|
| |
Darktib Committer
Messages : 389 Date d'inscription : 2009-07-20 Localisation : A coté de Paris
| Subject: Re: Spark2 Irrlicht integration Tue Jul 31, 2012 3:27 am | |
| Can you post the whole code please ? Will test next week (for the moment I'm too busy...). | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Wed Aug 01, 2012 10:27 am | |
| I already posted the full code earlier the particle scene node is only a children of a moving node.
if you mean i should post my entire project i don't think you wan me to post my 10 000 line engine | |
|
| |
Darktib Committer
Messages : 389 Date d'inscription : 2009-07-20 Localisation : A coté de Paris
| Subject: Re: Spark2 Irrlicht integration Sun Aug 19, 2012 12:35 pm | |
| Bug fix done, should work now. Also, the parameter inversion was fixed. | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Thu Aug 23, 2012 12:52 am | |
| i updated but the code is still not working - Code:
-
irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(NULL, device->getSceneManager(),true,false,43); //Vector3D gravity(0.0f,0.0f,0.0f); SPK::Ref<SPK::IRR::IRRQuadRenderer> particleRenderer = SPK::IRR::IRRQuadRenderer::create(device); particleRenderer->setBlendMode(BLEND_MODE_ALPHA); particleRenderer->enableRenderingOption(SPK::RENDERING_OPTION_DEPTH_WRITE,false); particleRenderer->setTexture(device->getVideoDriver()->getTexture("res\\explosion.png")); particleRenderer->setTexturingMode(TEXTURE_MODE_2D); particleRenderer->setScale(2.5f,2.5f); particleRenderer->setAtlasDimensions(2,2); // Model // SPK::Ref<SPK::Sphere> explosionSphere = SPK::Sphere::create(SPK::Vector3D(0.0f,0.0f,0.0f),0.4f); // Emitter particleEmitter = SPK::SphericEmitter::create(Vector3D(0.0f,0.0f,-1.0f),0.1f * PI,0.1f * PI); //particleEmitter->setZone(explosionSphere); particleEmitter->setFlow(10); particleEmitter->setForce(0.5f,0.5f); // Group SPK::Ref<SPK::Group> particleGroup = Group::create(1100); particleGroup->addEmitter(particleEmitter); particleGroup->setRenderer(particleRenderer); particleGroup->setParamInterpolator(SPK::PARAM_TEXTURE_INDEX,SPK::FloatRandomInitializer::create(0.0f,4.0f)); particleGroup->setLifeTime(1.0f,80.0f); particleGroup->setRadius(1.15f); system->addSPKGroup(particleGroup); system->initializeSPK(); system->setParent(Node); | |
|
| |
Darktib Committer
Messages : 389 Date d'inscription : 2009-07-20 Localisation : A coté de Paris
| Subject: Re: Spark2 Irrlicht integration Thu Aug 23, 2012 7:02 am | |
| - Code:
-
irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(NULL, device->getSceneManager(),true,false,43); should be - Code:
-
irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(NULL, device->getSceneManager(),true,true,43); (the last boolean is for initialization of the inner SPK::System). With 'worldTransformed = true', you have to set the transform to the scene node, not the SPK::System. | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Thu Aug 23, 2012 2:30 pm | |
| well this should be taken care of here - Code:
-
system->initializeSPK(); system->setParent(Node); when the particle become child to an other node ut it does not work and nothing is shown how ever disabeling world transformed get me some particle drawn in the ship local space anywayi changed the code to make initialisation here and assing parent here to now this show particle in node local space - Code:
-
irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(Node, device->getSceneManager(),false,true,43); this sow nothing - Code:
-
irr::scene::CSPKParticleSystemNode* system = new irr::scene::CSPKParticleSystemNode(Node, device->getSceneManager(),true,true,43); | |
|
| |
Darktib Committer
Messages : 389 Date d'inscription : 2009-07-20 Localisation : A coté de Paris
| Subject: Re: Spark2 Irrlicht integration Thu Aug 23, 2012 5:25 pm | |
| O_o ? I tested it though...
Can you post the portion of the code which controls the node, or system transform ?
Some dumb questions...: did you update the dlls? have you tried to recompile ? | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Thu Aug 23, 2012 7:48 pm | |
| the transformation is done by a physic engine
also i recompiled the spark2 dll but they are the exact same weight and i didnot see any aditional file compiled
unlesss there is a bug in my way of initiating the rest of the system | |
|
| |
Darktib Committer
Messages : 389 Date d'inscription : 2009-07-20 Localisation : A coté de Paris
| Subject: Re: Spark2 Irrlicht integration Sat Aug 25, 2012 4:54 am | |
| - granyte wrote:
- the transformation is done by a physic engine
OK, but how do you transfer it to the effect? You set the scene node transform (setPosition, setRotation & co), or the SPK::System transform ? - granyte wrote:
- also i recompiled the spark2 dll but they are the exact same weight and i didnot see any aditional file compiled
Only two lines were changed, no files added or removed in this revision, should be normal. I tested the revision with the Irrlicht test, making the CSPKParticleSceneNode rotating around the Y axis: - Code:
-
float x = cos(time * irr::core::PI); float z = sin(time * irr::core::PI); irrSystem->setPosition(irr::core::vecvtor3df(x,0.0f,z));
You can test it if you want. | |
|
| |
granyte
Messages : 53 Date d'inscription : 2012-06-23
| Subject: Re: Spark2 Irrlicht integration Sat Aug 25, 2012 1:13 pm | |
| i make the particle system child of a scene node and then i set the transform of that scene node | |
|
| |
Sponsored content
| Subject: Re: Spark2 Irrlicht integration | |
| |
|
| |
| Spark2 Irrlicht integration | |
|