Planetside Software Forums

General => Terragen Discussion => Topic started by: kanis on February 19, 2015, 04:11:04 PM

Title: WorldMachine masks and maps applied to imported heightfield object only
Post by: kanis on February 19, 2015, 04:11:04 PM
Hi guys, apologies if this question has been asked beforehand, but I've been trying to wrap my head around how to accomplish this:


Now, what I want to do is import the heightfield into Terragen and apply surface shaders those additional maps to that specific terrain only, and do a distribution/coverage map for each surface shader using those additional maps (i.e. a snow surface shader with distribution using only the snow coverage map).

I've used surface shaders on a global level within Terragen 3 (like on power/alpine fractals that cover the entire world), and I've done the usual procedural maps for distribution, and the altitude/slope constraints for surface distribution. All of that is pretty familiar to me, but those distribution/constraints happen on a global level with my entire planet's terrain, and I just want to be able to localize the effects.

So basically, what I'm wondering is how can I achieve the same effect on a local level. I.e. only to apply surface shaders and distribution to the imported heightfield?

Any insight into this would be greatly appreciated! In the mean time, I'll keep on searching around to see if I can find out how to do it on my own.
Title: Re: WorldMachine masks and maps applied to imported heightfield object only
Post by: bobbystahr on February 19, 2015, 08:26:40 PM
When in the Shader Tab you create a Surface layer you should have to hand the coordinates and size of your terrain (I often make a note in the Nodes area and keep construction info there) Also whether your .ter loaded left corner or center..TG3 seems to load everything centered so your maps will likely be center position and the size of your terrain...TG3 plugs in a default size you will have to change. As long as you don't click on  the repeats it won't tile everywhere. Hope that helps.
Title: Re: WorldMachine masks and maps applied to imported heightfield object only
Post by: TheBadger on February 19, 2015, 08:32:41 PM
One easy way:

Use a Simple Shape Shader as a mask.
Make a sss and make it the size of your heightfield, then mask all PFs by that SSS.
Then You can easily make things happen only in, or out side, of the sss by inverting or not inverting the mask.
You are literally building a boarder that TG will respect.

You may also create a "Fractal heightfield" (in a way of speaking) by creating a sss of whatever size and making PFs only happen within the SSS as mentioned above. This is my preferred way of working in general now, as it helps me to not be distracted by the rest of the planet.

Title: Re: WorldMachine masks and maps applied to imported heightfield object only
Post by: bobbystahr on February 19, 2015, 08:40:14 PM
Oh yeah, what TheBadger says is important because if you don't have a mask the rest of you planet will turn black. You can invert the mask for the rest of the planet...good catch TB
Title: Re: WorldMachine masks and maps applied to imported heightfield object only
Post by: bobbystahr on February 19, 2015, 08:43:52 PM
If in the Default scene the WM .ter loads as I suspect at 0,0,0 then all that needs be done is reduce/enlarge the SS shader that is masking the Fractal Terrain to the size of the imported WM .ter.
Title: Re: WorldMachine masks and maps applied to imported heightfield object only
Post by: Oshyan on February 20, 2015, 01:01:44 AM
It seems like you guys are significantly over-complicating this.

1: Load your WM generated terrain into TG with a Heightfield Load.
2: Create one or more Surface Layers that you will use either to directly add color/texture based on your masks, or underneath which you'll have a network of Child Layers to provide color/texture, using the base Surface Layer primarily for masking.
3: Create an Image Map Shader and load one of your masks. Connect its output to the Mask input of your Surface Layer.
4: In the Heightfield Load (the actual Load node, not the Heightfield Shader it feeds into), look at the bottom of the settings panel in the Statistics section to find the size of the heightfield in Meters. Copy or make note of the size value(s).
5: In your Image Map Shader set the Size values to the same as you saw in your Heightfield Load.
6: Heightfields are Position Center by default, and at 0,0 (x,z coordinates; y is up). Image Map Shaders are Position Lower Left by default, but also at 0,0. Simply change the Image Map Shader to Position Center and now everything should line up.
7: Repeat steps 2 (or 3) through 6 for all of your masks (use copy/paste of nodes to get things setup faster since they should all be the same size and position). Then dive in and start texturing.

- Oshyan
Title: Re: WorldMachine masks and maps applied to imported heightfield object only
Post by: kanis on February 20, 2015, 02:17:27 AM
Woo! Thanks for all the replies!  I'm definitely going to try out Oshyan's steps.
Title: Re: WorldMachine masks and maps applied to imported heightfield object only
Post by: bigben on February 21, 2015, 12:19:44 AM
To Oshyan's suggestion I'd also insert a colour adjust node after EVERY mask image. Terragen does a great job at antialiasing images, but if you want a sharper edge on your mask the colour adjust node works a treat.  If you use the same values for Black and White levels you get a binary image at that grey level.  If you have a fine line for example, you can make it thinner by using values above 0.5, or wider with values below 0.5  This is indispensable with flow maps as you can layer multiple versions of the flow mask by connecting it to multiple colour adjust shaders with different black levels (and don't forget to play with the gamma to tweak the contrast).

In the image loader for the mask image I'd also set the colour to Linear.  I find that much easier to predict what the mask is doing based on what I'd set up in WM.
Title: Re: WorldMachine masks and maps applied to imported heightfield object only
Post by: bobbystahr on February 21, 2015, 10:48:09 AM
Quote from: Oshyan on February 20, 2015, 01:01:44 AM
It seems like you guys are significantly over-complicating this.

1: Load your WM generated terrain into TG with a Heightfield Load.
2: Create one or more Surface Layers that you will use either to directly add color/texture based on your masks, or underneath which you'll have a network of Child Layers to provide color/texture, using the base Surface Layer primarily for masking.
3: Create an Image Map Shader and load one of your masks. Connect its output to the Mask input of your Surface Layer.
4: In the Heightfield Load (the actual Load node, not the Heightfield Shader it feeds into), look at the bottom of the settings panel in the Statistics section to find the size of the heightfield in Meters. Copy or make note of the size value(s).
5: In your Image Map Shader set the Size values to the same as you saw in your Heightfield Load.
6: Heightfields are Position Center by default, and at 0,0 (x,z coordinates; y is up). Image Map Shaders are Position Lower Left by default, but also at 0,0. Simply change the Image Map Shader to Position Center and now everything should line up.
7: Repeat steps 2 (or 3) through 6 for all of your masks (use copy/paste of nodes to get things setup faster since they should all be the same size and position). Then dive in and start texturing.

- Oshyan

I sorta said most of that, just not in point form.
Title: Re: WorldMachine masks and maps applied to imported heightfield object only
Post by: Oshyan on February 22, 2015, 12:19:37 AM
You did Bobby, just in a sort of disjointed manner that I think might only make sense if you already know TG. ;)

- Oshyan