Tips to Raise Frame Rate?

I’m having a bit of trouble getting the frame rate up on the game I’m working on and I was hoping that someone might be able to give me some advice.

I’ve been pouring over the forums / unity documentation for a while now and I’ve implemented quite a few things that have helped but i’m still having problems when I play the build on lesser computers. Any suggestions of things to try would be great.

I’ve reduced my textures, combined meshes, taken the reflection off my water, adjusted pixel error and base map distance. I have a near camera and far camera with the far one set to not render any of the objects/details in the scene. I don’t have any trees or detail meshes / grass and I’m not sure what to try next.

below are the game stats in case someone wants to know.

Player size statistics
Level 0 ‘’ uses 3.4 MB compressed / 15.6 MB uncompressed.
Total compressed size 3.4 MB. Total uncompressed size 15.6 MB.

Textures 8.1 mb 51.9%
Meshes 2.8 mb 17.8%
Animations 1.5 mb 9.9%
Sounds 0.0 kb 0.0%
Shaders 15.8 kb 0.1%
Other Assets 1.0 mb 6.6%
Levels 1.4 mb 9.1%
Scripts 55.0 kb 0.3%
Included DLLs 0.0 kb 0.0%
File headers 677.3 kb 4.2%
Complete size 15.6 mb 100.0%

What are poly counts of meshes?

main player = 6000 x 1
character1 = 1200 x 20
character2 = 1600 x 20 (in given location, more all together)
character3 = 1800 x 5
character4 = 600 x 5
character4 = 500 x 15 (in given location, more all together)
building1 = 50 x (lots)
building2 = 1500 x 1
building3 = 300 x 3
building4 = 150 x 9
building5 = 1200 x 1

the characters are all separate because they have animations, but the tons of building 1 are grouped into sections and then combined using the combine children script. The draw calls range between 50 - 300

What frame rate you get, and what computer specs?

Top Computer:
9G RAM
64 Bit Operating System
ATI Radeon HD 4870 Graphics Card (1024MB)
8CPU Intel Core i7 Processor 2.67GHz

  • I’m getting it seems either a pretty steady 62.50FPS or a steady 31.25FPS (strange?) it doesn’t really seem to move around in between very much

Lesser Computer:
2G RAM
32 Bit Operating system
ATI FireGL V3100 Graphics Card (128MB)
Intel Pentium 4CPU 3GHz

  • Getting an average between 20-30 with a low of 15 every once in a while and a high of 60 very rarely.

I wouldn’t be overly concerned except I know that my lesser computer is not quite as low end as it should be for testing purposes and we still have a lot of AI and other script plus finishing details/trees to add in. I’m just trying to get a jump on optimizing what we have now so that we don’t end up redoing a bunch of stuff later

thanks

This is really strange. These specs are more than enough to run such scene.
I wonder if you could compile and send me the scene for a benchmark? If not, then not.

Thanks for the offer but i’m not sure if I can. Do you know of any other mistakes I might be making? I was thinking i would try grouping my “combine children” groups in smaller groups in case they are combining into a massive mesh… I didn’t mention before, (my bad) I’m also in the process of trying to optimize my water. I was using the simple island water from the island demo (which in there demo seems to be pretty light) but it seems to be slowing things down on when i use it. one last thing, these stats include a very basic AI on character2, could that be the source of the problem?

thanks again,

Okay then, can you post ram/cpu/gpu usage while running it?

This sounds like the scene is not as optimized as it could be. How many draw calls are you getting? Also, possibly some of the scripts are taking long - try disabling parts of your game to see what is running slow. If you haven’t seen it, be sure to watch Joachim’s presentation on performance optimization:

http://unity3d.com/support/resources/unite-presentations/performance-optimization

In 2.6, we will be adding a Profiler, which will make this much easier. One other thing to try is playing with Application.targetFrameRate - enabling this usually yields better frame rates in the browser, as Unity will more agressively try to take CPU time from the browser.

I agree, I’m sure it’s something that is just not optimized properly, the problem is… i’m not quite sure what.

With the specks of the good computer listed above and the build stats in the first post I’m getting a fairly steady 50 - 60FPS, 40 - 180 draw calls, with about 25 - 150 tris depending on my location.

The only light I have is a directional light for the sun and my terrain is lightmapped. my terrain textures are all 512 and all my character textures are set to 256 if not smaller (buildings don’t have textures yet). We cleaned out the extra bones in our animations yesterday which reduced the file size by quite a bit but didn’t have much of an effect on the FPS. I’m just not sure what else to try.

Side note: My terrain has 8 textures, I know i’m not supose to use more than 4 but… i need them.

I had a quick look at the video, and it seems to be what i expected so far.

well… I had been testing as a web player because our game is eventually intended for the web but I’ve found when i make a win standalone build it runs much faster… I also think safari / something else is capping my frame rate at 62 when i run a web player build so that might explain some things…

I did find a few things that were causing some problems (water and one of our scripts) however disabling either one / both only increases frame rates marginally, and the slower computer is still running around 30 - 60 FPS without even 1/2 of the final scripts or textures…

I’m completely out of ideas…

IIRC the web player in windowed mode is capped at 50fps. Try the web player in full screen mode by right clicking in the window. The 62fps might be becasue you have VBL sync on? This will sync the framerate to the refresh rate of your screen which is 60hz (60fps) for LCDs.

Terrain quality settings has a huge impact for me. I was getting 40-60 FPS… and reduced terrain quality and immediately got 150+ FPS.

aNTeNNa trEE, I was suspecting the same thing about the Vsync issue. It seems to play either at 62.5 FPS or 31.25 FPS and i couldn’t think of any other explination.

I haven’t noticed a 50FPS cap in windowed mode… strange… I’ve been testing this thing constantly over the last couple weeks and the other computer i’m testing on doesn’t seem to be capping at all. I’ll be sure to keep that in mind as I’m looking at my results though.

magwo, I was beginning to suspect I might have to reassess my terrain, what were the quality setting you were using? My terrain settings are as follows:

Terrain Width: 700
Terrain Hight: 300 (i really don’t need it to be this high but i can’t change it now without messing everything up.
Terrain Length: 700
Hight Map Res: 513
Detail Res: 1024
Control Texture Res: 512 (i don’t know what this is)
Base Texture Res: 1024 (i don’t know what this is)

Do these seems reasonable? is there anything I can try without completely redoing my terrain?

You want to look at the pixel error, especially and distance for grass / trees.

Hi,

You indicated that you’ve reduced your textures, but your stats show over 15 meg of uncompressed vs. 3.4 megs of compressed.

In my experience that ratio should be the other way around.

Certainly not the bottle-neck, but might be worth reviewing.

my pixel error is set to 24 and I don’t have any trees or details.

Could it maybe be the animations? 2 of my characters have quite a few animation cycles. is there a proper/least expensive way to animate?

Drakken_Mordith - just curious why I should have more megs when my textures are compressed… isn’t the whole point of compression to reduce file size? I’ll have another look over them though to see if I maybe missed anything.

Hi Erica,

Sorry for the late reply…

My question should have been, why do you have 15 megs of uncompressed textures? Are they for your interface or normal maps? You’re right about texture compression of course, but unless you’re using normal maps that might be a high amount in your given scene. If you’re not using baked lighting, you might try exploring that option for improvements.

However, I don’t think that’s the problem (though I hope you’ve solved it by now).

If you haven’t already, you should ensure that you don’t have too many pixel light sources in your scene. That will start affecting frame rate quickly too.

Thanks for the reply.

No, i can’t say we ever actually fixed the problem. We made a few slight alterations and changed some of the build setting so that we get a more reasonable result, but we’re still in the process of trying to bring up the frame rate.

I had originally suspected that the textures were to blame however I’ve been doing weeks and weeks of testing and haven’t been able to conclusively prove that. What would you say a reasonable size for both uncompressed and compressed should be?

I was also noticing some changes (3-7 FPS) when we add scripts to the scene, and i’m beginning to suspect that the scripts are adding some considerable weight as well. However, due to some general lack of experience, I’m not exactly sure how scripts would normally affect frame rate and as I’m not the one scripting, i’m unsure of how to tell if they’re properly optimized.

Oh, and we don’t have any pixel lights in our scene unless they get added by default by something and i’m unaware of there presence :slight_smile: