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
2
Question by MayaYT · Nov 19, 2013 at 08:38 AM · 2dtexturespritematerialatlas

How can I use atlas sprite as texture for a material?

http://i.imgur.com/qfypRkL.png (See this image first)

My texture sheet (WIP1) has been spliced into 20x20 squares. I need to use WIP1_01 as a texture in material grass. WIP1_01 is highlighted on the plane in my scene. It is the grass square. I want to tile that onto a background. I can manually slice it and import that I know, but it would be convenient if this way worked too. When I try to add a texture in the material editor it only shows the WIP1 image, not the spliced images.

I will also add that I am using unity 2D. Is this the correct approach to creating a 2d background? I was going to just instantiate a heap of textures onto the screen on load but I figured that would use too much memory.

Thanks

Comment
Add comment · Show 1
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 Geta-Ve · Mar 18, 2014 at 01:38 AM 1
Share

I too would like to be able to accomplish this task... I can definitely cut up my atlas pre import, but it would be awesome to be able to select the sprite post splice within Unity and use that as a material.

Any info would be awesome.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Adamcbrz · Mar 18, 2014 at 02:02 AM

Well this is somewhat defeating the purpose of the atlas. There are two ways to solve the issue.

1) (The one you already know) Make a material with just that one texture and set the uv tile settings to repeat. This is probably the cheapest and easiest for most applications.

2) Create a mesh that is however many quad meshes that you need to make your tiling. You can do this method using unity quad primitive but that would be more expensive then creating your own meshes.

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 Geta-Ve · Mar 18, 2014 at 02:07 AM 0
Share

Hey Adamcbrz! Thanks for the great reply. :)

Perhaps erroneously, I was using the sprite atlas as a sort of catch all for all my assets -- not just what would be used in the particle system. I$$anonymous$$ Players, enemies, random sprites, etc. Granted I am just playing around and testing right now, but it would be fantastic not to have to import several separate .png's for each.

Just have my one big atlas and pick and choose which sprites are used for what purpose.

Seeing as how there is no obvious solution (apart from your great workarounds) I am thinking that I am probably out of luck in this area.

Thank you anyways. :D

avatar image GrandOpener · Jun 17, 2014 at 11:14 PM 0
Share

To expand a bit on what Adamcbrz was saying at the beginning; pretty much the whole point of texture atlases is combining many logical parts into a single texture, so that a material using that texture can color all the different parts of the object with fewer draw calls. If you are going to render an object with a separate material that is only using one image from that atlas, putting that image in the atlas is just causing you more work for literally no benefit. I don't know your workflow, so maybe you have good reasons, but I'm not sure why it would be "great" to not have separate files for separate assets. I've always viewed atlases as a necessary evil, not a thing I actually want to do...

Having the grass as it's own separate texture is the right solution here--I think you will probably like doing it that way when you try it.

avatar image
0

Answer by Yofurioso · Mar 18, 2014 at 12:52 PM

I think in order to make the atlas work properly you have to make your own mesh and UV unwrap it so that the mesh uses only certain coordinates of the atlas for texturing (I'm not sure if that came up right). Try this, use blender or 3dsMax or any other 3d modeling software and make a simple plane (4 verts, one quad), then unwrap it and then scale the uv layout so that the plane uvs cover only the grass texture. After that all you need to do is duplicate that plane as many times as you require.

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

20 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

Related Questions

Overlay texture on sprite 0 Answers

How would you go about creating a material that allows you to add fully tiling textures to a 2D sprite? 1 Answer

loading sprite from atlas in script 4 Answers

Black boarder on transparent sprites 2 Answers

Create sprite renderer using custom material 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