Author Topic: Masking heightfields with image map. How to?  (Read 40 times)

Offline cluelessness

  • Member
  • *
  • Posts: 2
Masking heightfields with image map. How to?
« on: Today at 06:24:51 PM »

after years I got my hands on Terragen again and now I am stuck on a problem.

I created a word in WorldMachine and loaded it in Terragen as a heightmap. This works like a charm.

Now I want to substract certain areas of the heightfield with an TIFF image map but cant figure out how to do that. (World Machine was new to me and loading the subtracting shape from a vector file caused inaccurate and very strange results)

Here is my world created from the WM heightfield: (Heightfield load 01)

If I load an image map shader and attach it to the shader mask input node of my world heightmap, the whole heightfield disappears and only the image map is rendered.
See image

What I want is this:
But this way I cant resize the dimensions of the image map in Terragen and it becomes way too large (image loaded as heightfield map and attached to the heightfield map 01 -> mask by heightfield input node)
I cant figure out how to control the size of the image map without removing my original heightfield completely.

Thanks very much for any help!
« Last Edit: Today at 06:41:41 PM by cluelessness »

Online WASasquatch

  • Member
  • *
  • Posts: 3428
Re: Masking heightfields with image map. How to?
« Reply #1 on: Today at 06:59:17 PM »
You can see, that the "image loaded" as the heightmap, is actually a mask of your heightfield, only displayed within the whites of your image map. You likely don't have a correct size of your image map, may need to repeat, or smooth the masking image.

Offline cluelessness

  • Member
  • *
  • Posts: 2
Re: Masking heightfields with image map. How to?
« Reply #2 on: Today at 07:12:21 PM »
Hi WAS, thanks for your reply.

I am aware that the masking heightfield does not fit the exact size of my world heightfield.
Is it really only possible to achieve what I want by "baking the position and size" directly into the masking heightfield?

What if I want to change sizes and orientations of my substracting shape later in the process?

Online Oshyan

  • Planetside Staff
  • *
  • Posts: 13187
  • Holy snagging ducks!
Re: Masking heightfields with image map. How to?
« Reply #3 on: Today at 08:16:06 PM »
Using an Image Map Shader is going to be the most flexible. You can reposition and resize the mask in the Image Map Shader. But be sure "Fit mask to this" is *disabled*.

What's happening in your first image, as far as I can tell, is your mask is working, the portion of the heightfield that corresponds to your mask's lighter areas is being displayed. Everything outside of that is black (including the area outside the coverage of the image map) so is masked out and just becomes whatever the terrain shape was prior to loading your heightfield. If you don't want that to happen consider using an inverted mask (invert your masking image and use Invert Mask in the Heightfield Shader node).

If you want more sophisticated controls for all of this you may want to consider using a Merge shader instead.

- Oshyan