• 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 Der_Kevin · Oct 21, 2013 at 01:34 PM · texturestretchingtk2d

Texture is not setup with Power of 2. How to do so?

Hey! I am currently working on a Sprite Based game with the 2D Toolkit. After I imported my sprites some of them are stretched and looked like this:

alt text

but the original image is this:

alt text

so, when I set the texture type from "Texture" to "Advanced" and then "Non power of 2" to "None" it looks right. The image has a sice of 388x308 so i think the texture is dividable by 4 so its okay, right? Or did a red something wrong about how power of 2 is defined?

So, my question(s) are: 1. how should i set up my texture that it has a power of 2? 2. Or/And: is it even important that the texture has a power of two? Target platform should be iOS(iphone 4+ and Ipad 3+... so retina stuff)

thanks in advance :)

Comment
Add comment · Show 5
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 DannyB · Oct 21, 2013 at 01:41 PM 0
Share

Are you changing the settings of the original source image or the texture of the atlas? In general, with 2D Toolkit you don't need to worry about it too much - the defaults are fine for most cases, and it should not be stretched.

avatar image Der_Kevin · Oct 21, 2013 at 02:59 PM 0
Share

Thanks for all your answers. thats a lot to read. so, now i understand the power of 2 meaning. thanks :) so i have to put my 388x308 in a 512x512 canvas? thats a lot of wasted pixels here, right?

so, what is the worst thing? having a lot of wasted and blank pixels (i think something with 140.000 blank pixels in this one image) just to make it fit into 512x512 or having some textures which are not power of two? scaling it to 256x256 is not a solution for me caue i don't want to scale it down

and, yeah. as DannyB mentioned maybe its totally unnecessary to care about the power of two stuff in the "2dToolkit". Does anyone of you have experience in that?

avatar image meat5000 ♦ Der_Kevin · Oct 21, 2013 at 03:01 PM 0
Share

Please accept the answer which helped you

avatar image Der_Kevin · Oct 21, 2013 at 02:59 PM 0
Share

I changed the settings of the source image. which defaults do you mean if i could ask?

avatar image DannyB · Oct 21, 2013 at 03:16 PM 0
Share

Yes, I have experience with 2D Toolkit. I never once worried about power of two, and never adjusted the source images or the texture of the spritesheet.

When I say defaults, I mean this: In 2D Toolkit, create a new sprite collection, then drag all the images you want to have in this sprite collection, and adjust any setting you need in the sprite collection editor. The toolkit will then create a new texture that is the one that will be used in the game. Your source images will NOT be used in the game, but they will be referenced by the sprite collection (so anytime you change them, the atlas will change).

Thats it.

If by following that you get stretched images, as far as I know, it has nothing to do with power of two, but some other problem.

$$anonymous$$ake your source images as PNGs if possible.

$$anonymous$$ore on tk2d sprite collection in this manual page.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Tayrtahn · Oct 21, 2013 at 01:43 PM

Your definition of "power of 2" is off, that's all.

Powers of 2 are defined as 2^n. So: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, etc.

Comment
Add comment · 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
1

Answer by meat5000 · Oct 21, 2013 at 01:41 PM

Basically start with 2 and multiply by 2, keep multiplying the answer by 2 and those are your Power of 2 magic numbers.

They are basically texture sizes that can fit into neat chunks of binary memory for better performance and optimised memory usage.

They should also be square for best performance but I imagine sticking to the magic numbers if fine [citation needed :P]

In a nutshell, textures are best exported in Po2 sizes for best performance but if you really had to do it in something else, I wouldn't worry a lot.

Comment
Add comment · 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
1

Answer by thef1chesser · Oct 21, 2013 at 01:49 PM

Power of 2 is something different than you think.

2^1 = 2 2
2^2 = 4 2*2
2^3 = 8 2*2*2
2^4 = 16 2*2*2*2
etc.

so the 2 power of 2's around your image size would be 256 and 512.

Then again if u set the texture type to GUI and not to texture then it will be just fine anyway.

Comment
Add comment · 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

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

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

How to Extend/Extrude a Mesh 0 Answers

Custom skybox Shader uv issue, skybox texture stretching along one axis. 0 Answers

Unnatural Texture Stretching 1 Answer

Texture stretches when tiled in editor 1 Answer

Strange texture stretching - big mesh 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