• 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
Question by cod · Aug 16, 2012 at 08:29 AM · shadershaderlabcguvs

How can I access Texcoords x and y?

So, If I write this it's all right

 IN.uv_Splat0

but if I write

 float2(IN.uv_Splat0.x, IN.uv_Splat0.y)

it doesn't work properly

Is there a way to access and modify uv's x and y in a shader?

Comment

People who like this

0 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 ScroodgeM · Aug 16, 2012 at 08:30 AM 0
Share

in which case doesn't it work properly? in which context do you use it?

avatar image cod · Aug 16, 2012 at 08:46 AM 0
Share

when I set up a texture using tex2D(_Splat, float2(IN.uv_Splat0.x, IN.uv_Splat0.y))

because I need to modify x and y value of the uv_Splat0

avatar image ScroodgeM · Aug 16, 2012 at 09:13 AM 0
Share

just to be sure:

tex2D(_Splat, IN.uv_Splat0);

works OK, but

tex2D(_Splat, float2(IN.uv_Splat0.x, IN.uv_Splat0.y));

doesn't work in the same place? what happened then? and is it correct to use _Splat texture with _Splat0 mapping?

avatar image cod · Aug 16, 2012 at 10:03 AM 0
Share

well, the point is that I have a texture atlas for my terrain textures and I unpack them this way

float2((frac(IN.uv_Splat0.x)*-0.5), (frac(IN.uv_Splat0.y)*0.5))

but if I need to tile them 7 times less in the normal shader I would write

IN.uv_Splat0/7

but if I write so

float2((frac(IN.uv_Splat0.x)*-0.5), (frac(IN.uv_Splat0.y)*0.5))/7

it just shows me 1/7 of the texture

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by ScroodgeM · Aug 16, 2012 at 11:40 AM

float2((frac(IN.uv_Splat0.x/7)*-0.5), (frac(IN.uv_Splat0.y/7)*0.5))

Comment

People who like this

0 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 cod · Aug 16, 2012 at 12:34 PM 0
Share

already solved, it's a multiplication between matrix

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

Shader error "Parser is hopelessly lost" when declaring uv2 variable. 1 Answer

How to force the compilation of a shader in Unity? 5 Answers

Where is model space origin in shaderlab? 1 Answer

Problem with lighting in CG Shader 1 Answer

Uniform variable operations not for every vertex and fragment. 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