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
5
Question by michael 4 · Feb 07, 2012 at 03:06 PM · texturetexture atlas

is possible to tile within a texture atlas?

is possible to tile within a texture atlas?

In other words If I have a small brick texture inside a larger texture atlas. Is there a way to only tile the brick part across the mesh.

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 Pulov · Oct 25, 2014 at 03:14 PM 0
Share

Good to know because I got really dissapointed when I saw it working on 3Dmax and destroyed once imported into unity.

1 Reply

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

Answer by michael 4 · Feb 07, 2012 at 06:14 PM

I have found that it is indeed possible to tile textures in a texture atlas by modifying the shader.

In your pixel output function where the text2D() sampler function is called change your IN.uv_MainTex (or what ever your main texture uv variable is called) to:

 (frac(IN.uv_MainTex) * 0.25f + offset) //this assumes a 4 x 4 texture atlas

so the entire line will look like this

 fixed4 tex = tex2D(_MainTex, (frac(IN.uv_MainTex) * 0.25f) + offset);

instead of

 fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);

you will have to set offset as a variable that is present in the editor by declaring it in the properties section of your HLSL code

Comment
Add comment · Show 9 · 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 Bunny83 · Feb 07, 2012 at 07:13 PM 0
Share

Sure, if you wrap it manually it's possible ;) Haven't thought of wrapping the UVs in the fragment shader.

avatar image eem · Mar 09, 2012 at 11:56 PM 0
Share

Would this code work on iOS? And if so, would it cause any performance hit?

avatar image Bunny83 · Mar 10, 2012 at 01:53 AM 0
Share

I guess it should work. The overhead is marginal. Well like every fragment-shader the load depends on how much of this object is visible on the screen, but the operations aren't really heavy.

avatar image Acheron · Mar 31, 2012 at 07:46 PM 0
Share

What kind of variable is "offset"? A Vector?

avatar image numberkruncher · Apr 16, 2012 at 04:18 PM 1
Share

Would this approach mean that there would need to be one material for each part of the texture? If so then surely there is no benefit to even using atlases right because each material is batched separately... Where else does the offset get defined?

Show more comments

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

11 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

Related Questions

How To Apply A Texture Atlas For UI Image Objects? 0 Answers

Best way to implement texture atlas for objects sharing the same mesh? 0 Answers

how do you assign a texture atlas pict to a texture 2 Answers

Sprite Atlas not working 0 Answers

Questions about texturing models, draw calls, and unity. 0 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