0
\$\begingroup\$

We have a 3D character who is wearing a gauntlet on his forearm and visibility of which can be turned on and off. Would it be better to create two versions of arm, one without extra triangles that are hidden beneath the gauntlet? Or we can just one model with gauntlet as separate object which can be turned on and off ?

Does the hidden triangles have any effect on rendering or are they completely ignored by engine?

We are using Unity 3D.

\$\endgroup\$
3
  • \$\begingroup\$ What engine are you talking about? You need to be bit more specific in order to get good answer. \$\endgroup\$ Commented Mar 3, 2016 at 13:48
  • \$\begingroup\$ Are you only concerned about this 3D character wearing a Gauntlet or are you going to cull the triangles for every model ? \$\endgroup\$ Commented Mar 3, 2016 at 14:24
  • \$\begingroup\$ We are using Unity 3d for this. We have multiple such 3d characters on which this will be applied. \$\endgroup\$ Commented Mar 5, 2016 at 5:22

4 Answers 4

3
\$\begingroup\$

My answer, much like Krom's, is that it depends.

In cases where you have large swaths of polygons being obstructed by another object, it's likely going to be a good idea to cull objects that are completely obscured. Suppose you are looking at a wall made of two triangles, and behind it are several objects composed of several thousand polygons. If you draw everything, you waste valuable GPU time. But by culling the objects behind the wall you can turn a draw call of thousands of polygons into a draw call of only two polygons. In this theoretical scenario, you likely would not see a massive difference in performance as a few thousand polygons is nothing to a GPU. However, when applied to larger scenes the performance gains can be quite significant.

On the inverse, and as is probably closer to your scenario, when dealing with a minute amount of polygons being obscured, while it may technically be slightly faster to draw a different model that has the obscured polygons removed, the gains will be minute, and almost definitely invisible. In addition, you will have to factor in the memory increase by loading in the alternate model. (Or models, assuming you have a different one for each area that can be obscured on your character)

Specifically, in your case, it's unlikely that culling the few polygons will do much for you, but it's always wise to do an A-B test to determine if that's true.

\$\endgroup\$
3
\$\begingroup\$

It depends.

There is performance difference depending on fill-rate limitations, order in which polygons are drawn and early Z-test. If, for example, your engine renderer is fill-rate limited and you draw from far to near several times, accumulating layers, then each pass eats from you budget. This is why it is beneficial to draw opaque geometry from near to far, so that early Z-test can happen and skip the "expensive" repeating part. How it is happening in your exact engine, it's hard to tell, they are all quite different in such details.

Now there are some other more real problems that can be mitigated by keeping the model "clean":

  • Z-fighting if those layers are very close to each other
  • Polygon collisions/penetrations if those are skeletally animated with skinning
  • Consistent AO, if you plan to have different AOs baked into the arm models

And drawbacks:

  • Additional work to make and maintain now 2 models instead of one
  • Additional code paths to support the switching of them
  • Additional time to load and memory to use for 2 models instead of one

Answering your original question - best option is to test and measure performance differences. Likely they are minimal, compared to all the rest game does, a few hundred polygons is next to nothing.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks a lot Krom. Yes triangles in question are not much. I was just wondering what good practices are while tackling such things, what widely used workflows are. You are right that it will really be a hassle in creating 2 models for each character. \$\endgroup\$ Commented Mar 5, 2016 at 6:09
2
\$\begingroup\$

Generally, if you know your object will not be displayed, you should not send it to the graphics card.

Culling on the CPU removes some work to be done by the GPU.

For a few polygons, it's ok to send them (as Krom Stern suggests), but in my experience, if you start to do some few polygons here, and few polygons there, you can end up sending uselessly many polygons to the GPU, which will have to take the time to realize it does not need to work on it.

A good habit is thus to not send them.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Which leads to game never being finished due to all efforts on optimizing non-bottleneck places. "Premature optimization" that is called. \$\endgroup\$ Commented Mar 3, 2016 at 17:11
  • \$\begingroup\$ @KromStern I totally agree that the OP question smells like premature optimization. I very much doubt that the triangles below a character's gauntlet will make that much of a difference. Now, how on Earth can a basic good practice of avoiding to send unnecessary triangles to the GPU (in case it's easy to avoid) be seen as something even close to "premature optimization"? \$\endgroup\$ Commented Mar 3, 2016 at 21:04
  • 1
    \$\begingroup\$ @MAnd I assume OP is spending his (and ours) time on something very minor compared to the rest of the finished product that he needs. If performance ever becomes an issue, then profiling and optimizations are needed, in this order. \$\endgroup\$ Commented Mar 4, 2016 at 5:12
  • 1
    \$\begingroup\$ @MAnd There are much too many good practices, that following all of them at once will bring a novice to a halt. Case for a YAGNI in my humble opinion. \$\endgroup\$ Commented Mar 4, 2016 at 5:33
  • 1
    \$\begingroup\$ Thanks for the answer and comments guys, i am indeed a beginner in game development. I am probably thinking too much ahead. I am just curious as to what people are doing in similar situations. All your answers and comments have helped me better understand. Cheers! \$\endgroup\$ Commented Mar 5, 2016 at 7:32
2
\$\begingroup\$

For a low-polygon textured model, generally speaking, having a few more triangles around its hand should not be an issue (performance wise). Of course it all depends of the sizes of your models but I'm guessing we are talking about sensible volumes here. If you have permanently attached the gauntlet to the hand and you switch its visibility on/off, then, when invisible, every engine that respects itself should NOT send its triangles to the GPU (or do anything with it anyway). If visible, then BOTH hand and gauntlet will be sent to the GPU (unless the gauntlet is big enough to cover the entire hand AND the hand mesh is a separate mesh from the rest of the model AND the engine supports such kind of culling).

So, yes, it depends of the situation, but for most scenarios I can thing of, performance should not be an issue.

That said, you should consider some other things apart the performance. Those are simplicity of implementation and expandability of the solution.

For example, if you are going to have just one character with just one gauntlet, it should be fairly easy for your modeler to create 2 versions of the hand. The benefit here is that you will avoid potential visual artifacts (they can happen) and it MAY be a simpler solution (especially in FPS situations where you only see the hands) If your case is that you may have many different characters that may wear many different types of gauntlet, you may need to attach the thing on the hand (to avoid creating endless combinations). If you already have a way to attach things to the character's hands (weapons, potions), it may be simpler to simply attach the gauntlet the same way.

Just saying...

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.