I am trying to create a shader pattern, where the uv is split into 7 equally big rows. They should be split by 6 small lines. Almost like in this image of my implementation:
Hi, your approach so far seems correct. Now you can downscale the uv inside the fragment shader so the top horizontal line is not rendered.
You can do this by assigning the uv to a variable and multiplying only the y axis by 0.99. Also you have to replace every reference to vUv with the new variable. Here’s the code:
Because everything that’s rendered from the fragment shader’s output is being controlled by the uv map.
The uv values are 0 left and 1 right for the x axis, and 0 bottom and 1 top for the y axis. In this case when you downscale the uv, you’re cutting out from the view anything that goes higher than 0.99 in the y axis of the texture’s output.
If you want to have more control over the width of the lines, i would recommend creating a new variable at the beginning of the main function that controls the width, and using it as a parameter of the step functions:
In this case the lineWidth is 0.05. It is the third parameter in the step of the pattern 1, and it is used to calculate the step of the pattern 2 (1.0 - lineWidth).
Also the scale of the uv now it’s controlled by subtracting the lineWidth divided by the number of segments of the big rows. This is necessary so the uv displacement reflects the changes in lineWidth size.
I know that, but why the value 0.99 for me it seams kinda random to cut off the top part of the pattern by this value. If i have a uLineHeight of 0.3 for example it would be visible again at the top:
Try with the lineWidth implementation in my second reply, there it’s an adapted version so the uv becomes responsive to the lineWidth variable and it’s not dependent on a magic number.