Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Need Help urgent! Low FPS!

Discussion in 'General Discussion' started by TheCodeOfCSAndJs, Feb 25, 2015.

  1. TheCodeOfCSAndJs

    TheCodeOfCSAndJs

    Joined:
    Aug 7, 2013
    Posts:
    7
    Hello i am in need of assistance with maximizing the FPS of my game, I hope for it to be at least 40 FPS 90% of the time, I have already tried implementing a script, with some code like:
    Application.targetFrameRate = 300;
    QualitySettings.vSyncCount = 0;


    My current frame rate ranges from 7-27.

    I also have a 1.9M triangle count, a 1.7M vert count, along with 1200 calls
    . I understand the tri count along with the vert count is causing most of the lagg, but what can I do to reduce the tri count/vert count with out removing most of the trees in my scene? Any advice will be Greatly appreciated, Thanks!
     
  2. Xaron

    Xaron

    Joined:
    Nov 15, 2012
    Posts:
    368
    Ouch, these are huge numbers. You can try to add some kind of level of detail, so objects far away doesn't need that high triangle count. You can replace trees far away with simple billboards as well.
     
    TheCodeOfCSAndJs likes this.
  3. TheCodeOfCSAndJs

    TheCodeOfCSAndJs

    Joined:
    Aug 7, 2013
    Posts:
    7
    i suppose, but the billboard option doesnt quite fit for me in this because i am making a horror game, so the character is walking through a tree crowded area.
    But thank you very much for the tip, and the quick reply, if you think of anything else let me know. Thanks again :)
     
  4. Xaron

    Xaron

    Joined:
    Nov 15, 2012
    Posts:
    368
    Well you should not use billboards in the near environment but it doesn't make sense to render complete trees that are far away. I think Unity supports level of detail but only the pro version?
     
  5. TheCodeOfCSAndJs

    TheCodeOfCSAndJs

    Joined:
    Aug 7, 2013
    Posts:
    7
    I have the option for the main camera to set the clipping planes, setting the near and the far, it does optimize it for a little while, it was at 1000 for the far, i set it to 200 and it was just as good for the most part, and instead of that 1.9m tri count i was recieiving about 860k tri's which is still a ton, but a massive improvement, however when i started moving in game for a while to get to the "main part" of my scene it started picking up the tri count back to around 1.4m, any other suggestions? Also thanks again for the quick response
     
  6. KingMatthew

    KingMatthew

    Joined:
    Jul 7, 2013
    Posts:
    166
    Do you have any real-time shadows? Those always kill my frame rate, try lowering the quality on them. since its a horror game, do you have fog turned on? If you do, you could disable objects that are too far in the fog to see.
     
    TheCodeOfCSAndJs likes this.
  7. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    Bake lighting.
    Tree LODs are a MUST.
    Share materials. They're trees, you can clone them. Using actual models over terrain trees is the best choice.
    I learned from experience.
     
    Deon-Cadme and TheCodeOfCSAndJs like this.
  8. TheCodeOfCSAndJs

    TheCodeOfCSAndJs

    Joined:
    Aug 7, 2013
    Posts:
    7
    wow i found the main thing causing it... wow... i had bench models each bench was using 300K TRIANGLES! with the benches not active, im getting 880k triangles now, which is a ton better. I will still try to do what i can to get that tri count down to about 450-600k though.
     
  9. KingMatthew

    KingMatthew

    Joined:
    Jul 7, 2013
    Posts:
    166
    Bake lighting is a great idea. It uses less resources and looks much more realistic.
     
    TheCodeOfCSAndJs likes this.
  10. TheCodeOfCSAndJs

    TheCodeOfCSAndJs

    Joined:
    Aug 7, 2013
    Posts:
    7
    yeah but i literally have no lights, well except for a flashlight
     
  11. bigSadFace

    bigSadFace

    Joined:
    Aug 18, 2014
    Posts:
    116
    It sounds like you are using models that aren't intended for realtime games. Get some lower poly models.
     
  12. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    I feel like I should make a plug for actually running the profiler here too. Sure, poorly optimised graphics is one cause of low FPS. But poorly optimised scripting can do the same thing.

    One trick for graphics in horror games is fog. Fog out everything more then a very short distance away. Can work quite well with the horror atmosphere. And it eliminates the need to draw anything at all in the distance.
     
  13. Deon-Cadme

    Deon-Cadme

    Joined:
    Sep 10, 2013
    Posts:
    288
    Look up level of detail (aka LOD), the concept is very simple. You got several versions of the same object, one that is meant to be viewed when you are really close to it, another version that is meant to be viewed at a minor distance, another one for medium distance and another for large distances and so on... The one that is meant to be viewed at a close distance obviously got lots of vertices and advanced shaders but the one that is meant to be viewed at a great distance is simply a group or maybe even a single plane with a simple texture and shader.

    You simply replace the trees with one that got the appropriate level of detail the closer or further you get from them, the tricky part is to hide the fact that you are performing the switch. Maybe you have noticed in AAA games that a tree disappear for a second... guess what probably happened ;)

    This one of the oldest tricks in the book to achieve environments that would be otherwise impossible to render with a decent frame rate.