Search Unity

Question about Texture Size

Discussion in 'General Graphics' started by TeKniKo64, Jun 26, 2018.

  1. TeKniKo64

    TeKniKo64

    Joined:
    Oct 7, 2014
    Posts:
    30
    Hey there,
    I am designing a game that has a very simple art style. So simple, that all the textures are one solid colour. I came across a YouTube tutorial and I would like to use his method (link below, stats at 1:08). My question is, if I put all my colours into 16x16 squares, unwrap all my models onto their corresponding sections and then import into Unity. Will the engine use the entire 1,024 x 1,024 file for each model or will it only use the section my unwrap is on?

    My goal is to save on video memory and file size. Is this a good method for my art-style or is there a better way to lower the texture size. Thank you.



    PS: The style in the video is similar to what I am going for.
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    Every model will use the entire 1024x1024 texture, but as long as they all point at the same texture asset it’s only in memory once.

    If you’re really concerned about it the last game I released used a single 128x128 uncompressed texture with 2x2 pixel color patches as the only texture for most of the game objects. We only used about half of the texture in the end. You could get away with even 1x1 pixel color patches, just turn of mip maps and use point filtering. Heck, you can use a 1024x1024 texture with 16x16 pixel squares while authoring for convenience, and tell Unity to scale that to a 64x64 texture (point sampled, uncompressed, no mips) and it’ll look exactly the same.

    The absolutely cheapest solution is to use vertex coloring. Each vertex can have a unique color if you want, no texture needed. Ignoring the lack of textures in your build, this can even make the meshes themselves smaller as the texture UVs use two 32 bit floats, and a vertex color is only 32 bits at max. With mesh compression enabled this is a wash.
     
  3. AkiraWong89

    AkiraWong89

    Joined:
    Oct 30, 2015
    Posts:
    662
    @Hawkadium
    I have 2 more efficiency workflow suggestion:


    • Make a RGB color palette texture like above and unwrap your model specific faces into a dot then move to corresponding UV position. Make the texture square and power of 2 of course.
    • Like @bgolus said by using vertex painting on your model so no texture usage. The classic style.
     
  4. TeKniKo64

    TeKniKo64

    Joined:
    Oct 7, 2014
    Posts:
    30
    @AkiraWong89 This vertex painting sounds like an interesting idea. I will Google that now. I also noticed I can create a material in Unity, select a colour from the palette (for Albedo) and I get the exact same effect. Is Unity automatically creating a texture somewhere or is this just an effect on lighting? Could I just create my entire colour palette with materials in Unity and then apply them to my models?
     
  5. AkiraWong89

    AkiraWong89

    Joined:
    Oct 30, 2015
    Posts:
    662
    It's just a color multiplier driven by shader. Same concept as Photoshop blending mode > Multiply effect.

    You means each color per materials? No. I'm strongly not suggested or your draw call will be extremely high which might make your game lags. Always stick to texture atlas method as much as possible is the best practice if you have textures.
     
    TeKniKo64 likes this.