SS3D icon indicating copy to clipboard operation
SS3D copied to clipboard

Investigate why we have so many vertices in game

Open stilnat opened this issue 9 months ago • 3 comments

Summary

We have an issue with our models in Unity having way too much vertices compared to what is expected.

We need to understand what's causing this, and eventually have some solutions to reduce the count. The issue is probably multi factorial (lighting, too much vertices in blender from the start, some other unknown factors...).

Example of the APC is below.

Media

Vertices in blender: 138

image

Vertices in Unity raw: 254

image

It seems there will be more vertices when you add lighting, and even more with shadows...

Possible Solution

This conversation can be a good starting point : https://discussions.unity.com/t/number-of-vertices-of-a-model-is-not-the-same-in-blender-as-in-unity/190409/3

stilnat avatar Nov 10 '23 23:11 stilnat

We could disable the rendering of layers below floortiles if there is a floortile on that tile. There are many pipes, wires, and plenums down there that are not typically seen because there are floortiles blocking the view.

cosmiccoincidence avatar Nov 18 '23 16:11 cosmiccoincidence

This seems to be a great breakdown of our situation: https://www.youtube.com/watch?v=yQSl2vzi0jA

When he explains its at 5:00, for those unaware, we are essentially using the method he has labeled as "PNO_Vert_03_YeEdgeYeUV_02" and "PNO_Vert_03_YeEdgeYeUV_03", which have vertex costs.

cosmiccoincidence avatar Nov 25 '23 21:11 cosmiccoincidence

So the primary reasons for our excess vertices are:

  1. We use a palette texture for most models, thus we break up the uv vertex connections, resulting in increased vertex data. Basically every change of colors between two faces on a model is causing increased vertex count.
  2. Similarly as above, using hard edges causes increased vertex count. We use a fair amount of hard edges on some models. One thing to note is that about half the time we use hard edges on a edge separating two colors, but I do not believe the effects stack, both increasing the vertex data.

So I think the long term solution here really just comes down to optimizing our models overtime.

  1. Minimize base vertex count by optimizing mesh.
  2. Minimize UV breaks. Obviously we want to still color our models but a way to add color detail without breaking UVs is to use floating meshes more. The floating mesh is separated from the primary mesh and thus when coloring the 2 individually in the UV editor, it does not split the UVs.
  3. Minimize hard edges. Use them conservatively. Possibly using autosmooth with a select degree could replace hard edges on many models, though I'm not sure if that is actually more vertex efficient or not.

cosmiccoincidence avatar Nov 28 '23 21:11 cosmiccoincidence