Heightmap Node Masking

Started by WAS, February 18, 2022, 01:44:05 AM

Previous topic - Next topic

WAS

Am I blind or is this not possible? And if not, why not? It seems really beneficial to be able to mix heightmap operators/loads with others via a image map or other shaders. 

I was thinking it would be really easy to create a snow displacement by masking the smooth operator but couldn't figure out how. Then I wanted to do a difference on the terrain disps to derive a snow texture mask. 

Yeah I am still really wanting go do smooth snowy areas that follow the terrain.

Dune

You can merge 2 lines, one with smoothed terrain for snow, and derive masks from that, perhaps thru displ to scalar.

WAS

I don't think understand what you mean?

WAS

#3
I was smoking a cigarette (terribly bad habit, quit if you can!), and it occurred to me. The heightmap node (not the operators) replaces the terrain in it's area with whatever it's generating. This actually means if you mask it with the same relative terrain, it will form a complete terrain. This means you can use the heightmap generate to smooth areas where your snow is! It's actually very straight forward and I tested it with roughing up the original terrain before going into the heightmap to make sure it was doing what I wanted.

The resolution in this test for the heightmap is 20000x20000 at 2000x2000 points, which is too low as you can tell by the pixelated designs. It does unfortunately take a LOT longer to generate the terrain if you're applying secondary PF displacement to a Classic Erosion terrain, however is fairly quick on the Classic Terrain Heightmap itself, which is to be expected.

The benefit of this method is the heightmap doesn't actually alter the computed terrain, so the same distribution shader doing the masking, can also mask the snow texture accurately. The snow surface layer has smoothing on, as in the fuzzy zones of the heightmap, the original add-on PF details will show through, and the fuzzy of the surface layer with smoothing can help a bit. You could even adjust the distribution going into the surface layer.

Update: Turns out it's not as straight forward as I thought. In order for this to work the original terrain also needs to be a heightmap. For some reason if the underlying terrain is just a PF mountain (like the default scene), the masking doesn't work, or it doesn't smooth correctly, something. But if you also run the base terrain through a heightmap generate it works. I don't know what that's about. Probably why it worked first time around on a eroded terrain cause it is a heightmap.

Dune

That seems to work nicely.

In retrospect, I don't know if merging works with heightfields, I was actually talking about 'normal' terrain processing.

WAS

I can't edit the original post anymore, but to answer my original question. You sure can mask heightfields, but just not like I thought.

There is conveniently, the Heightfield Mask input, no the Shader Input. What this means, is you do all your heightfield operators on each part you want to merge separately. Then you use the "Shade by Height" method and use the Merge Shader to merge it up. This will create a raw heightmap that you can plug into a Displacement shader. Little tricky, but that's what I came up with to answer this question and not leave it hanging.

Dune

I've never found much use in using heightfields actually. I don't really understand the benefit, as opposed to a global procedural terrain.

WAS

Well, there is an example right here, snow. And additionally it's leagues faster than rendering procedural terrain.

Dune

I still don't see it, as you can do snow globally too. Didn't know about speed, though. If that's true, it would be interesting to convert small pieces of frontal terrain with fine displacement and reflections (slow in PT) to heightfield before rendering. Instead of converting to obj, I mean.

WAS

#9
Yeah it is faster. And global snow from a distance, maybe, but convincing snow buildup and snow matching underlying terrain without weird cutoff and stuff is not very achievable. I don't even see it in your tests, which lead me here.

PS it's faster because it's rasterized. There is no computing displacement from noise, it's 2D map only displaced however it's set. So similar to how a image texture will be leagues faster than procedural.

Dune

Okay, thanks, I'll do some testing soon.

pixelpusher636

This sounds awesome and the preview render looked incredible but too hard to follow for a newb. You should start a tutorial series on YouTube. Might rack up some ad$ from it as well for an added bonus of sharing your knowledge with the world.  :)
The more I use Terragen, the more I realize the world is not so small.

WAS

Quote from: pixelpusher636 on May 14, 2022, 07:18:13 PMThis sounds awesome and the preview render looked incredible but too hard to follow for a newb. You should start a tutorial series on YouTube. Might rack up some ad$ from it as well for an added bonus of sharing your knowledge with the world.  :)
Who? Me? I did do a couple videos in my last PC. My newer PC is using a TrueColor monitor that doesn't like lower resolutions, so recording was hard when the video is excessively large resolution wise and thus on anything other than max HD streaming quality nothing will be legible. That and I really feel awkward doing recordings of myself.  :o

Search "Terragen Quickies" on YouTube (Got off my butt and grabbed a link: https://youtube.com/channel/UCYUVir16jJq9ii9sM3trOpg)

 PS The first video rendered with like triple frame for each frame so it's slooow. I think I didn't save the video file for that one and couldn't rerender the composition.

pixelpusher636

Well I'll be damned! You do have some tuts up on YouTube. I have another tutorial source for knowledge now. Granted I don't spend a lot of time on YouTube but I would have thought I would have had one of your videos suggested at some point. Thanks for the link WAS!
The more I use Terragen, the more I realize the world is not so small.