I am creating a seamless procedure generated open world demo, the terrain in the eye sight is VERY big, over 40,000*40,000 unit, the camera’s far plan is set to 20,000. In order to make the travel in the world fluent, i split the mega terrain into many squad part(about 32), and when the camera move, new part of terrain will be generated and put into the eyesight.
I’ve tried splitting the terrain into 4,16,32 and 64 parts. My idea is that the more parts i used, the less time the procedure generation process will take, which make the travel in the world more fluent. BUT the fact told me things are not as easy as i thought.
When i use 64 terrain together, the frame rate drop dramatically . the unity’s built in profiler(deep profile) show that the Terrain.CullAllTerrain function take 95% percent of the cpu time. if i drop the terrain number to 32 with each terrain’s size grow to 4 time bigger( the total terrain area all together are still the same) , the frame rate will raise a lot. with 16 part and 8 parts , frame rate raise even more. which means the terrain’s culling are not sensitive to total vertex number of all terrain, but sensitive to the number of terrains itself.
When i added tree instances into terrain, the similar thing happen in a more serious degree. when the camera rotate, frame rate drop a lot. profiler tells TreeRender.render are taking much cpu time, but when the camera doesn’t rotate, it doesn’t show up in the profiler. that’s curios, seems that the tree will be doing render only when i rotate the camera, is it because the engine is render the tree object into the “tree billboard”. and also fewer terrain parts holding same total amount of tree will get much superior frame rate.
So i will like to hear from unity insider tell me what’s going on, and please give me some advices on how to optimize. I am now planing to dynamically disable the terrain 's render when they are at the back of camera or disable the tree render.
hope to get faster feedback then i can do less trying.
thanks.