- Home /
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?
in which case doesn't it work properly? in which context do you use it?
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
just to be sure:
tex2D(_Splat, IN.uv_Splat0);
works O$$anonymous$$, 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?
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
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))
Your answer
![](https://koobas.hobune.stream/wayback/20220613075739im_/https://answers.unity.com/themes/thub/images/avi.jpg)