Jump to content
  • Advertisement
Sign in to follow this  
Artifex

Gun's cylinder state

This topic is 2078 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi. This is my prime post. I would like to ask something about 3d modeling for animation.

I'm finishing a revolver (6 shots) for an FPS test; obviously, when I'll put it in the engine, there will be a sequence of frames where the gun will be:

 

  • full loaded cylinder, emptying, unloaded, reloaded

 

Should I (also in order to spare polygons; each bullet is a 12 sides section extruded, multiplied 12, 'cause each will be triangulated: the poly amount will be generous thus):

 

  • model a full loaded cylinder, where I have visibile just the tips and heads of the bullets (welded to the cylinders' holes, obviously)
  • and also model another cylinder with empty shells falling (and obviously vanishing out of sight) and reloading with new full bullets
  • then arrange a "swapping" during each set of animation (but... how?)?

Or, if the poly count wouldn't be a problem, should I just stick to model an empty cylinder with 6 complets shells in it? Or what?

Share this post


Link to post
Share on other sites
Advertisement

You could: 

Model the bullet and shells apart then parent the bullet to the shell, when a shot is fired you scale the bullet to 0.0 or something very small and move it into the shell.

Now dump the shells and off screen scale them to 1.0 and move them back in place, load the gun with the same shells.

 

Avoid using skinmeshes(bones) to animate the objects.

Most engines prefer animating objects over animating meshes, allowing you to make higher poly models at the cost of a small inconvenience and more objects.

Share this post


Link to post
Share on other sites

The latter option (optimizing and using both a fake full barrel and a real empty barrel) seems too complicated for the benefit it would offer.

 

If you have the gun and the bullets sharing the exact same material (and you're using a decent engine), these elements will be batched together and so you can afford to keep the gun and bullets separate. The barrel of the gun will partially conceal the bullets as well, preventing any redundant pixels of the bullets from being rendered.

Edited by Kryzon

Share this post


Link to post
Share on other sites

I'm targeting both Unity and Cryengine: this test is just a matter for choosing either (provided also a easier programmability; Cryeng is obviously a boldly solid engine, though Unity got a nice price and... I like challenges. I would like to get artistic results using for "indie" tools: this would push also creativity, I guess).

 

The gun (bullets included) will be mapped onto a unique uvmap, 1024^2 (diffuse/normal/cavity/specular; though I think to reduce the latter two to 512^2).

 

So, let me see if I understood: there's no need to model both a empty shell and a full shell, nor a shellcapped cylinder and a void cylinder. In theory I have just to keep the whole bullet (modeling shell AND lead: I guess the latter shouldn't be welded to the former), separated from the cylinder, and use always the whole bullet for every cycle (load/unload/reload).

Though, as for the bullet with and without the lead: could I just reduce the lead to 0% so it will look transcurable to the sight such as desappearing into the shell? Thereafter, in the next cycle (reload), I should just get it back to its original 100% size, with the loader filled with the 6 of them (which are always the same...). Right?

Edited by Artifex

Share this post


Link to post
Share on other sites


So, let me see if I understood: there's no need to model both a empty shell and a full shell, nor a shellcapped cylinder and a void cylinder. In theory I have just to keep the whole bullet (modeling shell AND lead: I guess the latter shouldn't be welded to the former), separated from the cylinder, and use always the whole bullet for every cycle (load/unload/reload).
Though, as for the bullet with and without the lead: could I just reduce the lead to 0% so it will look transcurable to the sight such as desappearing into the shell? Thereafter, in the next cycle (reload), I should just get it back to its original 100% size, with the loader filled with the 6 of them (which are always the same...). Right?

 

Test it and see if it works.

 

There are many different ways to do this, you could use transparent textures, swap meshes, really reload the gun, etc...

A other way to solve this problem is to find a revolver loading style that matched your game.

Share this post


Link to post
Share on other sites

357_reload_HL2.png

 

http://half-life.wikia.com/wiki/Colt_Python#Trivia

 

If you want to be realistic, every time you reload you will dispose of the empty shells as individual objects that fall and bounce on the ground and physically react to the environment.

When they become static (the physics engine reports that they have found a stable position and stopped moving), have fallen into water or simply expired their "display life time" value they can fade away and be deleted from the scene.

 

I was thinking about it. You can "cheat" a little.

You have:

A) A gun with the empty cylinder. This is your basic revolver model.

B) A model of a fresh shell to reload the gun. Always a single model

C) A model of an used shell - that is, just an empty casing. Potentially several copies.

 

The entire "revolver" weapon object is composed of the A, B and C elements (B and C are below the camera, hidden from the player).

When you are reloading the weapon:

- Animate the hands opening the cylinder of the gun, throwing away the C elements from the cylinder (which can be considered as individual rigid-bodies, physics elements that fall out);

- Animate the hands bringing B to the view and inserting B into the cylinder of the weapon. When a slot of the cylinder is filled with B, in a single frame of animation you move that B element below the camera back to where it was and create a copy of C at that slot of the cylinder. Since this is all in a single frame and B and C are visually the same (being viewed from behind), the player won't notice the transition. Then animate the hands going down the screen and picking up the B element again to put it in another slot and create another copy of C there.

So you're using the same single fresh shell to fill all the slots. It's just that moving that shell below instantly makes it look like its a new one that's being picked up every time the hand goes down the screen and brings it back. In the end, you are making it look like you are inserting several Bs into the slots, but every time B is inserted, a copy of C takes its place and it can go back down below the view.

- When done reloading, animate the hands holding the gun again at the ready.

 

This is a common technique with FPS weapon animation. I remember a few guns in Counter Strike that used this in reloading: the hand would grab and detach the magazine of a weapon, then go off-screen with it and bring in a "new one" - if you looked at this animation from an editor, you'd see that the hand simply moved off-screen and came from a different direction holding the exact same magazine, just making it look like it was a fresh one.

Edited by Kryzon

Share this post


Link to post
Share on other sites

Ok. Your consids made me think a couple of things. Let's recap then.

 

- The default onstage's revolver will be already fully loaded and ready to fire; each time the player will select it, it will popup already with its 6 fresh shots loaded in it.

The brass cases will be barely visible inside of it, 'cause I modeled on the gun the side covering "cheecks" which occults the cylinder for more than an half, so the player will see just a tongue of the brass case peeping from the cylinder much covered by the cheecks (and this is good also 'cause I may normalmap the case as already fired in the prime, which in this way wouldn't be seen as alread pinned... but he'll have the eyeblnk to perceive it as fired when the cases will falldown once the cylinder will be opened in order to be emptied).

 

- Standing things this way, as for the reloading animation I guess that we could cheat alot too and in many ways.

E. g. when the cylinder opens, the gun may be bent low at the limit of the edge of the screen, with a speed so that the player will perceive anyway that there was something in it and that now this is falling emptied from its holes: though, he will not see the whole animation nor the fine details (this will save frames and problems of realistic falling).

However, with a fast pace too, he'll see the gun raising again, still with the rolledout cylinder which is being half covered by the loading hand, which apparently has filled it with the speedloader (or also from the cup of the bare hand, now it doesn't matter). Practically, the cylinder will be actually filled again from scratch, and the hand will just appear to have loaded it.

In this case, I could show the cylinder filled with just empty shells (but the player cannot know it, due he sees the gun always from the front...) happy.png nay, this way I could have it filled everytime with empty shells only, without ever thinking to provide a case+bullet variant (just to showing it for the reloading animation, btw).

 

P.s.: nice choice the HL2 revolver: when that was on, it was the best looking around. Mine's a 357 magnum too, and black also. Then the played didn't questioned about the ludicrous appearance of the cylinder, with those copypasted bullet primes; he was distracted by the overall and the game pace (and besides, it was a good model for the times). Though now we become (righteously) more and more demanding of fine models: also 'cause the engines allow us better modeling.

 

P.s: @ninja, what do you mean with "swap meshes"?

Edited by Artifex

Share this post


Link to post
Share on other sites


P.s: @ninja, what do you mean with "swap meshes"?

 

Most of the time your 3d object will exist of parts that makes the object.

 

A object,node or class -> linked to a shader or material -> linked to a mesh or a array of meshes.

This means you can swap the mesh and keep all data of a object like the matrix, material, textures and other variables.

 

e.g. You have a bullet object with a mesh of the bullet before it is fired and a mesh of it fired, you can then swap the meshes like you would textures and materials, keeping the single object.

Share this post


Link to post
Share on other sites

So you mean that I can swap the cylinder of the shooting state (having all the 6 rounds in it) with another with an animation where the rounds are falling,a nd the latter with the firts one with all 6 bullets again in it?

If yes, how?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!