I’ve been building a scene and just recently noticed a performance issue I’m having little success figuring out.
It started when I was happily testing the scene, when I realised the framerate dipped from 60 to 40 when looking at the floor. You read that right: Looking directly at the complex scene (a forest) ran at ~60 FPS, but looking at the floor was ~40. I did some more experimenting and realised the same thing happens if I in any way turn the camera away from the geometry (e.g. if I put the camera outside of and looking towards a small test forest; everything is fine until I turn the camera away, whereupon the framerate drops, despite drawing nothing but a black screen).
According to pstats, the “draw” time pretty much doubles (e.g. from ~17 to ~33 ms) when looking away from the geometry. Nothing else (app/cull/etc) seems to change noticeably, as far as I can tell.
I’ve used oobeCull and it does appear that the objects are (ostensibly) being culled (i.e. they display as a red wireframe when outside of the view frustum).
I’ve currently got a test scene set up where I’ve got nothing in front of the camera and a few hundred objects behind the camera, but the framerate is 30 FPS and the draw time is higher.
In all test scenarios, the low FPS is also constant, whether or not the player/camera is moving around.
render.analyze shows 512 geoms in total. The “Geom” graph in pstats also says 512 at all times. If that’s the (average) number of geoms being drawn at any given time - and not just how many are in the scene graph - I guess that would suggest all 512 geoms are being drawn, despite not being in view of the camera and supposedly being culled?
If you need any more information, feel free to ask. If I’m missing something obvious, feel free to slap me.
For what it’s worth: I’m running Windows. I know there have been Windows-specific bugs that have slipped through the cracks in the past.
Edit: Just to eliminate some confusion and rule out the high geom count, I also have a test scene with ~170 geoms which has the same problem i.e. if I place ~100 objects in front of the camera, I get 60 FPS and can move around without issue, but if I then open my level editor, move those same objects behind the camera and re-run the test, I get 40-50 FPS and noticeable stutter when moving.
Edit #2: I just noticed the “primitive batches” increases from ~20k to ~80k when the geometry is out of view. Could that be the culprit? What might be causing this? (It seems to be the “triangle strips” - if that’s relevant).