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 KirieZ · Jul 08, 2013 at 02:20 PM · texture2datlas

Breaking a big Texture2D into smallers

Hello all, I have a image with dimensions of 320 x 320 with some smaller images and I want to get these images of 64 x 64

I found some topics about creating an atlas, but the explanations were using smaller images and generating the bigger. [edit] Example:

I have this image (100 x 100):

alt text

I want to break it in 4 textures of 50x50 (on the lines).

Like: Tex1 = circle; Tex2 = red rectangle; ...

What can I do? Thanks in advance and sorry my bad english.

example.png (2.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 robertbu · Jul 08, 2013 at 07:11 PM 0
Share

Your question is confusing. You need more detail about what you are trying to do. A texture atlas can have images of any size. I've used a 4$$anonymous$$ x 4$$anonymous$$ atlas for a dedicated iPad 3 app that had a mixture of both big and small images. If you are talking about just resizing images down, that is best done in a image editing program like Photoshop.

avatar image KirieZ · Jul 08, 2013 at 07:23 PM 0
Share

I edited the post, I think now it is clear. sorry

avatar image robertbu · Jul 08, 2013 at 07:47 PM 0
Share

It is clearer. Do you want to do this at edit time or runtime? Do you need to break it apart into separate textures or is it good enough to display each quadrant on a separate game object? It would help to know what you are trying to do with them? In a way a texture atlas does what you are asking. It takes an atlas of several images and uses part of that atlas in display a game object.

avatar image KirieZ · Jul 08, 2013 at 07:56 PM 0
Share

I'm trying to make one image with all my icons and display only the one that I need using GUI.Label. So I think that I can break it on script start

1 Reply

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

Answer by robertbu · Jul 08, 2013 at 08:25 PM

Breaking an image apart at runtime is a bit ugly and you may increase your texture usage (i.e. have the 'atlas' plus the new textures plus any overhead associated with having a texture read/write enabled). There is an example of how create a new image from a rectangle in the reference page for Texture2D.GetPixels(). If you do implement this way, you will need to mark your texture as read/write enabled. Also I recommend you use Texture2D.GetPixels32() rather than GetPixels().

A potential alternate solution is to use Graphics.DrawTexture(). Based on the reference page, it should do the job of displaying a portion of a texture, but I've not verified that it will work the way you want.

A better solution (from a performance and memory usage standpoint) would be use place your image on a plane. Then you could use material settings or modify the UV coordinates in the mesh to display part of the image.

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.

Follow this Question

Answers Answers and Comments

15 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

Related Questions

How do I access a texture slice's rect via scripting? 1 Answer

Packing unity textures into atlases 0 Answers

Terrain Grass Detail Texture Atlas 0 Answers

Applying a texture to a cube appropriate direction 0 Answers

multiple Texture2D.PackTextures, same rects? 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