Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Baalhug · Feb 20, 2014 at 04:47 PM · guibuttonsmoothqualitypng

Another quality problem with .png GUI graphics

Hi, guys:

I've seen a lot of questions like this, but none of them actually resolve me problem. I have drawn some buttons on Inkscape in png but when i use them in unity they look terrible, specially when the device has a small screen (mobile).

I'm using:

Texture Type: GUI Filter Mode: Trilinear

Override for Android checked Max Size 1024 Format: True Color.

The result is this:

This is the original png, quite smooth, as you can see:

alt text

And this is the look it has in unity:

alt text

As you can see the black borders look like hell.

Do you know how to solve this? I've seen unity apps running on android with smooth looking gui buttons. I just dont know what else to try.

Any help is really appreciated.

button real.png (8.0 kB)
button original.png (43.8 kB)
Comment
Add comment · Show 4
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 Baalhug · Feb 20, 2014 at 10:26 PM 0
Share

Anyone? I need help, please!

avatar image getyour411 · Feb 20, 2014 at 10:32 PM 1
Share

Can you adjust so that it is a Power of 2? Would be interested to see if the Unity imported png looks ok once it is - while I don't do $$anonymous$$obile I DO use png for many textures, all power of 2 and they look fine.

avatar image Baalhug · Feb 20, 2014 at 11:00 PM 0
Share

O$$anonymous$$, i have converted the button in a 512x512 image using gimp, but the result is the same, the black line is heavily pixelated:

alt text

button import settings.png (64.2 kB)
avatar image MakeCodeNow · Feb 20, 2014 at 11:49 PM 0
Share

Try changing it from GUI to just regular Texture with Alpha as Transparency. There's an outside chance that will fix your issue.

1 Reply

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

Answer by Hoeloe · Feb 21, 2014 at 12:19 AM

This is because the GUI setting disables Mipmaps. Mipmaps are a fast way of resampling images to make them smaller in real time, while retaining quality. The way they work is by pre-computing various sizes of the image, and then indexing the appropriate scale.

When you disable these, however, Unity defaults to Nearest Neighbour sampling. This means that, when the size changes, it just uses the colour of the centre-most pixel in that area. This means that thin areas, like outlines, often end up missing pixels in some places, and being double-thickness in others. This produces artefacts like the ones you're seeing. The upside to nearest neighbour is that, if you're not changing the size by much, it doesn't blur the image in the same way bilinear sampling does.

What you'll need to do is one of the following:

  1. Make the source image the size you want to display it at. This will give the best results, but is suboptimal if you plan to run this on screens of various resolution.

  2. Set the texture type to "Texture" instead of "GUI". This will get rid of the problem, but your image may appear blurry if you're resizing it too much.

  3. Create a custom texture format that uses Bilinear sampling instead of Point (nearest neighbour) sampling, but with mipmaps still disabled. I'm not sure entirely how well this will work, so it might be worth a try, though it may not work at all.

I recommend you look up some of the terminology I've used in this answer, and hopefully it will help you to understand what the problem is.

Comment
Add comment · Show 1 · 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 Baalhug · Feb 21, 2014 at 11:50 AM 0
Share

Solution 2 did the job perfectly.

It appeared a "white shadow" around edges but saving the alpha channel in GI$$anonymous$$P when exporting got rid of it, so now it looks perfect in game:

alt text

Thank you very much, Hoeloe, love you forever.

button final.png (31.2 kB)

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

21 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

Related Questions

Problem with icon in GUISkin 0 Answers

GUI Button using .png image? 1 Answer

Button position 4 Answers

Gui Playing Audio Trouble 1 Answer

GuiTexture (Touch button) unfollow camera! 1 Answer


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