# Detail resolution per patch

I have been developing my game for some time now and i have a total of 12 big terrains. In unity 3 here is a open variable (detail resolution per patch) which was originally hard coded on 8. Changing this value will wipe my splat-maps clean and i would have to re-texture my entire terrain. Changing the value from 8 to 32 or 64 saves me almost a 100 draw calls. Is there a way to increase this value without throwing away my splat-maps?

Greets, joris

Ok, first of all, thanks for saving my game. I read your question and I decided to investigate the issue. According to what I understand, the terrain detail/grass data is represented in a 2D array. So each element of the array represents a small square on the terrain, a chunk of grass/detail. As we know, the bigger the array/resolution, better precision we have positioning the grass. However, it is not feasible to draw chunk by chunk: in a 1024x1024 resolution it would result at least in 1 Million drawcalls (if we draw the whole terrain). So, Unity batchs those chunks based on the “Detail Resolution Per Patch”. If you have it set to 8, in a 512x512 detail res map, we would have (512x512) / (8x8) = 4096 batchs (and at least 4096 drawcalls). This way, in order to reduce drawcalls, you should increase “Detail Resolution Per Patch”, for instance to 128 (the maximum). In a 512x512, it would be (512x512) / (128x128) = 16 batchs. Since it seems Unity needs a couple of draw calls to draw a single batch (someone correct me if I’m wrong) it would take 32 drawcalls to draw the whole grass in the scene.

The ideal number for “Detail Resolution Per Patch” depends on the density of your detail. You don’t want to send a huge amount of triangles (very dense grass) to the GPU. But my guess is that you might be able to set it to 128 in most cases.

But that does not answer your question. According to my tests, you can change the “Detail Resolution Per Patch” without affecting the terrain at all. Regarding changing the “Detail Resolution”, yes, it erases all details in the scene, but you may try using the scripts at http://forum.unity3d.com/threads/43085-Small-Terrain-Scripts.

For clarifacation: There is a bit of mis-communication here, user-5422 is referring to the setting: “Detail Resolution” (where larger values are more costly as this refers to the bitmap.) Joris however is referring to the parameter following: “Detail Resolution Per Patch” where indeed larger values achieve faster performance because dividing the array by larger ‘chunks’ reduces the size of the array.

Increasing the resolution saves calls? I thought the opposite was happening, though i still don't understand what exactly that "per patch" thing does actually. Any info would be great. What i do know is that you can't change it without losing your maps. You can only change the height map and the size of the terrain without sacrifing your work so far.

Hi,

I am very new to Unity, but ran across this URL:

http://unity3d.com/support/documentation/Components/terrain-UsingTerrains.html

The above page states:

Detail Resolution: The resolution of the map that controls grass and detail meshes. For performance reasons (to save on draw calls) the lower you set this number the better.

So, it looks like smaller numbers = faster drawing.

Hope this helps.

Rick

Well in some cases it could save you performance, but for example. If i set the value to 8 it would make tiles the size of 8 in the world resolution. In this case it means it would have to draw around 50 tiles. If i would set the value to 64 it would have to draw only 10 tiles or less but it would increase the triangles/quads. Rendering 10 tiles saves a lot of speed compared to 50 (in case im not using a lightmap for the terrain) Joris 0 secs ago