Win 7 64 bit, UE 4.8.1
I’m sorry, there’s a lot to parse through here, I’ve updated this as I continue to explore the issue which uncovered some additional potential bugs which I’ve also made note of here for now.
Problem:
I am spawning a number of instanced static meshes via blueprint. Performance is quite good while the player character is stationary but whenever the player moves, the framerate drops from 90+ to 2-3 FPS. If I turn collision off on the instances I do not see the same drop in performance and the game runs at a consistently high rate. I think I have narrowed down the culprit via the profiler:
Additional Info:
-I’ve tested with several collision types, a simple collision cube as well as using complex as simple.
-The meshes I am instancing are extremely simple and consist of few polygons.
-Visually rendering the instances takes almost no time at all where collision is not concerned.
I’ve attempted to test with both movable and static instances but [due to different bug][2], static instanced static meshes cannot be spawned without crashing the editor.
Edit 1: I’ve discovered that ANY movable actor with collision moving in the scene causes this slowdown. If nothing in the scene is moving the framerate is great. If anything with collision moves, the framerate tanks. I double checked the usual suspects with stuff happening on tick in my logic, etc and those things are not causing any issues, I can run the game at 90fps without collision or when the player is not moving.
##Troubleshooting:
Tested using HISMC’s instead:
Result:
Even with aggressive culling I did not see an improvement.
Uncovered possible secondary issue with HISMC’s: Culled HISMC’s seem to still create collision overhead? That seems consistent with what I am seeing here because:
- I can trace to a completely culled HISMC
- I see similar degradations in performance in respect to the collision regardless of HISMC culling settings.
- If I explicitly turn collison OFF on the HISMC’s I do not see the fps degradation.
Given that the biggest overhead with instances appears to be related to collision, I strongly suspect that it is not intended behavior - there would seem to be little point to only culling HISMC’s visually but leaving the collision.
Manually Turning collision on only around the player:
Result:
Framerate improves overall however
- There is a large lag spike every time collision is turned on in the immediate area of the player.
- This only sidesteps the terrible collision performance, it does not solve the underlying bug with colliders lagging so heavily.
Even still, I think this could be a viable solution IF there’s a way to avoid the frame hitch when turning on colliders. Do you have any thought on how this might be avoided?
Thank to for looking at my wall of text!