Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by CunningGrayFox · Mar 22, 2016 at 10:27 PM · texturespritespritesheetcompression

Texture Compression Confusion For Mobile Games

I've been doing some research for a few weeks on recommended practices for compressing textures and I've done some trial and error on my textures and I've learned a lot but I still feeling like I'm missing some key points.

1) @hippocoder Two identical .PNGs, one compressed using PNGQuant and the other uncompressed, yield the same size in the editor when added to the project. If the file sizes are drastically different on disk why does Unity say that they're the same size?

2) Is my pre-Unity PNGQuant compression just creating poorer quality images without any reduction in build or RAM size?

3) @CodeAndWeb Changing the pixel format in TexturePacker doesn't actually change the imported sprite sheets size in Unity and the compression doesn't match what was chosen in TexturePacker. Is a pixel format option other than RGBA8888 providing any benefit?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by hippocoder · Mar 22, 2016 at 11:43 PM

Unity re-compresses unless you choose to use to load them yourself. I would actually recommend the new crunch texture support for tiny disc storage. On a modern GPU you're at the mercy of the texture format you've chosen. If you want more control over it (2D for instance), 16 bit can be an option with dithering via https://github.com/keijiro/unity-dither4444

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CunningGrayFox · Mar 23, 2016 at 01:39 AM 0
Share

First off, let me thank you for actually responding. I thought it was mad creepy to tag you in a question but since I saw you were providing good info in a lot of compression threads I knew I needed your input and you didn't disappoint. Crunched worked great and it's giving me the same compression I'm seeing in the file system from PNGQuant.

Second, just to clarify so that I don't get anymore confused, by "loading them yourself" do you mean writing an editor extension to create a pipeline for importing compressed images into Unity that retain their file system compression?

Finally, another clarification, did you mean decompress ins$$anonymous$$d of re-compress?

avatar image hippocoder · Mar 23, 2016 at 02:30 AM 0
Share

Yes, sorry: Loading them yourself means outside of Unity's API, tools like 2D Toolkit offer this extended functionality, so you could treat the PNGs however you wanted.

And Unity will compress assets itself over your own compression that you supply. I'm glad crunched is treating you well though.

avatar image
1

Answer by Andreas Loew · Mar 23, 2016 at 10:14 AM

You have to distinguish between file format and runtime texture format.

PngQuant PngQuant reduces the size of the PNG file by reducing the number of colors to 256 or less. This allows better compression on the disk. The unpacked PNG file still uses the RGBA8888 color space at runtime. There's no gain in runtime memory.

Unity repacks the sprite sheets. Images treated with PngQuant might give you better compression for the final App's download size.

RGBA4444 RGB5551 and RGB565

If you use TexturePacker the following happens: TexturePacker converts the images to the 16 bit color space and applied dithering to retain the image quality.

Pngs still have to be written as 32bit images - but when you set Unity's texture format to 16bit you get the higher quality images because of the dithering.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CunningGrayFox · Mar 23, 2016 at 09:10 PM 0
Share

The difference between file and runtime formats seems to be what was causing my confusion.

So, basically, one of TexturePacker's features is the same as the asset that @hippocoder referenced which includes the dithering in the file format so that when the Unity texture format is set for the corresponding compression you get better quality at runtime (e.g. less or no banding on gradients).

Now things are making a lot more sense.

So, correct me if I'm wrong, I guess what @hippocoder means by Unity compressing over my own compression is that while the file format is already compressed before being imported into the project Unity will compress the runtime texture format.

avatar image Andreas Loew CunningGrayFox · Mar 23, 2016 at 09:52 PM 0
Share

Exactly. Unity loads the .png file and depending on what you decide re-packs the file into its assets.

It looks more or less like this:

  • TrueColor = RGBA8888

  • 16 Bits = RGBA4444 maybe RGB565 on opaque sprite sheets

  • Compressed = Hardware dependent compression like PVRTC, ETC1, DXT

I would not recommend using Compressed for sprites - at least not of you plan to deploy on iPhones (PVRTC codec). The quality will usually become too low - but this depends on your art style. It's ok for backgrounds - but usually not for high contrast sprites.

TexturePacker gives you the advantage of dithering in 16 Bits. What you'll also gain by using TexturePacker is it's new Pivot Point Editor and optimized polygon sprites (saving both: CPU + GPU).

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

57 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Black and White compression settings? 2 Answers

After changing my Sprite compression settings for WebGL I got the error "Failed to Create 2D Texture." 0 Answers

Gui Box - Texture - Spritesheet 0 Answers

Sprites with Mipmaps Vibration Effect on Animations Problem 0 Answers

If a texture/sprite is NPOT, does Unity still compress it behind the scenes (by converting it to POT)? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges