Making the modulo more random within a range?

Started by Roberts, February 01, 2025, 03:19:45 PM

Previous topic - Next topic

Roberts

Hi!

Attached is a picture of a simple modulo which repats every 10 meter. Is it possible to make it repeat not so evenly?

What I would like is to make it repeat within an interval or range, say 8-12 meters. So sometimes it repeats after 8 meters, sometimes after 10, sometimes after 9 and so on.
To be clear, I don´t mean to warp it or distort it. I just want to control the repetition within an interval.

I hope you get the idea:-)

Any ideas?

Cheers
Robert

Dune

I would do something like this.

Roberts

Thank you Dune!

I´m trying it out, it definitely works and is close to what I was aiming for. So the high and low colours basically defines the interval in meters and the stretching of the PF limits the shifting to one axis?

Thank you so much again, very useful and I learnt something:-)

Roberts

Dune

Yes, but probably you won't even need the stretching, as the X to scalar and modula will likely make it into bands anyway. What do you need it for? Can you show?

Roberts

#4
Oh, just the usual. Trying to make rectangular rocky terrain:-)

My idea is to make something like the very sketchy picture attached. An irregular grid where the rectangles are of different sizes and shifted in relation to each other (picture shows them shifting up/down but they could be shifting in other directions as well)

Sorry for the crappy drawing, I'm drawing on my mobile... I can post something rendered in TG later.

Dune

I think, but am not sure, that the edges of this modulo method will be pretty hard, perhaps too hard. You may be better off painting a displacement map in photoshop, or a few to mix. Or use a sinus function, like attached.

But I'd be keen to see what you come up with.

Roberts

#6
Yes, it becomes very hard indeed. But it can be softened and broken up. In this example rendering it is very hard and regular, like manmade objects. Using the linear step (instead of smooth step) make the individual outcrops get a beveled look of course, which is not very natural. And my workspace is a tangled mess as usual:-)

But I wonder if there is some aternative method to the PF-method you proposed? It would be practical if I could define an interval using blue nodes perhaps?

Dune

It's getting somewhere. You could try multiplying by a perlin 3D, and in another line change the block size (transform shader) and multiply that by the inverted Perlin 3D, then combine again (mix shader). Or use a mix shader and have a PF (or perlin 3D) as mix controller, either stretched or not.
Perhaps multiplying by a larger sinus will also break the regularity. And you could combine with a fake stone shader for more variation. Or warp on a smaller scale.