Distribution Shader as Merge Shader Controller

Started by D.A. Bentley (SuddenPlanet), June 27, 2023, 02:01:48 PM

Previous topic - Next topic

D.A. Bentley (SuddenPlanet)

Can someone explain why a Simple Shape Shader will work as a Mix Controller, but the Distribution Shader with an altitude constraint won't work properly?

I have attached an example tgd to illustrate the problem.  Do a quick render showing the result with the SSS hooked up (default), then connect the Distribution Shader output into the Mix Controller port of the Merge Shader to see the difference.

Does the output of the Distribution Shader need to be adjusted in some way to work properly as a Mix Controller for the Merge Shader?  Why does the Merge Shader Preview not display properly (all black)?

Thanks!

Derek

KlausK

Hi, seems to me that it does what I would expect.

1 - rotate the "black" in the Merge Shader exposure window like you would navigating the main viewport. Why it is black I do not really know. Maybe because it only shows the values of the Distribution Shader (not colour information)?

2 - change the Minimum "Altitude" value of the "Limit minimum altitude" but stay in the negative range. Once you reach 0 you loose the number. Then you can slowly carve out the "2" in the ground.

But I am not sure if that is what you are after at all.

CHeers Klaus
/ ASUS WS Mainboard / Dual XEON E5-2640v3 / 64GB RAM / NVIDIA GeForce GTX 1070 TI / Win7 Ultimate . . . still (||-:-||)

Kevin Kipper

You can also try to use a Surface layer instead of the Merge Shader.  Assign the Heightfield_1 output to the Main input of the Surface Layer, and the Heightfield_2 output to the Child Layers input of the Surface layer.  Set the Altitude constraints as you like, and disable the Surface layer's Apply colour checkbox and Fractal Breakup checkbox.

The reason that the Merge shader preview is showing all black is because there is no colour information being passed through the Heightfield nodes at this point in the node network.  If you enable the Heightfield's Apply Colour and Shade checkbox under the Colour tab and pick a colour, you'll see that the Merge shader preview is no longer black.


D.A. Bentley (SuddenPlanet)


Thanks guys.  I'll see what I can figure out using your tips.

Klaus, I did mess with the distribution shader minimum altitude constraint settings, and got some interesting results going into negative values, but that's not really what I want.
Terragen should display a correct representation of what I would call an elevation mask in the shader preview, so going negative doesn't make sense to me.

My terrain goes from about 0m to 2000m at the Heightfield Shader level, so in the Distribution Shader preview I should see something like the attached image, and the 2nd terrain should mix/blend with the 1st terrain in the higher elevations (gray to white) and not show up in the lower elevation area (black).

Kevin, is there a way to convert height data to color data?  Perhaps a blue node, or is your suggestion to use a Surface Layer doing exactly that?

Anyway, I's keep learning and trying things to make this work.

Derek

D.A. Bentley (SuddenPlanet)

Kevin, I did get it to work with your method.  I'm still curious about my other question, "is there a way to convert height data to color data?  Perhaps a blue node?" if you happen to know.

Thanks,

Derek

Kevin Kipper

Derek, can you elaborate on what you're trying to accomplish with "convert height data to colour data"?  

Generally speaking, the data/values in the heightfield represent metres.  You could take the output from the Heightfield Shader and assign it to the Main Input of a Displacement Shader to Scalar node.  For example, if the height at a given sample point was 5000 metres, the scalar value output for that sample point would be 5000.

By default, the "Apply colour and shade" checkbox under the Heightfield's Colour tab is disabled, so any colour information from shaders above it in the Node network would pass their colour information through.  If you enabled the "Apply colour and shade" checkbox then the Heightfield shader's Diffuse colour value would override colours from the previous shaders.

D.A. Bentley (SuddenPlanet)

Quote from: Kevin Kipper on June 28, 2023, 03:30:30 PMDerek, can you elaborate on what you're trying to accomplish with "convert height data to colour data"? 

Generally speaking, the data/values in the heightfield represent metres.  You could take the output from the Heightfield Shader and assign it to the Main Input of a Displacement Shader to Scalar node.  For example, if the height at a given sample point was 5000 metres, the scalar value output for that sample point would be 5000.

By default, the "Apply colour and shade" checkbox under the Heightfield's Colour tab is disabled, so any colour information from shaders above it in the Node network would pass their colour information through.  If you enabled the "Apply colour and shade" checkbox then the Heightfield shader's Diffuse colour value would override colours from the previous shaders.


Thanks Kevin!  Turning on "Apply colour and shade" fixed my original scene.