Planetside Software Forums

General => Terragen Discussion => Topic started by: Harvey Birdman on October 18, 2007, 11:28:59 AM

Title: Flatten a bit of terrain
Post by: Harvey Birdman on October 18, 2007, 11:28:59 AM
Hey, all -

Here's a problem that bedevils me (and probably others) every time I create a scene - how do you flatten a bit of terrain where you want to place a building? Image map filtering of the heightfield works well if you want to flatten a large area, but what about just the immediate surroundings of a single building? I've looked at Terrapainter, but without a means of translating pixel coordinates used by Terrapainter to X/Z coordinates used in TG2, it was impossible to find a particular location in Terrapainter.

So what do you do when composing a scene in which you want varied terrain, but you also want a flat spot at a particular place?
Title: Re: Flatten a bit of terrain
Post by: Oshyan on October 18, 2007, 01:20:57 PM
I would think you could use some function magic and create a flat area. You could also use an image-based mask and, as long as it was the right shape and orientation, just use scale controls to adjust its size. You would use it as a blend between a constant height of your choosing and the terrain you're trying to "flatten", so rather than actually flattening the terrain you're basically replacing it in that area with another terrain. Easier methods of locally editing terrain will be added in the future.

- Oshyan
Title: Re: Flatten a bit of terrain
Post by: Harvey Birdman on October 18, 2007, 01:27:24 PM
I'm actually experimenting with both these methods. I can successfully block the heightfield out of a specific region using either method, but how do I substitute my 'flat' terrain value? Where I block the heightfield, a crater of sorts appears, right? How do I prevent that from happening? I tried applying the inverted mask to a displacement shader, but you get, at best, really ragged edges around the masked region, and I couldn't really get the desired affect.
Title: Re: Flatten a bit of terrain
Post by: Oshyan on October 18, 2007, 01:34:03 PM
I would use a Merge shader...

- Oshyan
Title: Re: Flatten a bit of terrain
Post by: Harvey Birdman on October 18, 2007, 02:20:25 PM
Got it.

;D
Title: Re: Flatten a bit of terrain
Post by: bigben on October 19, 2007, 12:55:52 AM
Or have a look at my tiled terrains setup.... It's basically the same thing.  Carve out a big hole in a terrain and fill it with another one. Attached the clip I use as a blending shader on a terrain. Use it on both, and invert it on the non-flattened terrain...
Title: Re: Flatten a bit of terrain
Post by: Harvey Birdman on October 19, 2007, 03:28:14 AM
Thanks, Ben. I'll check this out a little later today. I'll post the solution I put together later, too.

:)
Title: Re: Flatten a bit of terrain
Post by: Harvey Birdman on October 20, 2007, 09:41:40 PM
Hey, Ben -

Do you have a non-compacted version? I'm a little uncomfortable trying to expand the compacted version - I'm afraid I might disconnect something in the process.

Nice purple group color, by the way.

;D
Title: Re: Flatten a bit of terrain
Post by: bigben on October 21, 2007, 08:53:48 AM
Of course....  ;)
Title: Re: Flatten a bit of terrain
Post by: Harvey Birdman on October 21, 2007, 10:03:02 AM
You da man.

;D
Title: Re: Flatten a bit of terrain
Post by: dhavalmistry on October 23, 2007, 01:02:35 PM
Quote from: bigben on October 19, 2007, 12:55:52 AM
Or have a look at my tiled terrains setup.... It's basically the same thing.  Carve out a big hole in a terrain and fill it with another one. Attached the clip I use as a blending shader on a terrain. Use it on both, and invert it on the non-flattened terrain...

you call that blending mask??? :o :o :o :o :o
Title: Re: Flatten a bit of terrain
Post by: Harvey Birdman on October 23, 2007, 02:14:26 PM
D - as long as it works; that's my primary criteria.

:)

I'm posting the little solution I came up with in the File Sharing area. It's nowhere near as sophisticated - it doesn't actually merge terrains, just allows you to merge a flat spot at a desired location, but it's not as scary, either.

;)   ;D
Title: Re: Flatten a bit of terrain
Post by: dhavalmistry on October 23, 2007, 02:21:16 PM
ohh...thanx.....exactly what I was looking for...do it fast...

hurry!!!!!!!  :D ;D
Title: Re: Flatten a bit of terrain
Post by: bigben on October 23, 2007, 10:56:28 PM
Quote from: dhavalmistry on October 23, 2007, 01:02:35 PM

you call that blending mask??? :o :o :o :o :o

That's why HB asked for the network version  ;) ....  It's really quite simple... crude even, but quite effective for terrains. This is the square version. The rectangular version has a few extra nodes but is structurally the same.
Title: Re: Flatten a bit of terrain
Post by: Alfamike on November 03, 2007, 09:06:26 AM
Hello,

I might be thinking over simplistic here, but anybody got any ideas why screen shot beneath does not work?

The Distribution shader selects by minimum altitude.
Fractal shader 1-1 is a duplicate of Fractal shader 1, with the only difference that it is blending by shader.

The result here is, well, nada, zip, as if the blending input is not used.

I looked at the previous examples in this thread but I'd like to do this without loading masking images, just by a constraining shader output.

Thanks, been struggling with this for a while now.

AM.
Title: Re: Flatten a bit of terrain
Post by: bigben on November 03, 2007, 10:57:26 AM
For the distribution node to work before the Compute terrain node you need to pass it through the apporpiate calculation node: Compute normals for slope restrictions or Tex coords from XYZ for altitude restrictions (or Compute terrain if you're restricting by slope and altitude)

The Tex coords node doesn't add as much to the render time as a Compute terrain
Title: Re: Flatten a bit of terrain
Post by: Alfamike on November 03, 2007, 12:24:58 PM
Hello and thanks,

I both plugged a Compute terrain and a Tex from coords (1 by 1) between Fractal terrain-1 and the Distributor, but neither seemed to work. Is there anything else I have to do to the Distribution output to succesfully use it as a mask for the second fractal terrain1-1? Soldiering on.....

Cheers.

EDIT:

Plugging a distance shader into the blender of the Fractal terrain masks it ok, now for the distribution.....
Title: Re: Flatten a bit of terrain
Post by: bigben on November 03, 2007, 07:39:09 PM
Had a closer look. Swap the 2 fractals around.
Title: Re: Flatten a bit of terrain
Post by: Alfamike on November 04, 2007, 06:12:18 AM
Thanks,

I can see something happening now at the altitude cut-off.

I rotated the distribution shader preview and found out that its output is not a mask the way I was expecting. I expected a mask containing just boolean below (0) and above (1) information, but there is also height info still there, which I want to take out, so that the second fractal only generates terrain where I set it using the distribution.

AM.
Title: Re: Flatten a bit of terrain
Post by: Oshyan on November 04, 2007, 02:41:32 PM
You may need to reduce the "Fuzzy Zone" values and/or "Fuzzy zone softness". If you want strictly binary/black-and-white (no intermediate values), these should all be 0.

- Oshyan
Title: Re: Flatten a bit of terrain
Post by: bigben on November 04, 2007, 02:43:28 PM
Since it's only a fractal you could also use a colour adjust shader to create the mask which cuts it down to a single node. Just use identical values for the black and white levels to create a black or white mask.

As for the distribution shader... the default fuzzy zone is 200m. Set it to 0 if you want a sharp cutoff.
Title: Re: Flatten a bit of terrain
Post by: Alfamike on November 05, 2007, 05:21:35 AM
Thanks Oshyan and bigben, looking into this now.

AM.

OK. Looked out your suggestions. Fuzzy settings were all 0. Could not get the Colour adjust shader to do the trick.

I have attached a TGD where I have used a Negate colour function with some results. The only problem here is the up-step to the flattened area. Tried to remove this step with various colour functions to no avail. Keeping at it, has got to be possible to do this in a fairly simple manner.

Hope anyone's got some more suggestions.

Once this is sorted I'll post a link to this thread on the Terranuts site. Like the starter of the thread mentioned, more people would probably like to see this work.

Thanks in advance.

AM.