• 3D
  • 2D objects in 3D: Sprite 3D performance bad? Switched to mesh, even worse?

In my 3D game I have some 2D objects that get instanced a lot. to be specific, I am instancing several labels that display damage numbers above a 3D enemy's head every time they get hit. These labels are Sprite3D 's with a view port that houses the labels. If something like a shotgun blast that instances several of these labels hit's an enemy, I get a small freeze and frame rate drop. The drop is about 5-6 frames but I can see the game freeze for about a tenth of a second! not ideal.

I looked into it before posting this question and found that using mesh instances (quads and planes) were much more efficient and better for performance. BUT, when I made the switch the performance was EVEN worse. I now had a drop of 30 fps!!! and the game slowed to a crawl. I also heard that setting the render to 2D was best for performance with the view ports, but also to my surprise they actually run better in 3D.

Perhaps I am misunderstanding something.

The performance is probably the Viewports rather than the Sprite3D or MeshInstance. Every Viewport is another render call, which can be taxing. I would either use a single viewport for each enemy (assuming you have a relatively small number) or use a Sprite/Texture to show the damage, or use multiple Sprites/Textures (for each number) and make a “fake” label with those to show the damage (I’m not sure the performance cost).

that is a very clever solution. I never thought about instancing the labels alone, instead I have been instancing the view port with labels every time. I will try this out.