Heading distribution shader

Started by uuderzo, June 17, 2020, 06:25:45 AM

Previous topic - Next topic

uuderzo

Just curious.

Is there a reason of missing heading range parameter in the surface shader node?
It should be quite natural thinking of it when dealing with snow on northern side of a peak an so on.
Instead, a complex network of nodes is required to do the computation based on surface normals.

Just curious.

Hetzen

Actually, it's a lot easier than you think.

Connect a Get Normal in Texture into the input of a Dot Product node, then connect a Constant Vector to the other input. In the Constant Vector set the direction you want to mask, so 0,0,-1 for south, and the Dot Product will output white on the surface facing that direction.

uuderzo

I already tried this but i suspect that the output of the dot product is not directly usable as a colour.
Now, using it as a shader mask it works!

Thank you!

uuderzo

Just for better understanding of the mechanics...

If i would (just for knowledge) like to plug the dot product (which produces a scalar number) into an input color such as the Planet surface shader input, how should i operate?

WAS

Quote from: uuderzo on June 17, 2020, 08:45:51 AMJust for better understanding of the mechanics...

If i would (just for knowledge) like to plug the dot product (which produces a scalar number) into an input color such as the Planet surface shader input, how should i operate?

You can apply colour, but because it's a scalar, the "black" is data as well, and will overlay onto the terrain. So it is really best to use it as a mask, and use a surface layer for colour, as you'd still need to mask out the black.

Here is a example using it as a mask of surface layer colour, and also example of colourizing the scalar and using it as input as well.

uuderzo

Ok, more or less i got it.

I have only one dubt about directly plugging your "Clamp 0 1 colour 01" node (that should be a legal color) into the "Planet 01" node.
I'd expect to get the surface diffusion color in preview, without the shading due to the light, that should be provided by the surface shader.
Instead, i obtain a flat black render.

Is this because the correct perspective projection of the color function is performed by the shader node? And without this node there is no projection matrix information?

WAS

Clamp 01 Colour is just the scalar, colorized. There is no displacement data, etc, and everything that is not red (a south facing slope) will be black. So yes, it would need to be applied to a surface layer that is applying the effect as a surface to your displacement chain.