Terrain Vegetation doesnt get batched / Baking Terrain Vegetation to Meshes?

Hey there,

I am quite surprised to find out that the vegetation we painted on the unity terrain will not get batched. The prefabs used on the terrain are of course marked as static. The terrain itself is also flagged static…

I cant really believe that this is not possible ( or am i missing something? )!

If that is really the case I would be interested in a method to bake the vegetation to meshes and batch or even combine them via Meshbaker.

Does somebody have a hint how to approach this?

Thanks a lot in advance!

Did you check “Use Instancing” on your vegetation material?

You mean GPU Instancing in the Advanced Options of the prefabs material?
… but then it wold not be batching anymore rather than GPU Instancing, right?

Ive checked GPU Instance in my materials and its true. There are a lot more “saved by batching”. It doesnt help the framerate though. I also tried GPU Instance Asset and that did some good. I have an other scene though where even with the GPU Instance Asset the framerate stays the same. So I would like to try to get these assets batched rather then using gpu instancing. Andy ideas?

anybody?

Batching would not help in your case. Your performance loss is coming from trying to render ~83 million triangles to screen per frame. Reduce the poly count of your objects.
As for Instancing, Unity doesn’t seem to implement it properly for situations like this, which is why assets like GPU Instancer exist. It’s a shame because Unity just updated their terrain engine, but placing foliage on said terrain is hopelessly broken. Instead of making useful features for game developers, their priority has been on making tech demos like ECS. I recommend checking out Unreal Engine. Their Foliage tool is top notch.

Did you end up finding a solution to this problem Kareem? I am running into the same problem right now… no matter if I enable batching or GPU instancing on my trees, Saved by batching always stays at 0…

I think the best solution for terrain trees would be to use some sort of billboarding/imposters system as billboarding greatly reduces polycounts. By default Unity has billboard renderer which automatically picks trees if you set them correctly (currently only Build-in render pipeline is supported, no URP or HDRP supported for this, see more details here ).

You can also take a look at my repos and compare different examples of billboarding:
https://github.com/chanfort/Tree-billboards-stress-test
https://github.com/chanfort/Imposters-stress-tests
https://github.com/chanfort/Custom-billboard-renderer