View Full Version : good muzzle flashes
Namoreh
2002.11.05, 10:13 PM
I'm working on a 3D war game, and it's going well, but I need to know of any good methods for creating convincing muzzle flashes, one possibility I was considering was having 3 planes: 2 forming an X that are both a side view of a muzzle flash (like how trees are done sometimes) and a front view of a muzzle flash on a plane perpindicular to the other planes toward the side near the gun barrel.
I have a feeling this won't look very good though, I've seen some games where Muzzle Flashes seem very convincing, and was wondering if anyone knows of any good techniques.
Hope that description wasn't horribly confusing. :o
~Namoreh
P.S. The new emoticons make me laugh.
w_reade
2002.11.05, 11:48 PM
I'm not sure I know what a real muzzle flash looks like, but I doubt it looks much like the ones we see in some gamesÖ :)
I'm not sure the 3-plane thing would look good as it stands, but (and this is just an idea), you could have the 3 planes as described and only show those planes which are not nearly edge-on to the camera. It might well look ok - I imagine that with a bit of tinkering to the "nearly" value, you could get something that looked fairly convincing.
I'd make the textures very bright, but draw them fairly transparent, and have particle sparks and/or smoke if I felt I needed (and could afford) them.
Now I come to think of it, how about the 3-plane solution, but fade their transparencies according to their orientation - edge-on planes become transparent, planes precisely facing the camera have the greatest alpha(which still may not be that high), and those in between have alpha values in between.
But do try anything you think of - experimentation reaps great rewards when trying to create visual effects.
Ian Kerr
2002.11.06, 12:27 AM
When I was making a "Special Ops" movie with some friends I had the job of creating muzzle flashes on the computer. I watched Die Hard 2 pretty much frame by frame and noticed that the muzzle flashes were very bright and they all had a glow around the edge. For the most part they were completely white, except for the glow, which had a slight blue tint (think blue flame). Also, the flashes were quite large, in this case, about equal to the length of the gun. They seemed fairly opaque though this could vary from gun to gun. Hope this helps...
--Ian
henryj
2002.11.06, 02:26 AM
What you described would probably work fine though I'd just use one billboarded quad. How long is the flash going to be on screen? Probably not long enough for anyone to notice.
w_reade
2002.11.07, 04:55 AM
I was thinking more like vast tongues of fire jetting out of the gun - not realistic, perhaps, but whenever people do muzzle flashes in games they're a bit overblown, and I see no reason for these not to be :-).
Speaking of overblown - have you seen the Warthog machinegun in Halo? Now there's a muzzle flash for you :eek:.
Namoreh
2002.11.07, 04:14 PM
Thanks for the suggestions, basing the alpha of the planes on how close to edge-on they are sounds like it could work out well. What exactly is the math for this, or a site that has an example of this? (sorry if it's easy, because I always hated people in my math classes who asked stupid questions)
Thanks for the help.
~Namoreh
David
2002.11.08, 03:00 AM
The easiest way and I think the best is just to draw the three quads, two forming a cross parallel to the gun and the third as a billboarded (not perpendicular to the others) quad right at the end of the barrel.
A realistic muzzleflash pretty much doesn't exist. In real life most of the time you can't see muzzle flashes except occasionally as faint light spots. Flamy flashes are fun though :)
w_reade
2002.11.08, 09:21 AM
Let V be the cross product of the unit vectors in the directions [normal to the plane you're interested in] and [pointing forward from the camera]. Try multiplying the alpha of the plane by (1 - size(V)).
Note: I'd give you the formula properly, but I'm on a pc, so the keyboard's all wrong. Where [ x ] means 'modulus of x', A and B are vectors, t is the angle between them and N is a unit vector perendicular to both:
A x B = N[ A ][ B ]sin(t)
So if A and B are already normalised, we get [ A x B ] = sin(t), and the nearer sin(t) is to one, the nearer your plane is to being edge-on to the camera.
...as I recall. If you try this, do let me know if it works.
codemattic
2002.11.08, 11:58 AM
Originally posted by w_reade
Let V be the cross product of the unit vectors in the directions [normal to the plane you're interested in] and [pointing forward from the camera].
you are probably thinking of dot product. Cross product returns a vector perpendicular to all the parameter vectors. If we are talking about 3D vectors and C = A cross B then C is a vector that is perpendicular to both A and B. If A and B are unit length, then so is C.
if A = normal to the plane you're interested in and B = unit vector pointing forward from the camera, then A dot B tells you how 'edge-on' you are. The closer A dot B is to zero - the closer to 'edge-on' while the closer the absolute value of A dot B is to one - the closer to 'face-on' you are.
hth,
Codemattic
w_reade
2002.11.08, 01:34 PM
There's a definition of the dot product in terms of cos, and a definition of the cross product in terms of sin (as I gave). So, "dot product close to zero" is equivalent to "modulus of cross product close to one".
So, either would give you the results you wanted - although I accept that doing it in terms of the dot product will indeed be more computationally efficient.
Thanks for pointing it out though :-).
[edit: ps - try taking the cross product of two parallel unit vectors, and then try telling me that it's always equal to one. However, if a and b are perpendicular unit vectors, then c = axb will indeed also be a unit vector.]
David
2002.11.08, 05:21 PM
I think I'll just point out that muzzleflash method would probably work better, because unless the two X quads are using GL_SRC_ALPHA,GL_ONE and have an alpha of 1, the cross will be pretty obvious where the two quads overlap.
Namoreh
2002.11.08, 10:24 PM
alrighty, I'll try out some of this stuff and see what I can get.
unfortunately I have a lot to do this weekend, and I just wasted the last 6 hours playing Medal of Honor online :rolleyes: (those objective matches are great, anyone else here play, maybe we've killed eachother ;) ?).
Thanks for the help
Feanor
2002.11.08, 11:17 PM
Check out America's Army (http://www.aafiles.com/file.stuff?body=Screenshots) -- a-mazing muzzle flashes (http://www.gamingfiles.com/screenshots/19/others/dietargets.jpg), just look at the screen shots. I've never played the game.
--FÎanor
codemattic
2002.11.09, 12:59 AM
w_reade,
Originally posted by w_reade
So, either would give you the results you wanted - although I accept that doing it in terms of the dot product will indeed be more computationally efficient.
correct. I read your original post too hastily - and I forgot that 'modulus' in this case means length. I was thinking 'remainder' for 'modulus' and had a brain freeze. My apologies,
Codemattic
w_reade
2002.11.09, 01:41 AM
It's all too easy to do. No offence meant, none taken :).
OT, are you a maths person too? Not many people I know (who haven't done it at university) know even one meaning of modulus :-).
Cheers,
william
codemattic
2002.11.11, 01:55 AM
Originally posted by w_reade
It's all too easy to do. No offence meant, none taken :).
OT, are you a maths person too? Not many people I know (who haven't done it at university) know even one meaning of modulus :-).
no - Im a Math wannabe. Im constantly reading math and programming books. But owing to the fact that I have a small particle of brain lodged in my skull* - Im only able to absorb bits and pieces here and there.
I knew the meaning as far as remainder. Im currently reading "The Moment of Proof - mathematical epiphanies" by Donald C. Benson, and the term modulus came up in the section about graphing vectors on the complex plane - which was the first time I heard of it used to mean length - so I should of known (but particle of brain and all that) - I was currently reading the part about cryptography and primes and so that used the term for the other meaning so thats what stuck in there last.
There is just all these deep connections between math and logic and programming and music and ... well if I had the chops and a greater insight to be able to tie those things together in some meaningful way...
-Codemattic
* extra points if you know where I stole the joke from.
hyperzoanoid
2002.11.13, 10:49 PM
ive been looking at alot of muzzle flashes and i think i should share some observations about them.(i dont know if it is right or not so dont take my word)
1)A muzzle flash is an explosion, except it has an opening to go out of.
2) the speed and spin of the bullet creates a vacuum, and the explosion gets sucked in, which is why you get that jagged triangle shape. This also explains why shotgun muzzle flashes are rounded more, because there are more projectiles creating vacuums in different directions.
3) Tank brass eject becomes more rounded because the explosion matures from spikey to spherey. And im guessing that they have more time to mature because the explosions have more volume? Im still not sure why tank brass eject lasts longer.
HTH
;)
hyperzoanoid
2002.11.13, 10:52 PM
now that i think of it, the speed of tank projectiles is less, so the explosion from the shell isnt sucked as much by the vacuum, and it expands on its own, which possibly makes it react slower. Once again, im not sure
Steven
2002.11.25, 04:53 PM
Originally posted by Feanor
Check out America's Army (http://www.aafiles.com/file.stuff?body=Screenshots) -- a-mazing muzzle flashes (http://www.gamingfiles.com/screenshots/19/others/dietargets.jpg), just look at the screen shots. I've never played the game.
--FÎanor
Talk about overdone!!!
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.