Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 instruct9r · Oct 29, 2013 at 11:25 AM · textureuvoffsetatlastiling

The correct way of making Texture Atlas

Hello.

I think i got the idea of the texture atlas, but now i think of 2 ways making this and i wanted to be sure, which one is correct, so i'll need your help :).

Let's say i have 4 different objects with 4 different textures. Below are the 2 ways that i think they can be setUp'd. Each texture is 512x512.

1: The first way i think of is: I keep each model's UV's at 0 to 1 UV space. I combine all the 4 textures into one file (1024 x 1024). Then in Unity i create one scrip and apply it to all these 4 models. The script is something like this:

 #pragma strict
 public var xTile        : float;
 public var yTile        : float;
 
 public var xOffset        : float;
 public var yOffset        : float;
 
 function Start()
 {
     renderer.material.mainTextureScale = Vector2(xTile, yTile);
     renderer.material.mainTextureOffset = Vector2(xOffset, yOffset);
 }

After that i just specify the Tile and Offset for each object, so it matches with the position of it's texture, in the big texture map. The dissadvantage of this method is, that every object (That have Atlas texture) will have to execute that small piece of code at start...

2: The second way is: I make one big texture (1024 x 1024) but this time, instead of keeping each model's UV's, to 0 to 1, i select them and scale them down, so all 4 objects, have their UV's combined into one 0 to 1 UV space. (1 - up left, 2 - up right, 3 - low left, 4 - low right). Then i simply apply the same material to each object in Unity and avoid using the script for adjusting the Tiling and the Offset...

thanks :)

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 fafase · Oct 29, 2013 at 11:32 AM 0
Share

"The dissadvantage of this method is, that every object (That have Atlas texture) will have to execute that small piece of code at start..."

It is at Start so shouldn't that be considered an advantage ins$$anonymous$$d?

avatar image instruct9r · Oct 29, 2013 at 11:37 AM 0
Share

In some way yes, but the second way, doesn't execute any code at all :)

avatar image fafase · Oct 29, 2013 at 11:40 AM 0
Share

I actually do not understand the second principle, for this reason, I'm out.

avatar image instruct9r · Oct 29, 2013 at 11:56 AM 0
Share

Second Way - Here you can see, that every cube's UV's are in the same UV space (0 to 1). This way i don't need to touch the Tiling or Offset of the material in Unity. I just apply the same material and the UV's of each model will fit to it's texture...

The Uv's shoud be actually over the image, but i have moved them to the side so you can see them.

alt text

uvscombined.jpg (210.6 kB)

0 Replies

· Add your reply
  • Sort: 

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

Assigning UV Map to model at runtime 0 Answers

SkinnedMeshRenderer offset UVs to match texture atlas? 1 Answer

Assigning UV coords, from texture atlas. Losing texture uv accuracy at distance. 0 Answers

Having Trouble with Texture Tiling and offset values. Very specific case. 2 Answers

How to match texture Scaling/offset to UV coordinates 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