# Trouble with triangle/vert count and using LODs

So I think my understanding of LODs and triangle/vertex count is lacking. I’m working on the level design for my game’s first map, and I can’t seem to understand and fix the areas of my map that are showing a high triangle/vertex count; so I’m just going to try and go over what I think I’ve been doing and why, and hopefully you guys can correct me and enlighten me in the places I’m going wrong or have things misunderstood.

1. I’m using TerrainLodControls with a DistanceLodCalculator, and I just noticed that its reducing the triangle count, but not the vertex count of the terrain. Is this how terrain LODs work, and if so is there any other way to lower the vertex count for a terrain?

Here’s my map without LODs on the terrain:

And here is withLODs:

1. The other strange thing that as me confused is the fact that the vertex count in the above pictures is higher than what I would mathematically expect it to be, based upon the vertex and triangle count shown in the properties panel in the scene composer. According the the stats in the scene composer, my scenes have approximately 350k vertices each, and in the above image you’re only seeing parts of 4 scenes. I’ve noticed that the SSAO Filter and Shadow Filter increase the vertex count, but I turned those off. Is there something else that may be causing my scenes to have more vertices in the game than they do in the scene composer?

2. I also have been making the assumption that the engine renders only those vertices and triangles that are in the camera’s view. It looks like this is the case if I stare at the ground, the sky, or off the edge of my map: the vertex and triangle count goes drastically down when I do these things to avoid looking at too many objects.
But if try the same thing by standing behind a tree to block the view of the rest of the world (shown in the picture below), the triangle/vertex count doesn’t go down at all, even though there’s technically only one object being viewed. Is this how it’s supposed to work, and is there any way to get the display to not render triangles and vertices that are behind opaque objects?

Thanks in advance for any help, and sorry if these are noob questions.

1. Yes, it only reduces triangle count.

2. If you’re using terrain I would assume its tri and vertex count changes depending on how close you are (without lod control maybe it’s max detail?). As stated in 3. it culls per-object, so at least a couple of terrain quad’s are rendered in your image.

3. Yes, it renders the objects (not per-triangle) which are inside the camera’s frustum. Objects won’t stop other objects behind them from being rendered. That requires other techniques.

1 Like

And even though the objects behind other objects are “drawn”, JME sorts the opaque bucket front-to-back and modern GPUs are very good at throwing away fragments if the depths is already rendered there.

3000 objects in a scene like this is a lot. If I were optimizing then that’s where I’d start personally. Or you can turn on frame profiling to see where your time is being spent.

1 Like

Thanks that helps clear things up for me a lot, I was getting myself really distracted changing things with the LODs and going in and out of my game trying to understand how that all works

So far I haven’t batched any of the recurring objects like ferns and rocks, so hopefully once I’m done decorating the scene and batch everything that will help. That should be easier for me to do than trying to reduce the vert/triangle count, so that’s good to hear, I appreciate it.

Vertex count is rarely a performance issue these days… Make sure that you actually see a performance improvement with a vertex count reduction before applying all these optimizations.

As for the stats display, the information shown is most likely incorrect. It’s not possible to determine the vertex count when LOD is used, because triangles may or may not share vertices, and there’s no trivial way of determining that without checking every mesh on every frame.

1 Like