foliage lod/draw calls problem (foliage system doesn't kick lods)
While checking for some performance problems we noticed that the foliage system is not kicking properly the lods. While a standard staticmesh is just rendered 1 time (1 draw call) and 2 times for a short amount of time during the dithered LODtransition, we noticed that most of the time all the lods are premanently rendered when using the same mesh but with the foliage system.You don't notice the problem visually as the dithered LODtransition make all the pixel transparent, so only one lod is visible, the others are still rendered but transparent, so not visible.
It seems that this problem is causing big performances problems, as most of the time all the 4 lods of every objects are rendered (making the shader complexity on screen quite high for all vegetation using masked opacity,and multiplying unnecessarily the amount of draw calls by 4, and incresing the amount of polygons on screen highly as all lods are rendered). If I say most of the time is because if I go very far away from an object, it still kick after a distance the first lods.
To not have all the 4 lods rendered at the same time we have to set a huge gap for the "screen size" distance of the lods. The default values (1 for lod 0, 0.25 for lod 1, 0.125 for lod 2, 0.08 for lod3) shows the problem.If I set a much bigger gap like (1 for lod0, 0.1 for lod1, 0.01 for lod2, 0.001 for lod3), it minimize then the amount of lod rendered at the same time, but this is not a proper fix at it forces us to set the lowpoly lods way to far from the camera. It look likes the system render all the lods present in a screen size range between for example 1 and 0.01 (i.e if the lods of an object use values for screen size in this range they will all be rendered simultneously).
Is there a option we missed to fix this issue or is it a real bug?
As mentioned before, the system is behaving correctly with a standard staticmesh, the problem occurs only with the foliage system. But as the foliage system was supposed to provide some performance boost by minimizing the amount of draw calls, we used the foliage system not only for bushes or trees, but also rocks, or any small objects which are placed quite often in our scenes.
This has been fixed for 4.9.1.
As a workaround you can open your foliage's material and make sure the "Dithered LOD Transition" checkbox is checked.
answered Sep 02 '15 at 03:00 AM
There was a change made recently with the release of 4.8 that can explain this behavior. Foliage no longer uses instances clustered into multiple components, and all instances of a particular static mesh are rendered in a single draw call from a single HierarchicalInstancedStaticMeshComponent.
When you paint instances with the foliage tool, the tool finds the Z location matching the surface of the heightfield and adds an appropriate transform to move the instance to that location. In the vertex shader, an ObjectPositionWS material node should evaluate to that same world position for each instance.
Edit: I have been running some test in my own project and was able to confirm what you are reporting. Before I write the bug report for this issue, are there any other notes or points of interest which you can add to the robustness of the report?
answered Sep 01 '15 at 08:08 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here