How to sync wave texture node generated stripes with image texture tiling

How to sync wave texture node generated stripes with image texture tiling?

I combined these two, but can’t get them properly in sync. I want to match black stripes with image textures tiling and keep it so even when scaling changes.

Wave texture node is in Band, Sine, X -mode and it has been sharpened with color ramp.
Texture image consists of 8x8 concrete tiles.
What kind on math and nodes is needed here?

Edit: This answer is WRONG! The wave texture only pretends to have π cycles per unit length but it is slightly off… please see answer below.

Wave texture at Scale 1.0 in UV coordinates 0 to 1 makes 3 and a bit stripes…

What famous number do you know that is 3 and a bit?

Hope you said π.

So, to normalize you just need to scale by 1/pi… that is the factor you’re looking for…
e.g. here Scaling UV by that factor and selecting Scale of 5 gives exactly 5 bands.

Good luck.

3 Likes

Thanks! Got it working!

Hi, sorry to dig this up again but I had a look at the source code for the wave texture and things are quite insidious:

The actual scaling factor is pi/10.

With my first answer things would go out of sync after a while.

Sorry for the wild goose chase.

3 Likes

Thanks. I had no idea why I could never get the wave generator actually do what I intended it to do and I’ve ended up doing manual sine/triangle functions instead. Now I know. But, seriously, pi/10 - why?

Seems arbitrary… Had to read the source code to figure out that the equation for the sin wave is 0.5+0.5*sinf(20*n*s-(pi/2)) where s is some scaling factor. (no idea why the devs settled on this but it seems evil since it appears to have pi cycles per unit length but it actually doesn’t (causing the confusion in my 1st answer))
You can rewrite that as 0.5-0.5*cos(20*n*s).
Therefore to get it into the normalized form of cos(n*s*tau) you need a factor f such that f*20=tau and since tau=2*pi, f=(2*pi)/20 which simplifies to f=pi/10

:man_shrugging:

1 Like

Couldn’t agree more. Btw, I also think the generator is missing an option to create circular waves. Much of the profiles we use in real life are circular in nature (with a 90 degree end/transition angle / inflection point) rather than sine/cosine (with a 45 degree end/transition angle / inflection point). No problem calculating it from a sawtooth/fraction or pingpong output, but some might find it useful to have it easily available in the generator.