Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Any interest for a fast threaded compressed texture loading plugin on pc/mac/ios ?

Discussion in 'Assets and Asset Store' started by unisip, Nov 6, 2012.

  1. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    269
    Hi all,

    For one of our projects, we have developed a native plug in that enables us to load images read from disk or web as compressed textures in a unity game without any hickups. And I mean LOTS of textures. Think large city flythrough with progressive texture refinements, or google-earth-style landscape navigation.

    Basically, if you use Texture2d.load and then texture2d.compress, you will get a severe performance hit for each texture you load.
    On my core i7, that's about 30ms per 512x512 texture. If your application requires lots of texture loading, then you can't expect to maintain a smooth framerate while loading. On IOS, of course it gets even worse --> your first person view simply halts for a short while every time a texture is loaded in RAM. Not compressing the textures reduces the problem, but results in using up to 8 times more memory, which is also a big problem on IOS, and to a lesser degree on PC.

    Anyway, we've developed a solution to address this problem, and we're considering making it available through the asset store. Before we go through the process of making samples and tutorials, though, we'd like to hear if anyone of you are interested in such a plug in, and if it s worth the packaging effort on our end.

    Any feedback on this is appreciated.
     
  2. MikaelTroc

    MikaelTroc

    Joined:
    Nov 2, 2012
    Posts:
    33
    That seems really interesting. I would buy it.
     
  3. ddeaco

    ddeaco

    Joined:
    Jan 17, 2012
    Posts:
    44
    Very interested, especially with mobile support!
     
  4. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,545
    interested but why no android?
     
  5. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    269
    Right now we only have unity pro ios licence, but if there is enough interest we might consider android too.
     
  6. MikaelTroc

    MikaelTroc

    Joined:
    Nov 2, 2012
    Posts:
    33
    Do you have any more info about how it works ? With your plugin what would be the performance for loading a 512x512 texture ?
     
  7. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    269
    I will post an EXE demo that compares Unity's standard loading and our plug-in. Looking at the profiler on PC, the loading with our plug-in can hardly be noticed, I think it's less than a milliseconds while Unity's loading is over 30ms on my test machine.

    This is because of the way we handle it:
    - the Texture2D object is created upfront (in your c# code, so if you have a lot of them, you may recycle them), with the proper size and image format.
    - the load request is passed to our code
    - our code retrieves the texture pointer, loads the image data and converts it to the target format in a temporary image buffer
    - once the converted data is ready, it is copied to the Texture2D object and an event is raised to let you know that the texture is ready.

    I will try to capture profiler screenshots too to illustrate that
     
  8. LilWiebe

    LilWiebe

    Joined:
    Sep 25, 2012
    Posts:
    69
    I might be wrong, but it sounds like this is pro-only, if you're editing textures at runtime? Or am I misunderstanding something?
     
  9. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    269
    You are correct. The plug-in would be using native code, so it's Unity Pro only.
     
  10. kimsama

    kimsama

    Joined:
    Jan 2, 2009
    Posts:
    166
    Sounds very interesting.

    What the conversion exactly means?

    Does that mean that the image data which will be loaded by your code is not PVRTC compressed one but your plug-in do convert it when any request is arrived?

    Hope to see it soon.


    -Kim
     
  11. 3d_Artist1987

    3d_Artist1987

    Joined:
    Jul 9, 2012
    Posts:
    716
    very useful tool
     
  12. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    269
    @kimsama : on IOS, the fastest is to have the files in PVRTC format, download them, and the plug-in would load them directly in the texture, no conversion. Live compression can be really slow on IOS. On PC, remote image could be png or jpg, and it could be compressed live to say DXT1 and loaded into a DXT1 Texture2D object
     
  13. kimsama

    kimsama

    Joined:
    Jan 2, 2009
    Posts:
    166
    Agree.

    I read over again what you've mentioned to figure out why your plug-in is fast.

    So is the key point that Texture2D.Load is slow?

    Actually I have an experience with writing similar code at last year which is retrieves twitpic with native objective-c (or java code on Droid device) plug-in via network then renders it on Unity's view when it is needed.

    Well, those twitpic images are usually .png or .jpg as you said, but overall size of that are much small so I even couldn't imagine there can be huge performance boost. :)


    So, even is it possible to speed up loading a scene by letting your plug-in load textures not by Texture2D on iOS?


    Cheers,


    -Kim
     
    Last edited: Nov 30, 2012
  14. jsdalwyte

    jsdalwyte

    Joined:
    Apr 18, 2013
    Posts:
    2
    interested, Android iOS
     
  15. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    +1 for Android iOS support
     
  16. NanoMath

    NanoMath

    Joined:
    Dec 22, 2012
    Posts:
    33
    ! GREAT PLUGIN !

    +1000000 Android iOS support
     
  17. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    4,645
  18. paraself

    paraself

    Joined:
    Jun 30, 2012
    Posts:
    139
    I'd like to buy it only if it's easy to use, simply to get integrated into our current workflow...
    so how the workflow of this plugin will be? Does it support 2d games? Can it be integrated with 2d toolkit?
    We are building a 2d game where a lot of texture is loaded at each level, we did suffer from a great hiccup when loading a level...
    If you could make it work with 2d, defintely will buy it!
    Cheers!
     
  19. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    780
    Definitely interested in buying this.
     
  20. codehead

    codehead

    Joined:
    Oct 21, 2012
    Posts:
    3
    See here, I've made something similar and we're using it in our product:
    http://answers.unity3d.com/questions/184840/download-and-use-pvrtc-texture-ios.html

    Basically, what you do is just have a "pre-compressed" texture placeholder which you duplicate. Then get the native texture ID (which is like a pointer to the texture) and then use OpenGL code in the native plugin to upload the compressed bytes using the texture ID.
     
    Last edited: Aug 13, 2013