Particle Engine Not Displaying

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.
Post Reply
Will Piovano
Posts: 22
Joined: Sun Oct 15, 2006 10:02 pm

Particle Engine Not Displaying

Post by Will Piovano »

I have a problem with the particle emitter in C#. This is practically identical to the tutorial code, and yet I cannot get the thing to display (it runs fine, but it doesn't display the pe at the origin).

Code: Select all


IParticleSystemSceneNode ps = smgr.AddParticleSystemSceneNode(
                false, null, -10, new Vector3D(0, 0, 0), new Vector3D(), new Vector3D(2, 2, 2));

            ps.ParticleSize = new Dimension2Df(40, 40);

            IParticleEmitter em = ps.CreateBoxEmitter(
                new Box3D(-20, 0, -20, 20, 10, 20), new Vector3D(0.0f, 0.03f, 0.0f),
                80, 100,
                new Irrlicht.Video.Color(0, 255, 0, 255), new Irrlicht.Video.Color(0, 255, 255, 255),
                800, 2000, 0);

            IParticleAffector paf =
                ps.CreateFadeOutParticleAffector(new Irrlicht.Video.Color(), 1500);

            ps.AddAffector(paf);

            ps.SetMaterialFlag(MaterialFlag.LIGHTING, false);
            ps.SetMaterialTexture(0,
                driver.GetTexture("C:/Irrlicht/irrlicht-1.1/media/particle.bmp"));
            ps.SetMaterialType(MaterialType.TRANSPARENT_VERTEX_ALPHA); 
Any ideas?

Thanks in advance.
esaptonor
Posts: 145
Joined: Sat May 06, 2006 11:59 pm

Post by esaptonor »

are you getting any errors in the command line box? Is it managing to load the texture?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Yes, your box emitter creates particles that are completely transparent in color. The first parameter passed to the Color constructor is the opacity. If you set opacity to 0, the color is completely transparent.

Travis
Last edited by vitek on Tue Nov 21, 2006 4:28 pm, edited 1 time in total.
Will Piovano
Posts: 22
Joined: Sun Oct 15, 2006 10:02 pm

Post by Will Piovano »

Hey, you have a good point there, even though both the C++ and C# tuts put opacity 0 for some reason... unless I'm looking at the wrong thing, and I prob am, cause I tried changing the values and still nothing displays:

Code: Select all

IParticleEmitter em = ps.CreateBoxEmitter(
                new Box3D(-20, 0, -20, 20, 10, 20), new Vector3D(0.0f, 0.03f, 0.0f),
                80, 100,
                new Irrlicht.Video.Color(50, 255, 0, 255), new Irrlicht.Video.Color(100, 255, 255, 255),
                800, 2000, 0);
            IParticleAffector paf =
                ps.CreateFadeOutParticleAffector(new Irrlicht.Video.Color(255), 1500);
I tried different values, and also left the constructor params empty for ParticleAffector, but nothing. The texture doesn't seem to be the problem. I don't have the console up but I tried a texture which loads on other models in the world.

Is that the value you meant?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I noticed that you are not setting the particle systems particle emitter. I don't think any particles are being emitted because of this. You need to write ps.SetEmitter(em) after creating the box emitter.

Other things that you could check... Are you absolutely sure that the driver.GetTexture() call is loading the texture? You will probably need to use the TRANSPARENT_ADD_COLOR material. You will most likely need to change the parameter passed to the fade out affector again.

Travis
Will Piovano
Posts: 22
Joined: Sun Oct 15, 2006 10:02 pm

Post by Will Piovano »

ps.setEmitter() does it!! Thanks Travis!

It's really weird that the example code works tho... I must have missed something at some point. Ah well, what matters is that it works!

Thanks again!
Post Reply