Three questions on fluid particles

SniperBinaire

15-04-2011 06:38:48

Hi everyone !
I've got a quite stupid problem,as I'm discovering the Detritus version (yes I've been working for a while with bloody mess).
I'm just wondering how can I have an access to the Ogre particles rendered with the Enums::FluidType_OgreParticle option, because I want to have bigger particles. (With the final aim to reduce the number of particles, as I'm actually simulating a waterfall)
So do you how can I increase the size of the particles ?

And another thing : I don't understand how to tweak the emission direction of the emitter, as I've seen a mPose field, bus not an orientation one.

Last thing, in the emitter description, the tutorial said :

edesc.mDimensionX = 0.2f;
edesc.mDimensionY = 0.2f;

But the mDimensionZ don't exist, why ?

betajaen

15-04-2011 07:55:59

I'll have to look up the source code for some of the questions - It's been a while.

mPose should be a Matrix44 which is the position and rotation (as a 4x4 matrix).

SniperBinaire

15-04-2011 18:12:20

Okey, I've understood how to set the orientation of my emitter !
Worked flawlessly with a quaternion and a Vec3.

But my main problem is the particle size, keep me informed !

betajaen

15-04-2011 18:40:54

To change the particle size look it up in the PhysX documentation and find the equilvent method in NxOgre (it would be the same name). This is how I would find it out. I don't have NxOgre memorised you see. ;)

SniperBinaire

15-04-2011 19:42:00

I perfectly understand that you cannot memorize all the NxOgre system, who can ?
But you're very helpful man !

For the PhysX documentation, I doubt.
I'm talking about Ogre particles that we render on the positions calculated by NxOgre.
So I think that we're talking about Critter :wink:
In his code I've founded that function :
void ParticleRenderable::initialise(NxOgre::Fluid* fluid)
{

mFluid = fluid;

mNode = mRenderSystem->getSceneManager()->getRootSceneNode()->createChildSceneNode();
mParticleSystem = mRenderSystem->getSceneManager()->createParticleSystem(
mRenderSystem->getUniqueName("ParticleRenderable"),
mFluid->getMaxParticles() * 2);
mNode->attachObject(mParticleSystem);

mParticleSystem->setDefaultDimensions(0.2f, 0.2f);
mParticleSystem->setMaterialName(mMaterialName);
mParticleSystem->setParticleQuota(mFluid->getMaxParticles());
mParticleSystem->setSpeedFactor(0.0f);

}


In particular, the mParticleSystem->setDefaultDimensions(0.2f, 0.2f); seems to talk about the Ogre particle system.
So I keep searching arround to find a way to get an access to the mParticleSystem field.

But the fact is that the getRenderable() method of the NxOgre::Fluid class return a NxOgre::Renderable* pointer. In my case, I would prefer a Critter::ParticleRenderable* pointer, to gain access to the mParticleSystem field.
But as the Enums::FluidType_OgreParticle isn't the only renderable_type type, this getRenderable() method must return a generic one.

I'm not sure at all of what I'm saying here, but this is the actual point of my search. :?

Try to get an access to that Critter::ParticleRenderable mParticleSystem field...



EDIT :
I think that I've fonded why it's so hard to get the pointer : the Critter:: RenderSystem::createFluid function loss the information by a recursive call :

NxOgre::Fluid* RenderSystem::createFluid(const NxOgre::FluidDescription& description, const Ogre::String& materialName, Enums::FluidRenderableType renderable_type)
{

NxOgre::Fluid* fluid;

if (renderable_type == Enums::FluidType_OgreParticle)
{
ParticleRenderable* renderable = new ParticleRenderable(materialName, this);
fluid = mScene->createFluid(description, renderable);
renderable->initialise(fluid);
}
else
[...]


You create a ParticleRenderable that set the Ogre Particles proprieties, and just after you re-call the createFluid without the Enums::FluidType_OgreParticle option
And as the renderable pointer is local to that function, the information is lost here

You see ?

I repeat, I've just a basic comprehension of this system, I shall be wrong

betajaen

15-04-2011 20:33:04

Do you mean that Enums::FluidType_OgreParticle isn't passed into ParticleRenderable?

You can cast the mRenderable pointer into a ParticleRenderable pointer if you like, then should be able to get access to the mParticleSystem.

SniperBinaire

15-04-2011 21:53:36

You're right !
((Critter::ParticleRenderable*)mFluid->getRenderable())->getParticleSystem()->setDefaultDimensions(1,1);

This line change the particle size !

(Actually I was saying that your fluid with Ogre particle creation is made my creating the particles and recalling the fuild creation without the Enums::FluidType_OgreParticle, and as the ParticleRenderable pointer is local to the creation method, you lose it. But the cast solve the problem)

betajaen

15-04-2011 21:59:33

I understand.

The ParticleRender knows it's a Enums::FluidType_OgreParticle. It does notify Renderable though, in it's constructor though

ParticleRenderable::ParticleRenderable(const Ogre::String& material, RenderSystem* renderSystem)
: NxOgre::Renderable(Enums::FluidType_OgreParticle),
mMaterialName(material),
mRenderSystem(renderSystem),
mParticleSystem(0)
{
}

SniperBinaire

17-04-2011 12:10:58

Well, I'm very sorry, but I do not understand how can I manage the rotation with my 4X4 Matrix.

I have found nothing in the PhysX doc, or in google...
Seems that position, scale and orientation are defined together.
Can you explain me how it work ?

betajaen

17-04-2011 12:25:13

It's just a normal 4x4 translation/rotational matrix. Ogre uses them as well, as most 3D engines.

Matrix44 m = Matrix44(Vec3(2,4,0), Quat(0.707, Vec3(1,0,0)))