Planetside Software Forums

General => Terragen Discussion => Topic started by: FlynnAD on June 13, 2017, 09:03:29 PM

Title: Surface Layer color function opacity
Post by: FlynnAD on June 13, 2017, 09:03:29 PM
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
Title: Re: Surface Layer color function opacity
Post by: Dune on June 14, 2017, 01: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.
Title: Re: Surface Layer color function opacity
Post by: cyphyr on June 14, 2017, 08:11:13 AM
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.
Title: Re: Surface Layer color function opacity
Post by: Oshyan on June 14, 2017, 02: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
Title: Re: Surface Layer color function opacity
Post by: FlynnAD on June 14, 2017, 04: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?
[attach=1]

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.

[attach=2]

Thanks,
Matt
Title: Re: Surface Layer color function opacity
Post by: FlynnAD on June 14, 2017, 04: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
Title: Re: Surface Layer color function opacity
Post by: Dune on June 15, 2017, 02: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.
Title: Re: Surface Layer color function opacity
Post by: Oshyan on June 15, 2017, 07: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