Home Technical Talk

Do 3D weapons generally contain a bullet in their texture maps?

polycounter lvl 3
Offline / Send Message
coolguyslims polycounter lvl 3

Hello,

I recently completed a game ready handgun model following Eugene Petrov's Handgun for Videogames series. In the series he includes a bullet with his texture maps. I was wondering is this common practice? Why not just have the bullets as a separate mesh to save UV space? It is a separate object after all, right?

This is the model:

https://www.artstation.com/artwork/8wkOBn

Thanks for the help.

Replies

  • Tiles
    Offline / Send Message
    Tiles interpolator

    Hi coolguyslims,

    It depends. An Extra texture means Extra material == Extra draw call. You want to save draw calls where ever you can. Two meshes with the same material can still be batch rendered as one.

    Kind regards

    Tiles

  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter

    probably somewhere on your guns uv layout is enough extra space to fit a bullet. in game bullets will be really small so they probably don't need high resolution.

  • Joopson
    Offline / Send Message
    Joopson quad damage

    Yeah, this; not sure if it's common practice, but it makes good sense in a lot of cases.

  • Eric Chadwick

    It's helpful to include if the player sees the bullet alongside the gun, for example when there's a reload animation.

  • Tiles
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter

    Don't get too excited about draw calls these days. There are a multitude of ways to get around that problem and very few require the artist to actually think about it

  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter

    Animated meshes are never batched because their vertexes are moving in the world. So you don't get any advantage from atlasing them together. If the bullet is part of the same mesh then there might be an advantage. But often bullets are a part of a particle system or animated using physics. So they can't be grouped into the same category as the gun - which is almost always skeletal animation of some kind.

  • Tiles
    Offline / Send Message
    Tiles interpolator

    That's why i said it depends. I expect that the magazine with the bullets is part of the same mesh. And not a bullet that gets shot around.

    Don't get too excited about draw calls these days. There are a multitude of ways to get around that problem and very few require the artist to actually think about it

    Long years game developer here. Draw calls are still important.

  • Tiles
    Offline / Send Message
    Tiles interpolator
    • Dynamic batching: For small enough meshes, this transforms their vertices on the CPU, groups similar vertices together, and renders them in one draw call.


  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter

    Not sure what that says that sprunghunt didn't already say.

    Since you brought it up though I can explain my earlier post.

    Batching is good because it collects similar materials into batches and renders them together in order to minimise state changes on the GPU (which are bad because they are wasteful).A material in this context is the base shader type (eg opaque, alpha tested,etc)

    A change in material occurs when a parameter is altered - traditionally that would be provoked by changing a texture or altering a multiplier etc.

    Because technology is marvelous there are a number of ways to get around this problem. Eg. Texture arrays and parameter instancing allow variation between material instances without altering a parameter.

    The result of doing this is that you can assign 50 instances of a material type to an object and see no state changes - i.e 1 draw call.(in laboratory conditions)

    Assuming you set things up well the asset artist is not in a position to significantly affect the number of draw calls on screen unless they're authoring their own materials (which is always a terrible idea).

  • coolguyslims
    Offline / Send Message
    coolguyslims polycounter lvl 3

    Woah, woah - I think this is a bit past my understanding...

    I've never touched Unity Engine before, yet alone know what a draw cell even is. Am I supposed to know about this stuff? I'm still pretty new to 3D art and have no professional experience yet. Here's where I am right now for context:

    I'm learning how to make game-ready hard surface weapons and props. Once I feel comfortable with that and have a few pieces on my portfolio I want to learn how to create environmental assets, as well as learn Unity or Unreal Engine for environments.

    I understand that it depends, but I still don't quite get the answer. From the comments it sounds like I'll understand once I learn how these engines work, but until then is it a good idea to include it in my mesh? It sounds like I should.

    Sorry if this question is too open-ended or contradictory.

  • Tiles
    Offline / Send Message
    Tiles interpolator

    Except it says the exact opposite you mean? You can do dynamic batching too. Within some borders of course. And we are again at the "it depends". It is not clear if the gun is static or dynamic.

    What triggered me to continue here was that my answer got basically ignored. And a guessing game started what the real reason could be to put the bullet UV at the gun texture. The real reason is optimizing the draw calls. One asset, one texture, one material to have one draw call. It is really this simple.

    As a game asset artist you have to take everything into account that makes the game run better. And not just to shape the current asset. And thinking about draw calls is the same than optimizing meshes, taking care of wrong triangulation, to make sure that a mesh has no overlapping UV's that could make trouble with baking, and so on. It is part of the knowledge that you need to be a good game asset artist.

    Basically we walk into the same direction here. It's all about optimization. Texture arrays, trimsheets (or in the old days called texture atlas) does nothing else than trying to reduce the number of materials and draw calls to optimze the FPS.

    This is of course just one tiny optimization that can be done to make a game run better. Real resource hogs are for example particle effects. But here we talk about putting the UV's of two meshes onto one texture. And that's a draw call optimization for game needs.

    For a still you simply use another texture for the magazine and the bullets. Not worth the hassle ...

    I've never touched Unity Engine before, yet alone know what a draw cell even is. Am I supposed to know about this stuff?

    It definitely does not hurt to know how to create the best possible game assets. And you asked for the reason ;)

    All you really need to know here is that every draw call comes with a time penalty. And this means the FPS goes down. So you want to have as few draw calls as possible to achieve the best possible FPS performance.

    And in case that you want to understand what a draw call is:

    A single frame of a game is never rendered at once at the screen. But piece by piece. Draw call by draw call. This all gets calculated in the off first (back buffer), and when calculated it gets drawn onto the screen (front buffer). So the engine loads a piece of the scene into the back buffer, let's say the ground, calculates it, loads the next piece of the scene, let's say a tree, calculates it on top of the first piece (shadows, which geometry is in front, culling etc. ), then a stone, then a building, then the dynamic content like a character, and so on. And once the image for the current frame is ready calculated, the back buffer becomes the front buffer, and this frame for the game gets drawn at the screen. And then everything starts again.

    I hope you understand the principles better now :)

  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter

    Yes, you might be able to use dynamic batching to batch together bullets if you had them as a spray coming out the ejection port. If you used a particle system it might do this automatically.

    But you'd never get away with batching the bullets with the gun itself. I've never seen any game where a gun is anything but a skeletal mesh. And even mobile games would use more than 300 polys for a gun.

    So it's theoretically possible but practically useless.

  • Tiles
    Offline / Send Message
    Tiles interpolator

    We still don't know enough of the use of the gun. For example, Unreal does not have this 300 Poly limit afaik.

    But for me the single bullets looks like part of the magazine. And the magazine part of the gun. So the whole asset can pretty much simply be one mesh, part of the rig. One draw call. Dynamic or not.

  • Alex_J
    Offline / Send Message
    Alex_J grand marshal polycounter

    There is no answer, hence debate. The is the "it depends" part and everybody has a different reason why it depends, of course.

    Already mentioned was a few scenarios in which you might include it. And it is easy to imagine scenarios in which you might not. If you are doing portfolio work, it doesn't matter. Just make sure the UV layout is neatly packed and most of all the model looks good.

    If you are making a model to use in an actual game, you still dont really need to worry about it. Combinining one texture like this will be a trivial optimization. And in some case you do decide that you need the opposite of what you first did, it is trivial amount of work to split or combine the textures. So, don't worry about it. The things that your question depend upon are project specific and will take into account factors beyond just the art team.

  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter


    we're splitting hairs really.


    the quoted part here I can't argue with given no outside constraints - it makes sense from an authoring perspective and is very unlikely to introduce any bottlenecks.


    in production you might choose a different path but it will be dependent on how many guns there are, whether they share ammo, whether they can use multiple ammo types etc.. In that environment you'll be told how to organise your stuff by people who know why its the best way to do it

  • Eric Chadwick

    I understand that it depends, but I still don't quite get the answer. From the comments it sounds like I'll understand once I learn how these engines work, but until then is it a good idea to include it in my mesh? It sounds like I should.

    Don't worry about all the tech stuff at this point; these are issues handled by Technical Artists on a dev team.

    For your asset, if your gun has visible parts, then include them in the texture sheet. So that could include telescopic sight, magazine clip, visible parts of bullets waiting to be fired, stock, etc.

    If you're making a reload animation, then think about all the internal parts that will be visible during the animation, and include those in your texture sheet too.

  • pior
    Offline / Send Message
    pior grand marshal polycounter

    @coolguyslims : it's actually much, much more simple than what some of the comments above might lead you to believe, and you don't need to know the inner workings of a game engine to get a feel for it - just some common sense and a basic understanding of how computers handle data.

    • The course you are referencing for your study is just that - a course. The artist who created the course decided (rightfully so) that having bullets as part of the beauty renders would be a good thing ; and since a bullet is tiny, he decided to include it in the UV layout and have it share the material. Because it would be pointless to create a whole texture set just for the bullet in this case.

    • HOWEVER, even though the artist in question works in games, that does not mean that this course of his perfectly represents what one would do in the context of an actual game asset in production - as I am sure you can understand (even without knowing what a drawcall is) that it would be pointless to fetch, uncompress and load the texture data of a full weapon asset in memory just because the game needs to display a tiny bullet.

    • Lastly and as said, a bullet is tiny. So at the end of the day, *even though* the game is likely never going to fetch the texture data for bullets from the individual weapon texture sheets but rather from some dedicated bullet assets in the context of actual gameplay, it doesn't hurt at all to have the bullet included in the weapon textures just in case - for instance for the weapon customization screen. But this kind of decision is never taken on a per-asset basis just because an artist feels like it - you'll be working with detailed specs given to you by your lead or senior anyways.

    That's literally all there is to it. Nothing more, nothing less.

  • EarthQuake

    Usually, the bullet would be textured twice, once as the full bullet (casing+bullet) in the main asset sheet for visibility during reloading animations and stuff like that. As mentioned above, there's virtually always some empty space in a UV layout to fit a bullet. If you were doing something like a revolver, you might include multiple unique bullets in the main texture sheet - especially if it's a first-person-shooter and the animation shows the bullets relatively closely. Again, it's easy to fit one or more bullets into a UV layout.

    And another time, with a different shell casing mesh (perhaps a generic one used for many different types of guns) that flies around in a particle effect. This would have a dedicated (tiny) texture, as Pior says, to avoid having to load an entire weapon texture set.

    To expand on what Eric said, if the gun has accessories that are customizable, ie: a scope, silencer, etc, these will often be mapped to unique texture sets so they can be swapped in and out on demand, without loading unnecessary data. Especially if multiple guns can be configured to use a single scope or something like that.

    Another thing that is common is increasing the resolution of the UVs in the areas that will be closer to the player. For the FPV weapon, this means the area closest to the camera and giving even more resolution to scopes or sights if the player can zoom in/look down the sights. Areas further away like the back of the buttstock or front of the barrel might have reduced resolution.

    On some projects there might be a unique third person mesh and texture set to, generally simplified with a lower resolution texture.

    Though all this will be specified for a project - it's good to know how things are typically done, but you won't really have to decide or figure it out yourself, unless you're a technical artist or something like that.

  • Tiles
    Offline / Send Message
    Tiles interpolator

    It remains an interesting discussion :)

    All valid points. But may i add that there is not always a senior artist around that will lead you? Not everybody works at AAA titles and in big teams. From my experience most aspiring game asset artists usually even starts their carreer with the small jobs and working with hobbyists and Indie teams. Where in worst case even the programmers are new to everything. And might even ask the artist for help. So the more basic knowledge you have, the better it imho is.

    @coolguyslims : it's actually much, much more simple than what some of the comments above might lead you to believe, and you don't need to know the inner workings of a game engine to get a feel for it - just some common sense and a basic understanding of how computers handle data.

    Indeed. It's even simpler, and one word: optimization.

    This can be to include the bullet into the gun texture. This can also be to exclude the bullet from the texture, and make an extra texture and material for it. When there is a valid reason for it. That's the "it depends" part.

    In this case the bullet was included. And coolgyuism asked for the reason. While we are now deep in the discussion what else reasons there could be to include the bullet into the texture. As a programmer i first and foremost think about the performance. You as the artists thinks first and foremost in terms of wasted UV space. Both valid reasons.

    I still recommend to have at least a look at the basics of game development. It really helps enourmous to understand some decisions. But i agree that it is not mandatory. But more the ideal. You usually pick this knowledge up at your way over the years.

  • LaurentiuN
    Offline / Send Message
    LaurentiuN polycounter

    I have modeled some guns in the last years and also did some freelance work for a company and most of the time the shell+bullet uv's is in the same texture as the magazine. For revolvers in the same texture set as the gun or in one of the uv sets if you have more then one.

  • sqrRedwend
    Offline / Send Message
    sqrRedwend polycounter lvl 10

    Coming from a software engineering background and just out of curiosity, is there still any advantage of doing so in current gen projects? Not knowing much about draw call optimizations it just seems to me that by making a separate texture for a bullet you'll be able to reuse it for free in every situation in full detail be it reloading animations, spent casing ejection, ammo pickup object models, etc. Also, that way you'll only need to make changes in a single place in case of a design/material revision like changing shotgun shell's color/markings for example. Does this make sense from a game development perspective?

  • EarthQuake

    Often the bullet seen in the first person view asset will be a different mesh and/or texture than used for particle effects. Typically because the one used for a particle effect will be less detailed, but also because a bullet in the magazine and an ejected shell casing aren't the same thing. So it would need to be a different asset. A shotgun shell looks different after being fired as well, so there isn't much practical reason to try and reuse a single asset. A bullet asset is not something that is likely to go through many design revisions, so the ease of frequently updating the asset wouldn't be a factor.

    Draw calls aren't really here nor there with current or previous generation hardware/engines/etc. If we're talking about a first-person weapon, you're only ever drawing one on screen, and it takes up a large portion of the screen area. An extra draw call in this case is irrelevant. Now, if it's an asset that will be drawn 100 times on screen, certainly, an extra draw call would be an issue.

    Really none of this is set in stone. If you wanted to have a shell casing that you reused for both particle effects and for the FPV weapon, you could do that no problem. You wouldn't want to do the reverse though - putting the bullet with the main texture set and then calling it every time there was a third-person particle effect.

Sign In or Register to comment.