good muzzle flashes

Namoreh
Unregistered
 
Post: #1
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.
Quote this message in a reply
w_reade
Unregistered
 
Post: #2
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Ö Smile

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.
Quote this message in a reply
Member
Posts: 49
Joined: 2002.05
Post: #3
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
Quote this message in a reply
henryj
Unregistered
 
Post: #4
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.
Quote this message in a reply
w_reade
Unregistered
 
Post: #5
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:.
Quote this message in a reply
Namoreh
Unregistered
 
Post: #6
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
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #7
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 Smile
Quote this message in a reply
w_reade
Unregistered
 
Post: #8
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.
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #9
Quote: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
Quote this message in a reply
w_reade
Unregistered
 
Post: #10
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.]
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #11
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.
Quote this message in a reply
Namoreh
Unregistered
 
Post: #12
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 Wink ?).

Thanks for the help
Quote this message in a reply
Feanor
Unregistered
 
Post: #13
Check out America's Army -- a-mazing muzzle flashes, just look at the screen shots. I've never played the game.
--FÎanor
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #14
w_reade,

Quote: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
Quote this message in a reply
w_reade
Unregistered
 
Post: #15
It's all too easy to do. No offence meant, none taken Smile.

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
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Why good ideas beat good graphics BeyondCloister 38 15,845 Jun 6, 2005 09:38 AM
Last Post: Dan Potter