Search Unity

Textures take 1.5gb memory and all others only 300mb!

Discussion in 'General Graphics' started by mfatihbarut, Jan 18, 2021.

  1. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,059
    Hi all,
    As far as I see textures take 5x memory place considering other source eaters.
    What can I do to reduce the texture amount in memory?
    ( I already reduced their resolution from 4096 to 512)
     
  2. cassius

    cassius

    Joined:
    Aug 5, 2012
    Posts:
    125
    Are you using Mip mapping on the textures? If so, disabling them will save about 30% on memory, but you'll lose the benefit of the mip maps.
     
  3. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,059
    I didn't use mip maps
     
  4. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    You mean space in your project, or space in memory when playing? Beyond reducing res, there's not much you can do except atlas them.

    If it's project size, even when putting them to 512, the source texture will still be there at full size. You can change the size in photoshop.
     
  5. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,059
    thanks a lot. I meant the space in memory. I have 2 questions.
    Is there any disadvantage of atlasing?
    Where can I find good guide to follow for atlas.
     
  6. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    The disadvantage is only in the workflow, because you will have to make the atlas either by hand in Photoshop or using some asset store asset, then change the UV coordinates of the mesh/material, because there are now maybe four 512x512 textures combined into one 1024x1024 image. If your mesh needs the texture in the bottom-right, you will have to change its UV's.

    You can use ShaderGraph to make a shader that can do it:
    shadergraph-atlas-flipbook.PNG

    The problem here is that changing the material's properties will change it for every gameobject that uses it. So you can either duplicate the material and change it, but it would be better to have a custom component that gets the material instance and changes it only for that gameobject.

    https://forum.unity.com/threads/can...isntance-of-the-material.665803/#post-4460479
    https://forum.unity.com/threads/usi...raph-shaders-help-wanted.651547/#post-5351751

    You can also change UV's in code, or get an asset from the store. TexturePacker3D is not out yet, but might be soon.
     
  7. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,059
    thanks a lot, but as an indie game developer I felt a little bit overwhelmed with this subject and I don't think I can handle it professionally
     
  8. Kirsche

    Kirsche

    Joined:
    Apr 14, 2015
    Posts:
    121
    Have you enabled crunch compression?
     
  9. mfatihbarut

    mfatihbarut

    Joined:
    Apr 11, 2018
    Posts:
    1,059
    I heard bad things about crunch compression.
    They say it only works desktops but my game is mobile.
     
  10. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    Crunch won't save memory, as the texture is unpacked to a native format on load.
     
  11. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    973
    What texture compression are you using? It sounds a bit like you're ending up with ARGB32s in memory.