good muzzle flashes - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Design (/forum-5.html)
+--- Thread: good muzzle flashes (/thread-7507.html)
Pages: 1 2
good muzzle flashes - Namoreh - Nov 5, 2002 08: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
P.S. The new emoticons make me laugh.
good muzzle flashes - w_reade - Nov 5, 2002 09: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.
good muzzle flashes - Ian Kerr - Nov 5, 2002 10:27 PM
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...
good muzzle flashes - henryj - Nov 6, 2002 12: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.
good muzzle flashes - w_reade - Nov 7, 2002 02: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:.
good muzzle flashes - Namoreh - Nov 7, 2002 02: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.
good muzzle flashes - David - Nov 8, 2002 01: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
good muzzle flashes - w_reade - Nov 8, 2002 07: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.
good muzzle flashes - codemattic - Nov 8, 2002 09:58 AM
Quote:Originally posted by w_reade
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.
good muzzle flashes - w_reade - Nov 8, 2002 11:34 AM
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.]
good muzzle flashes - David - Nov 8, 2002 03: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.
good muzzle flashes - Namoreh - Nov 8, 2002 08: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 (those objective matches are great, anyone else here play, maybe we've killed eachother ?).
Thanks for the help
good muzzle flashes - Feanor - Nov 8, 2002 09:17 PM
Check out America's Army -- a-mazing muzzle flashes, just look at the screen shots. I've never played the game.
good muzzle flashes - codemattic - Nov 8, 2002 10:59 PM
Quote:Originally posted by w_reade
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,
good muzzle flashes - w_reade - Nov 8, 2002 11:41 PM
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 :-).