I had the level create 30x100 (3000 total) 110x110x110 destructible-blocks. 99% of those blocks are not even visible on the screen and I removed all events/code from them. Still, performance is utterly bad.
So I replaced the destructible mesh with a new blueprint that is JUST a scene component with a static-mesh-cube. Still the same ugly performance. But if I don’t create those 3000 blocks, performance is perfect. So I started a new project and spawned the same 3000 blocks, performance was excellent… I’m confused… So the blocks are not the problem, and neither are the destructible meshes.
So if I spawn the blocks, performance drops, If I don’t spawn them, performance is fine. But if I spawn them in another project, performance is also fine… Huh?
I have 2 tiny lights in the entire level… How that get’s to 8.89ms, I have no idea. But the DirectionalLightStationary (comes with the example map) uses 4.15ms out of those 8.89ms. How do I optimize that?
And a very very tiny light that doesn’t light more than perhaps one block in total that I placed at the 0-0-0-coordinate to easily locate that coordinate, consumes over 2ms… I don’t understand.
HZB, wasn’t that supposed to increase performance when there are many objects in the level? Well, for me it seems to kill performance instead
I don’t know. They are not visible (=not in the visible section of the camera or very far away from the player) and have no events attached and so I hope that the engine is smart enough not to process them. But it does somehow I fear.
However, I just unchecked the “visible” option under “Render” for the spawned blueprint. The performance went back to maximum again. So the rendering of those extremely simple blocks is somehow killing my performance. I still don’t understand why.
I just added a max cull distance of 2000. So only about 3-5 blocks are visible at any given time. Still no performance gain. But not rendering them at all does remove all performance issues. So it’s not the mesh.
So I turned of “Cast Dynamic Shadow” and voila, performance went back to normal. So the dynamic shadows are causing the problem.
I selected the default “DirectionalLightStationary” and set it from “Stationary” to “Static” and made the blocks cast shadows again. Performance was again perfect. So the problem was the Stationary light. But making it static renders this light kinda useless so I removed it all together.
As long as I do not add a directional light to my level (on anything but static-mode) the performance is fine. I’m probably overlooking some volume or something to optimize the lighting.
Sadly this is still not the solution. Because when I replace my test-block with the real one (which is a destructible mesh), I get a slight performance problem again. Even with culling and no stationary light.
So I got rid of the destructible meshes and use regular static meshes now. Whenever they are about to explode, I quickly replace them with a destructible mesh. Sadly performance only increased by 25% using this method. HZB is still killing performance, big time.
After looking in the GPU visualiser again I noticed that the HZB is still a massive problem. I disabled the HZB but then the performance drain remained the same. It just shifted to another area…
I’ll start experimenting with level streaming volumes and such.
Note:
The GPU visualiser itself is also bugging quiet frequently… No crash reports either.