Exceeded Max_Patches

05-05-2004, 09:11 PM
Ok, I tried compiling my map, DoD_Rush, and got that error durring hlrad, of course all Zoners problem thing tells me is that the map has a problem that has to be fixed.. anyone know what I have to do?

05-05-2004, 10:10 PM
there is a limit of 65000 i think, it should tell you what you are at in the compile log. If you are just over you may want to find ways to reduce. The best way is to scale up your textures wherever u can (scaled up to 2 instead of 1 for grass textures etc ) and to simplify your brushwork in places (replace 2 faces with 1 where u can). If you dont want to do that you can override the limit by using the -sparse parameter, this will use a simpler algorythm for lighting calculations and may result in slightly differenty lighting overall. I had to break the limit this way for dod_leipzig, as it was a freakin huge map and i didnt want to remove anything.

Eric the Pixie
05-09-2004, 04:39 AM
Your problem is caused by the compiler exceding the number of patches it is allowed to make when it calculates the texture/lightmap stuff.

In the RAD part of the process, if you have the chop value set at the default of 64, you could try increasing this value to 80 or 96. What this does is increase the size of the patch area - so less of them are needed in the map and the max patch value wont be reached.
Basicly, the chop value decides how big a patch will be and therefore how many of them are generated from the existing faces. These patches are used to calculate the lightmaps that illuminate the various areas in your map.

If 96 still causes you problems, try 112 - I have had to do this on a HUGE map I'm working on - it covers almost all of the mapping grid!

The quality of the lightmaps will be reduced, the higher the chop value you use, although to be honest, I haven't noticed much of a difference from the default chop of 64 - but it makes a huge difference to the number of patches generated.

If you dont want to play around with the chop value, try scaling up your textures. In a perfect world, a texture scaled to 2 in both X and Y directions would use one patch for every four at a scale of 1 - thats reducing the patch number by 75% wherever the scaled up texture is in use.

It could be you have areas of your map that will handle larger scale textures with out too much loss of visual quality. If enough of these areas exist, you might reduce the number of patches sufficiently to stay within the max patch value without changing the chop value.

Hope this helps,


05-10-2004, 05:40 PM
From Tommy

When hlrad runs, it takes all the visible faces in the game, and divides them into sections called patches. These patches are the textures used as the lightmaps for the world. There is a hard limit of 65535 patches that hlrad can deal with. By default, a 64x64 game unit chunk of space is the size of one patch. If the texture scaling (not texture size) is larger or smaller, it will directly affect the lightmap size as well. This means a texture with scale of 2, will have at best 1/4th as many patches as a texture with a scale of 1.

Putting a 'box' around the level to protect from leaks is the most commmon cause of this error, beyond excessively large maps. The box causes vis to keep the faces on the outside which would normally be thrown away. These faces are then required to have lightmaps. Worst case, is that putting a box around the level will usually cause an extra 40-80% more lightmaps to be created than necessary.

Barring having a box, the other cause is large maps. The fixes are varied but can only help so far.

Remove any "box" from around your level and fight the leak leak leak war the right way.
If you have not boxed in your level, then the #1 fix is running HLRAD with the -sparse flag - but compile will be slower.
Using -chop values larger than the default 64 for hlrad will cause the light patches to be larger. However, for values larger than around 96 the map's lights start looking bad, and will more prominently show the 'staircase' effect on shadows.
Using a larger scale on large textures (dirt, rock walls, concrete) will help those large surfaces consume fewer patches for lighting.

Day of Defeat Forum Archive created by Neil Jedrzejewski.

This in an partial archive of the old Day of Defeat forums orignally hosted by Valve Software LLC.
Material has been archived for the purpose of creating a knowledge base from messages posted between 2003 and 2008.