Localizing fake stones to hill edge

Started by Kexikus, March 21, 2018, 07:53:17 AM

Previous topic - Next topic

Kexikus

I have a terrain and I want to add fake stones. That in itself is no problem at all, but I want them to clump / be grouped in certain areas. And I don't want these areas to be random either, which is why I've no idea on how to proceed.

I want these fake stones to be localized to the edges of my hills/mountains, i.e. in places where the terrain changes from being quite steep to being almost flat. Is there any good way to do that?

luvsmuzik

The first solution that comes to my mind would be to put camera in top view and utilize the painted shader as the mask for you fake stones distribution surface layer. You could further limit altitude and slope constraints if necessary. The painted shader can be cleared or erased to further fine tune your project.  surface layer>mask by shader>create shader>color>painted shader  Click the paint brush icon in preview tool bar and begin painted shader session. Open shader control box to define brush. Select stay open while painting in case you need to change brush size or start over.

You can also place your stones by masking your surface layer with a simple shape in a localized area, but coverage is less precise in my opinion.

Kexikus

That would have been my backup solution, but I wanted a procedural version and luckily I found one.

It's not usable for most applications, but it works in my case. The reason for that is that my "cliffs" were created by masking a hill terrain with a high contrast power fractal. So I was able to use that PF and some blue nodes to get a mask that sits around the lower edges of my cliffs. Combining that with some slope constraints and another PF mask to localize the stones some more worked pretty well.

luvsmuzik

Sounds cool. I thought you were doing a general seed 119 fractal terrain with the mighty simple shape ground zero approach.. ;D ;D

WAS

Quote from: luvsmuzik on March 21, 2018, 02:03:00 PM
Sounds cool. I thought you were doing a general seed 119 fractal terrain with the mighty simple shape ground zero approach.. ;D ;D

Altitude constrains on a surface layer can also be used to make a precise mask for other sharers.

Woops wrong quote. Lol

Kexikus

For reference, here's what I did:

My terrain mask is a PF shader with colour contrast 10 and colour offset -0.5. The important part is to have "Clamp high colour" and "Clamp low colour" unchecked. I used that with a Clamp Colour node to mask my terrain and get some random cliffs. To get the edges around the lower cliffs, I added a Constant Colour of 1 to that PF and clamped the result. Then I simply substracted the clamped original PF from the clamped sum and got what I needed.

Depending on how your original PF is set up, you might have to play around with the Constant Colour value. In my case, high colour in the PF is actually black and I don't apply low colour (I have a mostly white shader as input to the PF).

It might also be possible to use this without having the high contrast PF by somehow creating the high contrast colour map from the displacement, but I don't know enough about TG to attempt that.

luvsmuzik

Quote from: Kexikus on March 21, 2018, 04:43:27 PM
For reference, here's what I did:

My terrain mask is a PF shader with colour contrast 10 and colour offset -0.5. The important part is to have "Clamp high colour" and "Clamp low colour" unchecked. I used that with a Clamp Colour node to mask my terrain and get some random cliffs. To get the edges around the lower cliffs, I added a Constant Colour of 1 to that PF and clamped the result. Then I simply substracted the clamped original PF from the clamped sum and got what I needed.

Depending on how your original PF is set up, you might have to play around with the Constant Colour value. In my case, high colour in the PF is actually black and I don't apply low colour (I have a mostly white shader as input to the PF).

It might also be possible to use this without having the high contrast PF by somehow creating the high contrast colour map from the displacement, but I don't know enough about TG to attempt that.

This is very interesting node setup. Perhaps those more expert than I, will analyze it for you. An  image of your set up would help me greatly. You could do this now or after your project is complete. If it is for monetary value or nondisclosure, of course, we all respect that you cannot do so. So far, I am able to dissect and change others set up nodes for terrain, but complex masking is beyond me presently.

Oshyan

Would a simple slope and/or height mask not work here? (using the Distribution Shader) If not there are some relatively simple node setups for creating "cavity" shaders (for terrain) here on the forums, which could apply to what you're describing, with appropriate settings.

- Oshyan

WAS

Quote from: Oshyan on March 21, 2018, 07:00:48 PM
Would a simple slope and/or height mask not work here? (using the Distribution Shader) If not there are some relatively simple node setups for creating "cavity" shaders (for terrain) here on the forums, which could apply to what you're describing, with appropriate settings.

- Oshyan

That's what I was thinking, though I always tend to just use a surface layer for some reason. Seems appropriate for a repeating surface shader. But I'm interested in these "crevices" examples, could you link any? I tried doing some searching but the keywords seemed to be used a lot for all sorts of stuff, vegetation, colours, random topics. Lol

Kexikus

Quote from: Oshyan on March 21, 2018, 07:00:48 PM
Would a simple slope and/or height mask not work here? (using the Distribution Shader) If not there are some relatively simple node setups for creating "cavity" shaders (for terrain) here on the forums, which could apply to what you're describing, with appropriate settings.

- Oshyan

The problem here is that my terrain looks something like this:

[attachimg=1]

and I want the stones where the red arrow points. Using only slope constraints would either place them higher up where the cliff gets steeper or place them both below AND above the cliff. Both of these things are not what I'm looking for. If my terrain would consist of nothing else, I could of course use altitude constraints to fix that, but these "cliffs" are quite small in my scene and placed on top of large scale hill displacement, so that the lower end of the cliff is not always at the same height. I should also note that this is for a skybox, so I have to get it right everywhere and not just where the camera is looking.

Quote from: luvsmuzik on March 21, 2018, 04:59:49 PM
This is very interesting node setup. Perhaps those more expert than I, will analyze it for you. An  image of your set up would help me greatly. You could do this now or after your project is complete. If it is for monetary value or nondisclosure, of course, we all respect that you cannot do so. So far, I am able to dissect and change others set up nodes for terrain, but complex masking is beyond me presently.

I'll post a tgd later, so you can have a look.


WAS

#11
Quote from: Kexikus on March 22, 2018, 03:51:29 AM
Quote from: Oshyan on March 21, 2018, 07:00:48 PM
Would a simple slope and/or height mask not work here? (using the Distribution Shader) If not there are some relatively simple node setups for creating "cavity" shaders (for terrain) here on the forums, which could apply to what you're describing, with appropriate settings.

- Oshyan

The problem here is that my terrain looks something like this:

[attachimg=1]

and I want the stones where the red arrow points. Using only slope constraints would either place them higher up where the cliff gets steeper or place them both below AND above the cliff. Both of these things are not what I'm looking for. If my terrain would consist of nothing else, I could of course use altitude constraints to fix that, but these "cliffs" are quite small in my scene and placed on top of large scale hill displacement, so that the lower end of the cliff is not always at the same height. I should also note that this is for a skybox, so I have to get it right everywhere and not just where the camera is looking.

Quote from: luvsmuzik on March 21, 2018, 04:59:49 PM
This is very interesting node setup. Perhaps those more expert than I, will analyze it for you. An  image of your set up would help me greatly. You could do this now or after your project is complete. If it is for monetary value or nondisclosure, of course, we all respect that you cannot do so. So far, I am able to dissect and change others set up nodes for terrain, but complex masking is beyond me presently.

I'll post a tgd later, so you can have a look.

Maybe you're having difficulties assigning altitude and fuzziness zones? From the example image, you can still get an area.

Update: I fiddled with this a bit and it seems a bit more challenging. Due to the progression of flat land compared to the hill as you can see from my attached photos. And I even used some extremes to get variation, seen in the third pic.




Kexikus

But what happens in your solution if you put another terrain beneath that? Then the base of the cliff would no longer be at the same height everywhere and the altitude constraints would no longer work, wouldn't they?

WAS

#13
Quote from: Kexikus on March 22, 2018, 06:42:11 PM
But what happens in your solution if you put another terrain beneath that? Then the base of the cliff would no longer be at the same height everywhere and the altitude constraints would no longer work, wouldn't they?

Technically in that setup altitude constraints just setup the mask, which is than applied to the surface as a mask so height is no longer a variable with the final. It's based on wherever you setup the boundaries based on height i guess. Though like I explained it has it's faults. Though having variable terrain would allow you to gradient the mask outward. This could be used in I think more limited setups, but using base shapes/masks you could setup a boundary mask which could be transformed/adjusted as needed and no longer constrained to altitude, though the initial altitude can be used with fuzziness to create variety.

Oshyan

Maybe try Intersect Underlying with Favour Depressions? Given the complexity of where you want to mask things, it may be better to do in a dedicated heightfield editor unfortunately. You could generate a mask there and import it.

- Oshyan