Muzzleflash - Emitter or Animation?
by Sabrecyd · in Torque Game Engine · 04/10/2002 (6:15 am) · 10 replies
Here's a general question.
Is it better to have weapon muzzleflashes part of a weapon fire animation or as an emitter?
If the player is running or falling etc while firing a weapon the muzzleflash tends to appear away from the muzzlepoint (when setup as an emitter like the Rifle in the FPS demo). It works great for smoking barrel effects, but flashes look stupid this way. Do games like Red Faction etc use the weapon animation for this instead? I think they do, but maybe someone knows for sure.
Is it better to have weapon muzzleflashes part of a weapon fire animation or as an emitter?
If the player is running or falling etc while firing a weapon the muzzleflash tends to appear away from the muzzlepoint (when setup as an emitter like the Rifle in the FPS demo). It works great for smoking barrel effects, but flashes look stupid this way. Do games like Red Faction etc use the weapon animation for this instead? I think they do, but maybe someone knows for sure.
About the author
#2
11/18/2002 (10:57 am)
most games tend to add it to the DTS, I know that T2 did... I would recommend going about it the same way because if you have lots of muzzleflashes you could easily kill FPS rates.
#3
11/18/2002 (11:13 am)
I prefer attaching a muzzleflash animation to the weapon itself, and then supplementing it with smoke emitter effects.
#4
11/18/2002 (11:37 am)
Max Payne, which had excellent muzzle flashes, used particles. I can see using particles for a muzzle flash in Torque, if only the interpolation and rendering were smoother. I have a particle flash right now but you can easily see 3 distinct steps in it, which looks annoying. I don't think these would be a real drag on fps, considering it could be under 50 particles for the entire flash and it would be rendering for only a few frames. If Torque could create the muzzle flash shape more accurately, I'd say they would be great.
#5
11/18/2002 (1:15 pm)
I would recommend inheriting the velocity so the particles didn't lag behind, if you went with the particle effect method.
#6
11/18/2002 (2:49 pm)
Yes, but at 1.0 it will go ahead of you a lot, so I decided on about .23 I think
#7
12/10/2003 (9:25 pm)
Can anyone tell me where I can find the Crime Force Demo, it is not on the web site anymore. Falling that, any examples of animation muzzle flash will do.
#8
Open /data/server/scripts/(yourweapon).cs, and at the top add something similar to the following:
muzzle_smoke.png is a 32x32 pixel alpha-transparant image of a smokepuff.
Then go down to the image shapebase declaration:
You'll see the declaration of the distinctive weapon states. The default state 3 is the fire state, so add the following at the bottom of the state 3 block:
You can play w/ the values in the particledata datablock in order to make the smoke "rise" from the muzzle of the weapon. Using this, combined with an animation sequence for the muzzle flash itself makes a most realistic effect, especially on larger weapons.
Hope this helps.
12/20/2003 (4:45 am)
Oddly enough, I just solved this problem myself. In the following example the smoke emitter fires for a moment and does not exist long enough to move beyond the bounds of the weapon itself. Because the emitter lifetime is set so low in the fire state, each time the emitter is activated the effect produces a smoke puff of "seemingly" unique nature in size and timing.Open /data/server/scripts/(yourweapon).cs, and at the top add something similar to the following:
datablock ParticleData(myWeaponFireSmokeParticle)
{
textureName = "~/data/shapes/particles/muzzle_smoke.png";
dragCoefficient = 0.0;
gravityCoefficient = 0; // rises
inheritedVelFactor = 0.00;
lifetimeMS = 150; // time in ms
lifetimeVarianceMS = 10; // ...more or less
useInvAlpha = true;
spinRandomMin = -1.0;
spinRandomMax = 1.0;
colors[0] = "0.5 0.5 0.5 0.5";
sizes[0] = 0.01;
};
datablock ParticleEmitterData(myWeaponFireSmokeEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 10;
ejectionVelocity = 0.00;
velocityVariance = 0.0;
thetaMin = 0.0;
thetaMax = 1.0;
particles = myWeaponFireSmokeParticle;
};muzzle_smoke.png is a 32x32 pixel alpha-transparant image of a smokepuff.
Then go down to the image shapebase declaration:
datablock ShapeBaseImageData(myWeaponImage)
{You'll see the declaration of the distinctive weapon states. The default state 3 is the fire state, so add the following at the bottom of the state 3 block:
stateEmitter[3] = myWeaponFireSmokeEmitter; stateEmitterTime[3] = 0.025;
You can play w/ the values in the particledata datablock in order to make the smoke "rise" from the muzzle of the weapon. Using this, combined with an animation sequence for the muzzle flash itself makes a most realistic effect, especially on larger weapons.
Hope this helps.
#9
11/03/2004 (3:04 pm)
Just what I was looking for, Thanks!
#10
www.illumina-game.com/index.php/mod/gallery/file/display/image/87?asc=&sort=i.ad...
11/04/2004 (11:20 am)
I think a combination of a .dts animation and particle effects would be best. Heres a good example of an animation muzzle flash.www.illumina-game.com/index.php/mod/gallery/file/display/image/87?asc=&sort=i.ad...
Torque 3D Owner Michael Cozzolino
Big Monk Games