I'm testing out a theory where I can try to be a bit more optimized... to do this, I am trying to tile a specific portion of a texture along a certain coordinate (Vtiling, but not Utiling at all)
This is the preview of the current material. The area circled in blue shows the area of the material that I am trying to tile.
Here is the texture itself along side of the mask of the texture portion I am trying to tile.
Here is what I am trying to avoid:
I know I can do this through making them separate textures, but again I am trying to practice optimization. How would you go about doing this?
Replies
Yeah, the problem is that I cant really comprehend how to set this up in the shader. A friend told me that I could potentially do it with subUV, but I've still yet to figure it out.
So I'm trying to take a texture like this:
and create something like this:
except doing it entirely through the shader (with that mask that I've got in the alpha)
for example-
fmod(UV, float2(1.0,0.5));
This will repeat your texture on Y depending on the limit you feed it - with the above pseudo code it'll repeat from 0 to 0.5, and then repeat that section infinitely.
You'll want to only do this operation on Y though, so it'd be
wrapLimit = (the value you want to go from);
float2 WrappedUV = (inCoords.x, (fmod(inCoords.y, wrapLimit)));
Those would tile. To tile from a point that's not 0, just add to your fmod UVs, so it'd be something like (WrappedUV + uvOffset.xy)
In your example you'd want tile to about 0.3 (as this is about the percentage of texture space you're looking at) and then add 0.7 to make it look from 0.7 to 1.0
BUT - and here's a lovely caveat - there's limits with this. Because it's all maths based, and some other stuff I don't understand - you will get an infinitely small seam every time it tiles.
I have never been able to fix this - I almost used this technique on AA but then just could not solve that. It's a shame, as it would be useful otherwise.
Maybe someone else knows the solution to that. I feel like you should be able to do it with multi samples but no idea off the top of my head.
That's the complicated way that I think you are looking for, but realistically... forgive me, but could you just make a tiling texture for that? You've already had to bring in a mask for it -that would be my recommendation. Or go in hard with the UV layout!
aaaqqbbbbbbbbrrccc
and you want to tile just the underlined part, make this modification to your texture
aarqqbbbbbbbbrrqcc
so now when it samples from the last r the q will of bled over.