Game Development Community

dev|Pro Game Development Curriculum

Particle Ribbon Preview

by Adam Armstrong · 07/30/2013 (1:44 pm) · 30 comments

www.xoltan.org/img/ribbon01.jpg
First a little caveat. This is by no means finished, but I'm posting this to gather some momentum after a few minor life challenges. I've had this working for more than a month just sitting, and getting it out in the wild will provoke me into getting a proper release going.

This is a simple change that connects the quads of a particle emitter's particles end to end. It's handy when you want a long stream of particles without gaps, like a trail behind a projectile. I like it for bullet trails. In a pinch it could also be something like cigarette or muzzle smoke.

The only other thing it does is add an angle limit for deviation from the angle the previous particle was ejected at. I found this mitigated the harsh angles the ribbons can form, and can be handy for normal particles as well. I don't believe its shown in the screenshot, but the gui has been updated for this too.

www.xoltan.org/files/particle_ribbons.zip

That just contains the two changed source files and the updated gui. You'll need to know where things go to use this. You'll also need an image that tiles left to right for your ribbon particle - really, it looks terrible without a tiling particle image. I know that isn't terribly useful out of the box, so goad me into a better release. I do plan on making a proper pull request and including some particles.
Page«First 1 2 Next»
#21
08/09/2013 (11:34 pm)
Adam I'd sure like to have this for the game I'm working on ^_^, I think if you could add 2-3 ribbons at once for the projectile it'd make a superb cannon! hit me up at lethedethius@gmail.com please =-)
#22
08/10/2013 (8:59 am)
@Adam:

Quote:
The ribbon particles don't necessarily remove themselves immediately if there is lifetime variance - otherwise there is an ugly popping of geometry at the end of the ribbon.

Was an emitter already running when you clicked 'Render as a Ribbon' ? If there aren't any particles for the emitter then they should be golden if you check it and then fire things up. I'll have to add something that checks for that on the fly.

I got past that, can fire one particle, when the second is fired it crashes with same error...

Particle:

datablock ParticleData(laserTestParticle : DefaultParticle)
{
   sizes[0] = "0.997986";
   sizes[1] = "0.997986";
   sizes[2] = "0.997986";
   sizes[3] = "0.997986";
   times[1] = "0.329412";
   times[2] = "0.658824";
   lifetimeMS = "50";
   lifetimeVarianceMS = "0";
   textureName = "art/particles/laser02.png";
   animTexName = "art/particles/laser02.png";
};

Emitter:

datablock ParticleEmitterData(testLaserEmitter : DefaultEmitter)
{
   particles = "laserTestParticle";
   thetaMax = "0";
   orientParticles = "1";
   alignParticles = "1";
   alignDirection = "1 0 0";
   ribbonParticles = "1";
   lifetimeMS = "0";
};

Care to share datablock values?
#23
08/12/2013 (4:58 pm)
@James - have three projectiles?

@Gibby - When I made my first reply I had assumed you had found a bug that I had missed because I had already had my test particles set up when I added the variable length lifetime to the particle ribbons. After seeing your second post, I sat down with a fresh copy of T3D 3.0, copied my files in, made a tiling particle texture, and tried your test emitter/particle.

It was fine. It didn't look like anything - I had to adjust it for that, but I wasn't able to get it to crash at all. The assumption I made in the first post was wrong, and it doesn't seem to have that problem at all. I know that isn't helpful, and I'm sorry. I am going to refactor that section, just to make sure it isn't a problem going forward, but I don't know what to tell you right now.

After pasting your datablocks into particles.cs and making changes with the particle editor, here is what they looked like:

datablock ParticleData(laserTestParticle : DefaultParticle)  
{  
       sizes[0] = "0.997986";  
       sizes[1] = "0.997986";  
       sizes[2] = "0.997986";  
       sizes[3] = "0.997986";  
       times[1] = "0.329412";  
       times[2] = "0.658824";  
       lifetimeMS = "500";  
       lifetimeVarianceMS = "100";  
       textureName = "art/particles/splash2.png";  
   animTexName = "art/particles/splash2.png";
   inheritedVelFactor = "0.1";
       //animTexName = "art/particles/splash2.png";  
};

datablock ParticleEmitterData(testLaserEmitter : DefaultEmitter)  
{  
       particles = "laserTestParticle";  
       thetaMax = "0";  
       orientParticles = "0";  
       alignParticles = "0";  
       alignDirection = "1 0 0";  
       ribbonParticles = "1";  
       lifetimeMS = "0";  
   softnessDistance = "1";
   blendStyle = "ADDITIVE";
   ejectionVelocity = "0";
};

That ends up looking like:
xoltan.org/img/ribbon03.jpg
#24
08/21/2013 (9:31 am)
@Adam:

Thanks for the reply. I've been tied up with IRL issues, will give it another go and let you know the results...
#25
08/21/2013 (9:37 am)
@Adam what license is this released under? MIT?

I'd like to include it into the upcoming update of IPS.
Not because I want to take credit for it, but because I've changed the infrastructure of the Particle System and therefore I'd like to place the Ribbon Particles into a RibbonParticle class so it's easier for IPS customers to utilize this code.

Would you have any problems with that? I will make sure to give you the credit for the Ribbon Particle code.
#26
08/21/2013 (10:22 am)
@lukas: I intend to make a proper pull request and get this into stock T3D, at which point it would be under the MIT license I suppose. Since that is the case, I don't have a problem with it being included in IPS.
#27
08/22/2013 (12:21 pm)
@Adam:

Still stumped - I installed a fresh copy of T3D 3.0, added the three files, and got the same result. Tried a couple different .png files to see if the file was the culprit, all the same. Wondering if it's how I'm using it - using the datablocks you posted, I added this line to Lurker.cs around line 221:

particleEmitter     = "testLaserEmitter";

I go into Empty Mission, fire the Lurker and in Release it works wonderfully (YES!!!), in Debug I get a few rounds off but eventually get the error related to this:

t3d\fx\particleemitter.cpp(1443) : Fatal - Out out bounds filter function for particle


Wondering if it still might be file related?

Wondering if you've tried it with animated materials - should this work as normal (I haven't progressed far enough to try it yet)?
#28
08/22/2013 (10:13 pm)
Gibby, it's awesome that you are sticking with this and giving me feedback. I appreciate it.

When I used it, I just used the datablock editor and gave some projectile a particle emitter. It's very interesting about the debug/release differences - I think I've just been using release when dealing with this. Makes sense since it seems to be failing on an assertion. I'll try a debug build and see what happens.

I haven't tried an animated material - it miiight work, but given the way the ribbons look, I don't think I'd go to much trouble to support them if they are broken.
#29
10/10/2013 (7:58 am)
Awesome resource Adam, it is going to be quite useful.
#30
05/14/2014 (12:17 pm)
@Adam: github.com/GarageGames/Torque3D/pull/648 up as we discussed in IRC. Let me know if the alterations meet your approval, or if you'd like further ones.
Page«First 1 2 Next»