Planetside Software Forums

General => Terragen Discussion => Topic started by: Roberts on February 01, 2025, 03:19:45 PM

Title: Making the modulo more random within a range?
Post by: Roberts on February 01, 2025, 03:19:45 PM
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
Title: Re: Making the modulo more random within a range?
Post by: Dune on February 02, 2025, 02:47:07 AM
I would do something like this.
Title: Re: Making the modulo more random within a range?
Post by: Roberts on February 03, 2025, 01:52:53 AM
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
Title: Re: Making the modulo more random within a range?
Post by: Dune on February 03, 2025, 02:26:19 AM
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?
Title: Re: Making the modulo more random within a range?
Post by: Roberts on February 03, 2025, 10:20:25 AM
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.
Title: Re: Making the modulo more random within a range?
Post by: Dune on February 03, 2025, 11:20:06 AM
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.
Title: Re: Making the modulo more random within a range?
Post by: Roberts on February 06, 2025, 06:39:49 AM
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?
Title: Re: Making the modulo more random within a range?
Post by: Dune on February 07, 2025, 02:07:22 AM
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.