1
$\begingroup$

I want to make a procedural texture for terrain, with water, sea foam, sand, moss, and rocks.

I have managed to make them all except for the water foam, which i cannot fix along the shoreline.

Basically, the sea line starts at z=0, where i want to put a few meters of foam shader and the rest will be water, but i did not yet find a way to do it.

Can somebody give some suggestions? Thanks.

where foam should be

$\endgroup$
0
$\begingroup$

It looks like you're doing something like this to generate the terrain.

enter image description here

Regardless, with whatever method you've used it should be possible to identify the handle that affects the coastline.

enter image description here

So in my case I could duplicate this Color Ramp and use the current position of that handle to mark the coast, and then create a new mask on the other side of it for a foam shader mix factor. This does have the unfortunate side-effect of catching a bunch of the terrain. I don't know if this happens with every method, but regardless we'll fix that next.

enter image description here

You've said that the water is at Z = 0, and I've made sure mine is the same. To isolate only the coast, we can take Object Coordinates and separate out the Z axis. Run this through an inverse operation and Clamp the result.

enter image description here

This has given us a mask for the islands. The jaggies are down to the level of subdivision. I was using Adaptive so I set my Dicing Scale really low to make them go away for this screenshot.

enter image description here

We can subtract this mask from our Color Ramp output, also Clamping, and get the coast, at that point we can go back to the Color Ramp and adjust the threshold to taste.

enter image description here

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.