• 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
3
Question by Kylotan · Jan 23, 2013 at 08:10 PM · texturesprite

How can I get Unity to stop resampling my sprites?

I am rendering sprites as a single texture on a quad. Unfortunately, Unity resamples the texture to the nearest power of two which affects the artwork when it is a different size (eg. 24x24). I can zoom in during play and see that the texture has become a 32x32 one. The texture is set to Point mode so bilinear filtering is off.

I have tried setting the asset to the 'GUI' texture mode, but it is still being resampled. Similarly if I go to 'Advanced' texture mode and leave the nearestPowerOfTwo mode on 'None', it is resampled then, as well.

Anybody have any suggestions?

Example image, Scene view on left, original asset on right: alt text

And a close-up of how the texture appears in the preview after importing, to show it was imported correctly: alt text

texture_sampling_issue.png (10.6 kB)
texture_sampling_issue_2.png (4.1 kB)
Comment
Add comment · Show 20
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 Wolfram · Jan 23, 2013 at 08:45 PM 0
Share

How do you render into that texture? Do you use RenderTextures or regular textures? Do you create textures by script or are you exclusively using project assets? When you hit play and zoom in, hit pause, then select the object you suspect to have 32x32 in the scene view and find the texture in the inspector. What resolution does it give in the preview? Are any other settings off?

We need more information.

avatar image Kylotan · Jan 23, 2013 at 09:22 PM 0
Share

It is just a plain project asset, a PNG. The image in the preview is the original resolution on disk (24x24), but in Scene and Game view it's 32x32 with the resampling artifacts.

avatar image Kylotan · Jan 23, 2013 at 09:29 PM 1
Share

Yes, I counted the pixels. I posted the image so you can too. :) There is no bilinear sampling; it's set to Point mode. If I use a 32x32 asset it renders perfectly.

avatar image Wolfram · Jan 30, 2013 at 08:00 PM 1
Share

Sorry I didn't get back to you earlier. The answer is "yes, Unity resamples your textures, and no, you can't prevent it". See my answer for a more detailed explanation.

avatar image Wolfram · Jan 31, 2013 at 06:13 PM 1
Share

Summary of the white-alpha-pixel-problem: http://forum.unity3d.com/threads/168532-White-rims-around-transparent-textures-an-analysis

Show more comments

6 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Madhotdog · Apr 25, 2014 at 11:51 AM

Couldn't you just add the sprite to a sprite sheet (which is PoT) and then change the texture co-ords of the quad? That should give you pixel perfect sprites and work more optimally.

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 Wolfram · Apr 25, 2014 at 12:07 PM 0
Share

That's good advice, but it has already been suggested by @$$anonymous$$alikDrako, and was discussed in @Bunny83's answer (it's called a "texture atlas"). (although they didn't explicitly mention that the atlas must be POT, though that should be selft-evident)

  • ‹
  • 1
  • 2

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

16 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

Related Questions

How to create a GUI like Zombieville? 1 Answer

How to stop gradient banding? 2 Answers

Texture input: changing format 1 Answer

Assigning UV Map to model at runtime 0 Answers

How change sprite animation texture?? 2 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