Author Topic: Trouble With PNG Masks  (Read 556 times)

0 Members and 1 Guest are viewing this topic.

kris392001

  • Community Member
  • **
  • Posts: 10
    • View Profile
Trouble With PNG Masks
« on: August 29, 2018, 07:13:10 AM »
Hi All,

New user of World Machine here. I have a raw file height map and I want to apply terracing to a specific part for which I have a bitmap mask (saved as PNG - one with Alpha, one without). I bring in the mask through a file input node, set the size, tick interpret as RGB. On the node I set the display hint to Mask. All I have is 2 File inputs, an erosion generator, and a file output. I can see the mask (white for the area I want to terrace), it is in the right position. I plug the file input heightmap node into the erosion mask node, and generate. but the erosion is applied to the whole image.

I feel the steps I have taken are pretty logical, I followed the tutorial although that didn't deal with bitmap masks.


Can anyone tell me what I'm doing wrong?

Cheers

Chris

WFab

  • World Machine Guru
  • ****
  • Posts: 422
    • View Profile
    • Blog
Re: Trouble With PNG Masks
« Reply #1 on: August 31, 2018, 11:58:03 AM »
Uncheck "interpret as rgb", and use the height information as-is. Also, try inverting the mask if uncheck alone doesn't work as expected.

kris392001

  • Community Member
  • **
  • Posts: 10
    • View Profile
Re: Trouble With PNG Masks
« Reply #2 on: September 01, 2018, 02:42:30 AM »
Thank you Pratyaksh, that worked. I'm very happy - had to uncheck AND invert. The area in the forground of the image has terraces, the background not, though this is not the final configuration of the terraces, it proves the principle. It means I can now detail various parts of the height map  per their biome.

The only issue is some guttering at the edge of the mask. It has a hard edge and I'm going to assume I can solve this with a feathered gradient.

Edit: Actually, a gradient didn't help. It obviously takes the edge to be 0, is there any way to only allow modification only to the height range within the mask? A clamp or some such?

Cheers

Chris



« Last Edit: September 01, 2018, 04:36:28 AM by kris392001 »

kris392001

  • Community Member
  • **
  • Posts: 10
    • View Profile
Re: Trouble With PNG Masks
« Reply #3 on: September 01, 2018, 05:33:34 AM »
Just another note - PNG masks cannot be black and white, this applies a mask to the whole image. They need to black through to transparent then they work but they seem to 0 out producing gutters around the mask, certainly when creating terraces (see image).

I'm going to try other formats. Any recommendations for the best mask format would be welcome.

WFab

  • World Machine Guru
  • ****
  • Posts: 422
    • View Profile
    • Blog
Re: Trouble With PNG Masks
« Reply #4 on: September 01, 2018, 10:46:27 AM »
In world machine, all height data, including masks, need to be black and white. RGB is for color data.

Now if I understand correctly, you are using a png alpha channel as mask. That may work with a channel splitter, but better way would be to use a simple grayscale image, preferably with floating point precision (16bits per pixel float values, tiff or png).

You need to input this mask using simple file input, and just set the scale, leaving everything as-is. The gray parts at the edges may cause some problem with terrace or erosion device, but I'm not sure about that one. I'll test on my end and report later.

kris392001

  • Community Member
  • **
  • Posts: 10
    • View Profile
Re: Trouble With PNG Masks
« Reply #5 on: September 02, 2018, 04:47:50 AM »
Hi Pratyakash, thanks for having a look for me.

You make it sound so easy, and it should be, but the only mask format I can get to work so far is a greyscale (8 or 16 bit) PNG  with a transparent background (see image 1) But it produces the gutter. With RGB Alpha, World Machine crashes, with white in place of transparent, it just masks the whole area.

I have tried with greyscale 8 and 16bit raw (see image 2) and that just has no effect. Moving on to other formats to try.

Edit: TIFF and Targa don't work.

This is getting somewhat frustrating.

Chris
« Last Edit: September 02, 2018, 04:58:48 AM by kris392001 »

WFab

  • World Machine Guru
  • ****
  • Posts: 422
    • View Profile
    • Blog
Re: Trouble With PNG Masks
« Reply #6 on: September 02, 2018, 01:38:30 PM »
Okay, so the terrain drop and guttering both may be unrelated to the mask. What terrace device does, is apply a filter shaped like steps to the terrain. Sometimes a peak may be cut off, sometimes terrain may be lowered in places. Since the area is being masked, the area outside the mask isn't being lowered, causing a sharp drop and raise. I think that's what you mean by "guttering".

Also, the best practice is to have a mask with all opaque alpha. Or no alpha channel altogether. Wm works off brightness values of the image, transparency may interfere with that. I still haven't yet checked on my end what transparency does in a mask, just speculating at this point. I always delete alpha channel if I don't need one, so I haven't yet encountered any problem with that.

kris392001

  • Community Member
  • **
  • Posts: 10
    • View Profile
Re: Trouble With PNG Masks
« Reply #7 on: September 03, 2018, 01:59:57 AM »
Thank you again for your reply Pratyaksh.

With the terrain drop and guttering I am assuming it's not correct because the demo video www.youtube.com/watch?v=xG1gVlbLK8Q performs as I would expect. I understand this is a shape mask but still, I don't see why a bitmap mask should perform differently.

And with the masks, I don't use alpha channels. Raw, tiff, tga and PNG greyscale 16 and 8bit do not work. And I've had no response to a support ticket I left 4 days ago.

Chris

WFab

  • World Machine Guru
  • ****
  • Posts: 422
    • View Profile
    • Blog
Re: Trouble With PNG Masks
« Reply #8 on: September 05, 2018, 07:28:04 AM »
@kris392001: Could you send me the files? The main tmd file, and all input files (heightmap, masks).  I can test it all on my end to see what's wrong, maybe figure out a workaround if necessary.

kris392001

  • Community Member
  • **
  • Posts: 10
    • View Profile
Re: Trouble With PNG Masks
« Reply #9 on: September 09, 2018, 03:29:42 AM »
Thanks for the offer, Pratyaksh, I appreciate it. Stephen got back to me and the answer turned out to be embarrassingly simple. I had assumed the the Mask Extents output should be used but it turned out I needed to use the Heightfield output on the File Input node.

WFab

  • World Machine Guru
  • ****
  • Posts: 422
    • View Profile
    • Blog
Re: Trouble With PNG Masks
« Reply #10 on: September 09, 2018, 07:32:48 AM »
Alright then! Have fun with your world, and do share a screen or two when it's done!