Merging heightfields to create a level surface

Started by sboerner, April 02, 2016, 05:51:50 PM

Previous topic - Next topic

sboerner

I'm fairly new to Terragen and still trying to get my head around all the nodes and how they interact.

Is it possible to create a small, *level* area on a heightfield? My heightfield is based on a DEM, and I'm using a bitmap to create the shape for the level area. The bitmap is projected with an image shader onto the heightfield.

The result I want is a flat, level space for buildings and other structures. In effect, I'm trying to use a projected bitmap to stamp a flat space in the DEM.

I've tried several combinations of heightfield, merge, and image shaders and the best I can do is create a depression that follows the contours of the DEM. I'm sure this is a straightforward problem with a simple solution but I'm stumped.

Schematic of what I need and a rendering what I'm getting attached. Any suggestions would be much appreciated. Thanks!

SB


bobbystahr

Quote from: sboerner on April 02, 2016, 05:51:50 PM
I'm fairly new to Terragen and still trying to get my head around all the nodes and how they interact.

Is it possible to create a small, *level* area on a heightfield? My heightfield is based on a DEM, and I'm using a bitmap to create the shape for the level area. The bitmap is projected with an image shader onto the heightfield.

The result I want is a flat, level space for buildings and other structures. In effect, I'm trying to use a projected bitmap to stamp a flat space in the DEM.

I've tried several combinations of heightfield, merge, and image shaders and the best I can do is create a depression that follows the contours of the DEM. I'm sure this is a straightforward problem with a simple solution but I'm stumped.

Schematic of what I need and a rendering what I'm getting attached. Any suggestions would be much appreciated. Thanks!

SB



check this thread

http://www.planetside.co.uk/forums/index.php/topic,3830.msg39741.html#msg39741
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

Dune

If it's only one area, you can map it, import it through image map shader (or use some simple shapes), get the location right, and add it as a mask to a surface shader after the terrain. Invert the mask, set smoothing to enabled and the area will drop down to zero. Use the offset of the displacement tab of the surface shader to raise or lower it to the right level.
And you can do that for several areas of course, on different heights, with more surface shaders in line.

bobbystahr

Heh heh, that too...I knew you'd pop in with a less confusing explanation than I'd have written. I just searched terrain flatten and recalled using the Richard Solution with success.
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

Dune

Yeah, Richard's solution won't be adequate here  ;)

sboerner

Brilliant, thank you. It worked exactly as you said:

[attach=2]

In the meantime I had come up with a more complicated solution that involves dividing the output from the heightfield into two branches. One branch displaces the surface and the second is piped through a heightfield clip node to define the floor of the excavation. Each branch can have different amounts of fractal detail applied:

[attach=1]

Your solution is more elegant and natural looking, perhaps best for earthworks. Mine might work for artificial structures like concrete walls and floors.

I've been building shading networks for years in programs like Maya, but Terragen's approach is fundamentally different. Can't quite visualize how the data flows yet. Getting there, and I appreciate your help.

Bobby, thanks for the link. Not quite what I need at the moment but a cool idea that I'll file for future reference.

SB

bobbystahr

Nicely solved twixt the 2 of you...would you consider posting a .tgd or .tgc of your technique? sounds like something to learn there as well.
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

sboerner

Well, it looks like I spoke too soon. Appearances can be deceiving . . . after placing the structures I found that the floor of the displacement varies a few meters from side to side. It's still following the general profile of the DEM.

The floor needs to be perfectly level. Apparently I'm doing something wrong or this isn't possible with a single surface. Need to get moving on this project so for now I'm using a disk placed slightly above the floor of the displacement.

SB

Matt

Try using another heightfield shader. The default mode for heightfield shaders is to replace heights rather than offset them, so it's really easy to flatten an area by applying a heightfield that is flat. You can mask the heightfield shader using another shader (e.g. your projected bitmap), and you can control the height with a Heightfield Adjust Vertical node.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

sboerner

Matt, thanks for the suggestion. It's similar to the setup I was using, but I used a heightfield clip node instead of a separate heightfield and adjust node. Both setups worked fine when I tested them in empty documents, then didn't work in the actual scene.

I think I see what's happening – the setups work fine at the origin but not so well at a distance.

The planet in the working scene is rotated so the apex is at the center of the DEM. But it's a large DEM, and the rendered location is about 32 km from the apex. It's also at a very high altitude, over 4,000 meters.

Here is a flat heightfield 1 km on each side, positioned 32 km from the apex and raised to 4,000 meters with a heightfield adjust node:

[attach=1]

When the mask is applied the heightfield sometimes disappears from the rendered view entirely:

[attach=2]

At the scene origin the same masked heightfield renders OK:

[attach=3]

Could the distance from the origin cause this? I can send a TGD file if that would help.

SB

Matt

Those rendering problems are due to the extreme displacement in that test, but once you have your real scene set up it should render OK.

To address the planet curvature issue, the "flatten surface first" option in the heightfield shader has a few different options, and the one you want is called "to Y = 0". As in this screenshot:

[attach=1]

Matt
Just because milk is white doesn't mean that clouds are made of milk.

sboerner

OK, good to know, thank you. I'll be sure to use your recommended setting.

The location is Puebla, Mexico and the DEM is from the USGS Earth Explorer (GMTED2010 series). The scene will be used for a magazine infographic about the HAWC gamma ray observatory near Pico de Orizaba, the tallest volcano in Mexico. It's a perfect project for Terragen. If it works out at all I will post images later.

Thanks again to all for your help.

SB

bobbystahr

Quote from: sboerner on April 06, 2016, 11:25:42 AM
OK, good to know, thank you. I'll be sure to use your recommended setting.

The location is Puebla, Mexico and the DEM is from the USGS Earth Explorer (GMTED2010 series). The scene will be used for a magazine infographic about the HAWC gamma ray observatory near Pico de Orizaba, the tallest volcano in Mexico. It's a perfect project for Terragen. If it works out at all I will post images later.

Thanks again to all for your help.

SB


Please do, always good to see TG being used in the real world...good luck with the project.
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

sboerner

OK, I think I've stumbled upon a solution. I've been using the wrong approach all along. It's just a simple math problem. Subtract the current altitude from the desired altitude of the displacement, and use that as the displacement value. Pipe it into a surface layer shader as a displacement function, then use another surface layer to combine that with the main heightfield:

[attach=1]

Here is the result using a generated heightfield and a simple shape shader as a mask:

[attach=2]

And here it is applied to the heightfield loader in my project:

[attach=3]

For some reason there's a discrepancy between the specified and actual heights of the displacement floor, but it's easy to take into account. And the result appears to be flat and level. Whew.

[attachurl=4]

SB

bobbystahr

Brilliant, been trying to achieve that since for ever...well done and nice to have another Blue Node wizard in the forum...
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist