- Home /
Low FPS when against a wall?
Hi there.
I've been making small games for a while now and with my latest project I'm trying to be the most optimized I've ever been.
My aim for my current project is to have the game running perfectly at +-60fps at 1080p with the current mixture of medium and high settings on a mid end PC.
For the most part I have achieved this. The demo is running at a solid 60fps. EXCEPT THIS 1 WALL! It can run as low as 50fps when at 1080p. I've ran the profiler and I've spent hours optimizing nearby assets to the point where nothing seems to be causing these drops, and yet the framerate still tanks to these lows for no apparent reason.
If anyone has any ideas, I'd love to hear from you.!
EDIT: The performance drop happens when the camera is close to ANY wall, whether colliding or not
EDIT 2: For more clarity, by close I mean the wall asset / texture work is right up agains the camera (the attached screenshot where the frame rate is 52fps) as when the wall isnt close the performance returns (as seen in the second screen with 87fps)
As I can only post 2 screens in the description, here's a screen of the performance still dropping when the colliders are disabled and its running no textures on a plain diffuse shader.
Answer by Dave29483 · May 26, 2015 at 07:37 AM
Do you have some physics trigger enabled on that wall or objects close to it? You are getting a sudden CPU spike which may indicate a script may be the cause. Check for OnCollide events. Also are you using baked occlusion culling?
Also it would be worth running the profiler and see which method is getting the most calls when up against that wall. It will give you some insight into what is happening. The profiler is great for this sort of thing.
Hi there, thank you so much for your response.
Today I did more testing. I removed all ridged bodies and all the colliders in the scene other than the floor. I removed all scripts accessing collision, lowered texture resolution / filtering and even changed the shader from the standard shader to a plain diffuse shader. Nothing helped.
I then suspected it may be that the mesh is to large so I split it up into 20 or so pieces and it still didn't improve performance.
In the proffiler, as I've said before, noting seems to be affected more or less when Im close to any wall (It happens when the camera is close to ANY wall, whether colliding or not)
Again thanks for your response
If it's nothing to do with colliders but happening only when close, then culling seems a likely candidate. I would experiment with changing the camera settings (eg clipping planes and culling mask) while it's running, to see if that has any impact.
By the way, it might be worth expanding on what you mean by "close". Does this just mean that the wall is visible, or is it that the wall can be visible with acceptable framerate and then drops as you move closer?
You didnt mention if using baked occlusion. If so clear the data and retry. Also does the shadow caster count jump (stats window) up when you get close to a wall? Shadow casters are expensive.
By close, I mean as seen in the screens I've posted.
And thank you for the suggestion on the camera settings (eg clipping planes and culling mask). unfortunately even changing them so practically only the floor was visible still yielded no gains.
Thanks for your input though, I'm willing to try anything that may help.