Home Technical Talk

textures in Unity on IOS

GoK
GoK
polycounter lvl 18
Offline / Send Message
GoK polycounter lvl 18
Ok hope someone can give me a little heads up here. I want to use multiple materials for an environment running in Unity on IOS prob, everything above 3GS, now here is the issue... I want to bake the shadows/ambient occlusion to a separate UV channel, I have been told this will give me a drastically large hit to the frame rate.. is this true and if so does any one have any suggestions or alternatives?

Thanks guys!

Jody

Replies

  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    It's probably true - it'll require another pass on the shader which is hard work for an iphone.

    You're probably better off using unique textures in a lot of cases as the phones have a lot of graphics memory and not a lot in the way of cunning GPU features.

    This is based on the renderer I work with - I don't know enough abut the underside of Unity to say for certain
  • GoK
    Options
    Offline / Send Message
    GoK polycounter lvl 18
    Ah right cheers. Using unique textures would be fine if I can use enough. Do you have any ideas, even a rough estimate, of how many textures I can use per scene? Assuming a worst case scenario I have 4 characters rigged on screen, I'm just using diffuse textures and all textures are 512*512...

    Thanks again!
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    you've got 60 odd mb to play with if memory serves - thats for everything though, not just textures
  • Farfarer
    Options
    Offline / Send Message
    Unity does have all this built in.

    Check the Beast lightmapping stuff, ensure your models to be lightmapped have generate lightmap UVs ticked (or your model has a lightmap UV channel) and are set as Lightmap Static. Ensure the materials have a lightmapped shader.

    The hit isn't that significant (other than another texture call). Only way to tell for sure is to give it a go.

    Lightmaps're fine on Android for me (not got any iOS stuff to test on).
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    it'll depend a lot on the phone I'd have thought - an s2 is not the same as a desire

    It's probably safe to assume that unity will take care of the oily bits and youll get decent performance out of what you want to do though - my comments are based on the understanding that fill rate is usually the sticking point on iphone so you want to minimise the number of times a pixel gets touched
  • Brice Vandemoortele
    Options
    Offline / Send Message
    Brice Vandemoortele polycounter lvl 19
    There is no 'second pass' (a 'pass' draws the whole geometry a 2nd time) for lightmaps on iOS.
    3GS can access up to 8 textures in a single pass if I recall correctly.
    You'll get the best performance by using vertex colors for lighting, but performances are ok with lightmaps even on the oldest devices.

    Avoid transparent/additive/"blended in any way" materials, they're killing the fillrate: iOS use tile rendering - a sort of defered rendering - which is very efficient with opaque meshes.

    Have a look at this for iOS optim in Unity:
    http://blogs.unity3d.com/2011/08/18/fast-mobile-shaders-talk-at-siggraph/
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    I stand corrected

    thats interesting, not the way ours works at all..
  • easterislandnick
    Options
    Offline / Send Message
    easterislandnick polycounter lvl 17
    If you are using static lighting on your background (no realtime light effects) then write a shader that only calculates the diffuse combined with the lightmap and does not calculate lighting on the geometry at run time, it will speed things up immensely.
Sign In or Register to comment.