Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Performance And Memory Problems

Discussion in 'Unity 5 Pre-order Beta' started by JasonBricco, Oct 27, 2014.

  1. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Ever since upgrading to Unity 5, performance has gotten considerably worse in my game. I'm making a voxel engine, and so this global illumination isn't going to work well for me at the moment. So I really don't want any part of it. My directional lights have 'Static GI' only, nothing realtime, since I assume that's what I should have it on.

    I'm not sure what's causing the FPS problems - it's running at a far lower FPS than it normally does and is causing a lot of choppiness.

    Furthermore, I received a "Your system is out of application memory" popup message on OS X, informing me I had to quit Unity and restart it. This kind of thing certainly never happened in 4.6 beta. (And I have 16 GB of RAM at the moment on this laptop, and didn't have much else running).

    I assume there are some bugs in there causing these problems, though I'm unsure exactly of their source. But I am wondering if there are certain settings enabled by default in Unity 5 that would kill performance. If so, I can turn those off to get my FPS back up. I looked around and haven't found much!
     
  2. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    "This global illumination [...] I don't want any"
    "My directional lights have "Static GI"

    Pardon me, but wouldn't you want your lights set to dynamic in that case?
     
  3. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Honestly, I'm quite new to this. I interpreted dynamic as meaning calculated constantly to apply the lighting to moving characters, etc, and therefore performing worse.
     
  4. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Sounds like you have a lot to learn about 3D graphics.

    For lit 3D characters, you MUST have dynamic lighting - there's just no way around it.
    For lit environments, you *could* bake a static lightmap, and doing so means you don't have to use realtime lights. But, for a voxel world like you have, you probably can't bake a static lightmap. Therefore you'll want realtime lighting for that too.

    That said, if your shaders don't even need realtime lights (custom vertex+fragment shaders which don't take any lights into account perhaps) then you could safely delete the light altogether.
     
  5. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Yes, I absolutely have a lot to learn about 3D graphics (and many other things, for that matter). Always open to suggestions for places to learn this information! (Books, courses, reading in general, etc.)

    This whole voxel project is beyond my level - I probably should be starting off with something more simple. But I have time, and I really want to learn it. And so I'm using it both as a learning project and a way to ultimately have a product I can sell.

    But that's a bit unrelated to this topic. I did switch my lights to dynamic, since apparently that's what you want for a directional light. Static then would mean baked light maps I'm assuming. (And I'm not sure what the difference is between realtime and dynamic, either...)

    In either case, this hasn't improved performance in any way as far as I can tell (or the visual appearance for that matter), so I am not sure what really happened.
     
  6. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Have you tried using the Profiler?
     
  7. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    The result of profiling is that "WaitForTargetFPS" is usually up in the 80% to 90% range, and occasionally "Overhead" jumps up to maybe 20% to 40%. But this doesn't seem overly different from before...
     
  8. Deleted User

    Deleted User

    Guest

    Looks like Enlighten is clustering in the background, it does have a hit on performance. If you want to switch it off, go to lightmapping and select "on demand".
     
  9. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Is that only happening in the editor? I haven't actually tested in a build, although I probably should have. As I'm on my phone right now, I'm unable to.
     
  10. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    uh, enlighten will precompute for all new geometry so if it's a minecraft style game and you enable it for it, then the editor will keep precomputing forever as you add stuff. You really don't want any form of enlighten for voxel work.
     
  11. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    there is a post on unity blog about unity 5 new lighting:

    • Q: Can I create game world fully procedurally, Minecraft style?
      A: Short answer, no. However, we are doing multiple projects with Imagination Technologies using their PowerVR Ray Tracing technology for GI previews and hybrid rendering. This could potentially yield a solution to procedural or user generated scenes. The PowerVR Ray Tracing technology supports interactive GI for fully dynamic scenes. It is not yet fully real-time and the first few frames will have visible noise as the solution converges, but it is a very promising direction. It will certainly be able to light user generated scenes assuming some delay is acceptable. (There is no ETA for this as it is still an R&D project.)
     
  12. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    That's what I figured, but I wasn't sure if it was actually on or off or what. I guess it was. So setting it to on demand turns it off? I had it set to some legacy mode or something.
     
  13. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    No matter what I set it to, it doesn't help the low FPS in any way. I've tried lights (static GI, dynamic, realtime, all of them) and the three modes for GI. I just want Enlighten completely off and not having any impact, but I can't seem to get that. (Or something else entirely is causing the problems).
     
  14. Deleted User

    Deleted User

    Guest

    It's not the lights you change, go to the top.. Select lightmapping, click bake and select "on demand".
     
  15. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Right, that's what I did. Except I selected "Global" and On Demand. It didn't do much. Maybe the problem is that I have directional lights in my scene to begin with? I always have, and it performed just fine before. But maybe directional lights now work differently with enlighten in such a way to where it's killing the performance (in a voxel type game). And that is throwing me off, perhaps?

    I figured "Legacy" mode worked like it used to, and figured it should still perform fine then. But that's not the case.
     
  16. Deleted User

    Deleted User

    Guest

    In the version I'm using, if you select on demand it switches it off.. You should be able to tell by the bar in the right hand bottom corner, if it's showing (blue bar comes up with things like clustering) Enlighten isn't doing anything either.

    Profile your game again, the reasons could be nothing to do with GI.. It could be your rendering type are you using DR? Light pre-pass? Forward rendering, are the draw calls the same as in UE4? Is static or dynamic batching switched on / off?

    Start again with the performance stuff, make sure Unity is set up like for like.
     
  17. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    I don't see any blue bar, so maybe that's not the issue after all.

    As for those things, I was using Deferred (not legacy). Draw calls are the same. Those batching options are on.

    I'll have to look into it more tomorrow... what a mystery.