Search Unity

GIMP 2.0 pixel art = massive file size issue

Discussion in 'Formats & External Tools' started by eyesacnewton, Feb 10, 2020.

  1. eyesacnewton

    eyesacnewton

    Joined:
    Feb 3, 2020
    Posts:
    12
    Trying to make a pixel game, but I have to massively increase the resolution of the image to avoid fuzziness so 200 pixels ends up being 500 MB and a picture ends up being 53 gigs. Is there a way to avoid such a heavy usage of storage space with a crisp image or is this just gimp? Does Photoshop do the same?
     
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,635
    That sounds weird. What file format are you saving it as?
     
    eyesacnewton likes this.
  3. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    What do you mean "massively increase the resolution?" Are you saving it in some way that's not 200 pixels?

    Fuzziness would have nothing to do with the image, it'd have to do with how your shader is interpolating. My guess it that by default Unity will load images with bilinear filtering, switch it to just plain nearest.
     
    eyesacnewton likes this.
  4. eyesacnewton

    eyesacnewton

    Joined:
    Feb 3, 2020
    Posts:
    12
    I'm saving it as a png.
     
  5. eyesacnewton

    eyesacnewton

    Joined:
    Feb 3, 2020
    Posts:
    12
    No, I am not saving it in 200 pixels. I up the resolution from 200 by 200 to 5000 by 5000 to reduce the fuzziness. I also do not believe it has anything to do with unity because the image shows up fuzzy in the Microsoft image viewer as well.
     
  6. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,635
    That doesn't make any sense to me. Even if the source image was blurry to begin with, scaling it up would not make it look any sharper. Can you show what the image looks like?
     
    eyesacnewton likes this.
  7. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    I'm 99% sure that he's referring to how it's displayed, which is due to bilinear filtering. He needs to switch the rendering to whatever the Unity equivalent of GL_NEAREST is.

    Just save it at 200x200, fix the rendering, don't work around it.
     
    eyesacnewton likes this.
  8. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,635
    I agree with newjerseyrunner. I'm pretty sure Microsoft image viewer applies antialiasing (similar to Unity's Bilinear filtering) so it will also appear blurry there too. Your 200x200 image is probably perfectly crisp in actuallity. In unity you can turn-off this blurring like newjerseyrunner mentioned.
     
    eyesacnewton likes this.
  9. eyesacnewton

    eyesacnewton

    Joined:
    Feb 3, 2020
    Posts:
    12
    Applied point (no filter)
    pixels are back, but the colors are blended together. It's basically just a pixelized version of the fluffy image. Capture9.PNG Point (no filter) Capture10.PNG Bilinear

    In addition, how do I turn off anti-aliasing in the photo viewer if I can?
     
    Last edited: Feb 12, 2020
  10. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,635
    Did you turn off compression also? That option is also in the image import settings, close to the filtering option.
     
    eyesacnewton likes this.
  11. eyesacnewton

    eyesacnewton

    Joined:
    Feb 3, 2020
    Posts:
    12
    Turned it off, no difference
     
  12. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    If it's not in the shader, then it's coming from somewhere else in the texture import pipeline, because it's not the rendering settings now. Two things come to mind: mipmaps, and rescaling.

    Turn mipmapping off, if your game is 2D, you don't really need them. Either that, or make sure that mipmapping also uses nearest filtering and not bilinear.

    Secondly, I'm guessing that when the texture is imported, it's upscaled to 256x256. May I ask why you chose a resolution of 200x200? That seems totally arbitrary. See in the advanced settings whether or not it's scaling the texture to a power of 2. I think that's the default behavoir and since your image is a strange size, it has to do some scaling before it will even enter the rendering pipelin.
     
    eyesacnewton likes this.
  13. eyesacnewton

    eyesacnewton

    Joined:
    Feb 3, 2020
    Posts:
    12
    I am unable to find where to turn off minimapping and where the advanced settings are. Where can I find these? Also 200 by 200 seemed pretty normal to me so that's why I chose it, should I choose a different resolution?
     
  14. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,635
    Any imported image that's not a power-of-two (128x128. 256x256, 512x512, etc.) may be resized to the closest power of two when imported, which may change the way it looks. I didn't think this was supposed to happen to sprites, though. In the image import settings, did you select "Sprite (2D and UI)" for your texture type?

    Also the option to turn-off mipmapping (not minimapping) should be right above the "filter mode" . It says "generate mip maps". Be sure that is not checked.
     
    eyesacnewton likes this.
  15. eyesacnewton

    eyesacnewton

    Joined:
    Feb 3, 2020
    Posts:
    12
    Alright turned it off, also messed around with gimp and set compression to 0 in the export settings building off of turning off crunch compression in the unity import settings, and messed around with more import settings including setting the pixels per unit to 16. Experimented with bigger files that were still blurry and just increased the max size near the compression option. These effectively solved my issue. Thanks for bearing with me and sorry for slow replies.
     
  16. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    pic.png
    256x256 is most likely the resolution you want, you want to use a nice even multiple of two because GPUs have hardware specifically optimized for reading them. Modern graphics cards let you use whatever resolution you want, but it's not optimal. So either switch the "Non-Power of 2" setting to "None" or keep your sizes on even multiples of 2.

    Compression in GIMP doesn't matter, Unity is going to repackage your image when it builds anyway. Just make sure you're always exporting to PNG or some other lossless format.