Search Unity

Substances Long Load Time

Discussion in 'iOS and tvOS' started by mattSydney, Mar 19, 2013.

  1. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    I have started experimenting with pre made substances from the unity store and created a simple scene and tested it on my old iphone 4.

    With Substances load time 21 seconds
    Without Substances and same textures load time 5 seconds

    Is there any way to speed this up? 21 seconds is way too long, even I wouldn't wait that long for an app to load
     
  2. Crazy Robot

    Crazy Robot

    Joined:
    Apr 18, 2009
    Posts:
    921
    Hello,

    I submitted that bug about 1.5 - 2 years ago. The workaround for me was to bake the texture and use that on a normal material instead of using the Substance material. Of course that meant I couldn't have the ability to change any parameters at runtime.

    I was told that the long load time was addressed in Unity 4.1, but I guess not. I see that Allegorithmic is boasting about using substances on iOS (changing parameters at run time), but with the very long load time, they are useless. Like I said, I would get the look of a texture the way I wanted it and baked it to a texture and used that. I don't see what's changed, I still can't use substances at runtime because of the extended load time.

    Here is my question and the answer that was given in January (look close to the bottom):

    http://forum.unity3d.com/threads/86414-Substance-answers-!/page19
     
  3. Jerc

    Jerc

    Joined:
    Sep 24, 2010
    Posts:
    300
    Substance generation is indeed faster in 4.1, but most of the optimization was done on the cooking side so we need to update the substances themselves to see the real benefits. It will happen very soon.
    Moreover 4.1 brings a cache system that allows the substances to be generated just once during the first launch, then they are saved on the device.

    Also keep in mind that substances need computation power to generate and iPhone 4 has very little of it. Substances will work, but slowly. If you want to create animated effect, you shouldn't target devices weaker than Tegra3.

    Finally, I advise you to look at Bitmap2Material mobile, if you want to reduce the size of your game, as it is much more optimized for mobile than the substances on the marketplace which were aimed at running on PC and Mac. We are also planning to add mobile-optimized substances to the database very soon.
     
  4. Glockenbeat

    Glockenbeat

    Joined:
    Apr 24, 2012
    Posts:
    670
    Actually I can confirm this problem now, yet with the difference that it only started with Unity 4.1. I tried different settings as for caching/baking and such, but load times went up a lot.

    However, before nagging too much about that I first want to fully migrate the substances to the new B2M Mobile version and see if that does help. By the way, currently I ended up using "bake and discard substance" to resemble the behavior of pre 4.1 Unity. No luck unfortunately.
     
  5. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    171
    Thanks guys I'll try your tips
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Just to ensure thats kept in mind: Prior to Unity 4.1, there was no support for dynamic substances in mobile targets at all!
    If you used substances in Unity 4.0 and earlier for a mobile target, they were baked upon export, there was 0 runtime allocation and 0 disksize saving, all you got was an easy, consistent cross platform development.

    This indeed means that it will now take significantly longer at runtime if you decide against bake at edit time (which was what it did before 4.1)
     
  7. ronronmx

    ronronmx

    Joined:
    Aug 16, 2010
    Posts:
    201
    Did I miss something in the Release Notes because I was completely un-aware of that fact! I knew substances were now being supported on mobile, but didn't know that my loading times (granted only the first level load) were going to increase so much. I have spent the last 3 days trying to figure out what was causing that loading time increase in my game, and figured it out yesterday after deleting my Substances folder...

    Since I seem to be ignorant on the subject, maybe you can help me with this:
    I have 2 Substance folders: Substances_Free Substances_SR
    In the "_Free" folder, there are 10 substances that are not used anywhere in my whole game.
    In the "_SR" folder, there is only 1 substance, and it is referenced on my MaterialManager class by drag&drop.
    If I leave the "_Free" folder in my Project, the first level load time hangs for about 12 seconds (substances being compiled).
    If I remove the "_Free" folder from my Project, the first level load time only hangs for about 1 second (my 1 substance is being compiled).

    Why are the substances from the "_Free" folder being compiled at all? Just because my game uses 1 substance so it automatically includes all the substances it finds in my Project? If that's the case, then how can I prevent that even by leaving the "_Free" folder in?

    Thanks!
     
  8. ronronmx

    ronronmx

    Joined:
    Aug 16, 2010
    Posts:
    201
    Well I did that test again (deleted the Substance folder with substances that are not being used by my game), and the load time stayed the same this time around, so no they are not being compiled, contrary to what I thought earlier.

    Now that makes a lot more sense :)
     
  9. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462

    Hi Jerc,

    Optimization was done on the Cooking Side? I am understanding that the optimization is done in Substance Designer, is this correct?

    If this is the case, for those who are using Substance Designer, is there a Best Practice Guide for Making Substances that is Mobile Optimized?

    Thanks.
     
  10. morbidcamel

    morbidcamel

    Joined:
    Dec 23, 2013
    Posts:
    8
    Hi guys, it's probably an old thread but I'm experiencing very low performance when I load my scene in the designer never mind running the game. I've set all of my substances (use it quite a lot) to "Bake and keep substance". My understanding is that it will bake it when you apply the setting or when does it bake?