Author Topic: Surface Layer color function opacity  (Read 345 times)

Offline FlynnAD

  • Member
  • *
  • Posts: 71
Surface Layer color function opacity
« on: June 14, 2017, 01:03:29 AM »
Hi all,

It's been a long time since I used TG and this forum, so pardon me if these questions are a bit basic.

Regarding the Surface Layer node: the Color Function does not seem to import any opacity from its input node. If you have a PF with only a checked Apply High Color plugged into the Surface Layer's Color Function, the Surface Layer node will convert any "holes" in the PF to a black color, rather than leaving the holes as clear/transparent and allowing the base color of the Surface Layer's Input Node to show through.

Do you have to plug your base layer into both the Surface Layer's Input Node and into the PF's Input Node in order to force the PF to be opaque 100%?

Plugging the semi-transparent PF into both the Surface Layer's Color Function and the Mask Shader will not quite give the result I want, as the PF's color will convert to a grayscale in the Mask Shader and not be fully white/black as I want.

Thanks,
Matt

Offline Dune

  • Member
  • *
  • Posts: 12545
  • Corkscrew Bird
    • www.ulco-art.nl
Re: Surface Layer color function opacity
« Reply #1 on: June 14, 2017, 05:58:34 AM »
It does seem to work that way. TG is not always clear, but it gives you endless possibilities to link nodes and find the results you need. For a hard mask input you could take the pf through a color adjust and harden the contrast.
In case you still haven't seen enough of my work: www.ulco-art.nl

Offline cyphyr

  • Member
  • *
  • Posts: 3528
    • richardfraser
Re: Surface Layer color function opacity
« Reply #2 on: June 14, 2017, 12:11:13 PM »
Try plugging your pf into s child input on the surface layer. This will allow an unchecked low colour to show as transparent.
You will have to disable (of modify to taste) displacement as this will also come through the child lmput.
www.richardfraser.co.uk
/|\

i7 5930 @3.5Ghz, 32Gb
i7 2600k @3.4Ghz, 16Gb
i7 980 @3.33Ghz, 16Gb

Offline Oshyan

  • Planetside Staff
  • *
  • Posts: 11629
  • Holy snagging ducks!
Re: Surface Layer color function opacity
« Reply #3 on: June 14, 2017, 06:46:33 PM »
My understanding is the Colour inputs on nodes do not accept "alpha"/mask information, only color. If no data is present it will show as black. The main Inputs of most nodes just accept all data, displacement and color included.

Masking is done through the Mask input, but I understand in your case it doesn't do exactly what you want. You can always copy a node and adjust it to get the right effect when used for a different purpose (i.e. same noise characteristics, but different color output or contrast for better use as a mask).

- Oshyan

Offline FlynnAD

  • Member
  • *
  • Posts: 71
Re: Surface Layer color function opacity
« Reply #4 on: June 14, 2017, 08:17:45 PM »
Thanks guys. Ultimately, putting the PF into the Surface Layer's child input did what I wanted.

1) However, more testing brought up another issue, related to Oshyan's comment.

If a PF has Apply High Color only, and takes it's Low color from its input, when that PF is placed into a Surface Layer's Color Function, the color that shows up is related to the type of node of the PF's input. If you put a second PF as the input, color shows up fine. If the second input is a Constant Shader color, for some reason it won't. Why not?

See screenshot. "PF purple tester" A is identical to B when their own preview windows are opened. When slotted into a Surface Layer's Child Input, they are still identical (Surface Layer B, C, and D are all the same). Yet Surface Layer A shows black where the others show orange. (Gray shows up nowhere, as it is fully replaced in all the surface layers).

Why does the Constant Shader not pass through?
73975-0

2) Per Oshyan's comment on copying the node, adjusting its color to white/black to get a real "opacity" mask out of the PF: What I was hoping to do is NOT to copy the PF node but create a series of nodes downstream to create/modify into the opacity mask so that if I go back to the original PF and change its scale, features, contrast, roughness, etc, I do not have to remember to do that for the copied node as well. That's prone to user error/forgetfulness.

I tried converting a PF color to grayscale, then tried Abs Color, Clamping Color, Color to Vector, Normalizing Vector, Vector to Color, even a Ceiling Scalar and Floor Scalar (those two got close but not quite). Is there a way to take a PF's color range, make it grayscale, say 65-190 (no absolute blacks or whites), then take the highest number and scale the entire 0-190 (black to highest color) into a 0-255 scale (full gradient from black to white)? That would be what I want and it would work automatically for any color. This would create an accurate opacity mask.

73977-1

Thanks,
Matt
« Last Edit: June 14, 2017, 08:26:18 PM by FlynnAD »

Offline FlynnAD

  • Member
  • *
  • Posts: 71
Re: Surface Layer color function opacity
« Reply #5 on: June 14, 2017, 08:27:22 PM »
Ignore my last question 1. Oshyan answered it here: http://www.planetside.co.uk/forums/index.php/topic,23256.msg235541.html#msg235541

Constant Color is not the same thing as Constant Shader, which was causing the issue.

Question 2 is still up though.

Matt

Offline Dune

  • Member
  • *
  • Posts: 12545
  • Corkscrew Bird
    • www.ulco-art.nl
Re: Surface Layer color function opacity
« Reply #6 on: June 15, 2017, 06:08:05 AM »
I sometimes need a 'copy' of a line of nodes (and indeed don't want to remember changing all twice) , but then find some sort of way to make it a separate line and add a (blue) node at the end to use that line in two inputs. Like multiply color or add color or subtract color, or mix scalar, or take as child through empty surface shader, anything that works.
In case you still haven't seen enough of my work: www.ulco-art.nl

Offline Oshyan

  • Planetside Staff
  • *
  • Posts: 11629
  • Holy snagging ducks!
Re: Surface Layer color function opacity
« Reply #7 on: June 15, 2017, 11:41:16 PM »
You won't be able to remap the values because Terragen doesn't know what the min and max will/can be, and the functions work on a per-point (current sample) basis. There is no holistic scene understanding in the way most of them function. I don't think there is a perfect solution as you envision it, but one possible approach that might work would be to use the displacement channel, and output with a displacement amplitude of 1 (or whatever works consistently for a particular set of parameters), and convert that to a scalar to use for masking. Does that make sense?

- Oshyan