Error: Exceeded MAX_MAP_VERTS on map with many prefabs Created 3 weeks ago2022-07-16 19:08:14 UTC by Xawdlan Xawdlan

Created 3 weeks ago2022-07-16 19:08:14 UTC by Xawdlan Xawdlan

Posted 3 weeks ago2022-07-16 19:08:14 UTC Post #346719
Hello everyone, I'm sorry if this is a dumb question but it's been a LONG time since I mapped for HL and perhaps I am missing something.

I'm laying out a place that is not intended to be released or playable, I'm basically using Hammer instead of Sketchup, 3ds Max or whatever else. After creating the basic rooms (very simple place) I began populating it with prefabs, the place is a library so I used a lot of bookcases (you know which one).

Eventually Hammer slowed to a crawl and it got harder to edit the map with it. Then, when compiling I got the following:

Error: Exceeded MAX_MAP_VERTS
Description: The maximum number of vertices for a map has been reached
Howto Fix: The map is too complex for the game engine/compile tools to handle. Simplify

I realized then that prefabs are added as world brushes and thought that was the problem. So I began converting the bookcases to func_wall entities. But the problem persists. I even tried making them func_detail and func_illusionary, no luck. I was under the impression that entities do not count against the brush limit (right now map information window shows 8734 solids, 51139 faces).

I deleted a bunch of prefabs and finally got it to compile with ~6000 solids or so. Now I'm thinking about making my own bookcase by removing unnecessary detail, but I'm still curious. Am I missing something?
Posted 3 weeks ago2022-07-16 20:19:54 UTC Post #346720
Easy. There is a vertex limit for each map since GoldSrc is an old engine and could handle it. Im afraid you cant add more brushes. However, you can try to minimize the quality of the prefabs by deleting certain brushed, in other words, edit the prefab so it has less brushes.
Posted 3 weeks ago2022-07-17 01:55:47 UTC Post #346722
Yep - brush entities do count towards the brush limit, it's models that do not. The complexity of the map would explain why Hammer was running slowly as well, it's not designed to handle that many brushes.
Penguinboy PenguinboyHaha, I died again!
Posted 3 weeks ago2022-07-17 08:15:21 UTC Post #346726
One simple cube brush has 6 vertices. A room made out of 6 brushes will end up having 6 vertices, as the BSP compilers will strip out the unseen faces (assuming there are no leaks), also assuming that it is 240x240x240 units or smaller.

The limit for brushes (individual brushes) is 32768. Their faces will get culled away and only the faces that are visible in-game will remain, so you don't see the backfaces if you noclip. This counts all sorts of brushes, non-entity and entity brushes alike.

The limit for brush models (solid entities etc.) is 512. If you have too many, for example, unique func_walls, you're gonna run out of brush models. A brush model is really just a group of brushes associated with an entity.

The vertex limit is also 32768, and if you have 50k faces, it's not hard to reach, esp. if a lot of these faces intersect, creating cuts on the underlying surfaces, thus creating new pairs of vertices too. Vertex count is calculated only after BSP filling and BSP splitting. (or maybe during it)

I specifically mentioned 240 units in the beginning, because every 240x240 texture pixels, there will be a new face too. If you have a very large surface, you'll get quads every 240x240 units, if the texture scale is 1.0. That also contributes to the number of vertices. If texture scale is 0.5, those cuts will happen every 120x120 units and so on.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 weeks ago2022-07-17 12:21:50 UTC Post #346727
Thank you very much for your answers and the in-depth explanations. I already knew the reason behind using brush entities is to exclude them from visibility calculations, speeding up the process, but I wrongly thought they didn't count against the brush limit, too. Now that I understand it, the maps I already liked (in other mods) seem even more impressive, having been done under those limits (I'm talking about vanilla HL engine that is). Still, that 32768 limit is not that hard to reach if you start adding detail, what a pity.

I will edit the bookcase prefab so remove all unneeded detail and leave it bare bones, then replace the existing ones. Is there a quick way of doing it? Instead of going one by one.

By the way, while investigating this issue I did a test and found out that func_wall entities do not cast shadows on the world, while func_detail did. Is this behavior expected? I thought they were mostly the same.
Posted 3 weeks ago2022-07-17 19:53:56 UTC Post #346737
Well, nevermind, the map is fixed now and it works perfectly. I finally replaced the prefabs one by one :cry:

4918 solids, 29515 faces. About 50 brush entities, I grouped as many as I could if they looked like a solid block.

The 2D views still struggle when too many elements are rendeded, though. Have to zoom in to prevent that.
Posted 3 weeks ago2022-07-17 21:06:52 UTC Post #346738
By the way, while investigating this issue I did a test and found out that func_wall entities do not cast shadows on the world, while func_detail did. Is this behavior expected? I thought they were mostly the same.
Brush entities (except func_detail) get ignored by HLRAD, unless you set ZHLT Lightflags to something like "Opaque + concave fix".
The 2D views still struggle when too many elements are rendered, though.
Maybe J.A.C.K. could render it a tad faster.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 weeks ago2022-07-18 11:55:17 UTC Post #346739
Thanks! Will look into it.
You must be logged in to post a response.