• 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 christo1745 · Jun 24, 2011 at 04:09 PM · texturematerialbatchingskinned mesh renderer

Texture Atlasing

I want to combine a bunch of textures into one material, then use that material for multiple gameobjects so they will batch. However, if I use material offsets to do t$$anonymous$$s, it creates a copy of the material for each object, thus no batc$$anonymous$$ng. I noticed that imported meshes use a skinned mesh renderer, w$$anonymous$$ch looks like it uses Bounds to ac$$anonymous$$eve the effect I'm looking for. However, I t$$anonymous$$nk you can only use that with imported objects.

In other words, instead of having eyes, a nose, and a mouth all on one texture, I want 5 different 2d buildings.

Edit: I thought that SetTextureOffset changed the UVs. Apparently I need to use the method suggested by The comments below. Thanks guys!

Comment
Add comment · Show 13
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 Toxic Blob · Jun 24, 2011 at 04:16 PM 0
Share
avatar image christo1745 · Jun 24, 2011 at 04:21 PM 0
Share
avatar image Marnix · Jun 24, 2011 at 04:23 PM 0
Share
avatar image Toxic Blob · Jun 24, 2011 at 04:27 PM 0
Share
avatar image Toxic Blob · Jun 24, 2011 at 04:47 PM 2
Share
Show more comments

3 Replies

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

Answer by Marnix · Jun 24, 2011 at 04:22 PM

You should use the `sharedMaterial` property in the renderer. You could even already define it in the material prefab in your project before adding it to an object. In runtime, it will only change one object, but sharedMaterial changes it for everyone.

New answer

Change the uv-coordinates of your vertices instead. It is just a quad, so you can change the vertex data!

Comment
Add comment · Show 14 · 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 christo1745 · Jun 24, 2011 at 04:24 PM 0
Share
avatar image Marnix · Jun 24, 2011 at 04:25 PM 0
Share
avatar image christo1745 · Jun 24, 2011 at 04:35 PM 0
Share
avatar image Marnix · Jun 24, 2011 at 04:37 PM 0
Share
avatar image Marnix · Jun 24, 2011 at 04:48 PM 1
Share
Show more comments
avatar image
2

Answer by Steven-Walker · Jun 24, 2011 at 04:56 PM

You need to offset the UV coordinates of your meshes so they correspond to the atlas coordinates. So there's 1 atlas containing multiple textures and 1 material applied to multiple objects. What makes t$$anonymous$$s work are the UV coordinates of the mesh. Your material in Unity should have default offsets (1,0 1,0).

You can build an atlas in Unity and create the UV mesh coordinates using an editor script (or tool like Sprite Manager). Or you can manually build an atlas in Photoshop and assign the mapping/UVs in an external 3D program.

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
0

Answer by raminsh · Jun 24, 2011 at 05:05 PM

ok I have actually done t$$anonymous$$s but not in unity, I usually use one of the following:

1- NVIDIA Texture atlas (you can get it from: http://developer.nvidia.com/legacy-texture-tools and it has pretty much all you need)

2- Flatiron from: http://www.texturebaking.com/ t$$anonymous$$s one is a 3dmax plugin and really useful

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 christo1745 · Jun 24, 2011 at 05:09 PM 0
Share

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Make a gameobject with textures semitransparent 3 Answers

How to switch the texture being used by the material of the mesh renderer 1 Answer

How can I transparent mesh with texture UV map 1 Answer

Weird "ghost" texture issue with Transparent Texture/Shader 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