Moss grows on the polar-side of slopes at high latitudes

Started by PabloMack, December 15, 2013, 10:34:52 AM

Previous topic - Next topic

PabloMack

In nature, it is very common in temperate regions for moss and other kinds of plants to grow on the sides of objects that get most shade. For example moss grows on the North sides of trees at latitudes that are northerly enough to have enough differential shading of the north side of large tree trunks. Similarly, there are microhabitats created on sides of hills that get more or less shade from the sun because of sunlight's tendency to promote water loss. I see a challenge in Terragen since heightfields only work at the North Pole of the planet. The question arises "How would someone bias the way slope influences (encourages/discourages) plant growth according to the surface normal relative to its horizontal heading in ways we see in nature?" At the North Pole, there is no compass "heading". But since the sun is controlled by a "heading" which becomes longitude at the pole, I suspect a function could be derived to control plant growth. In nature, altitude also influences this phenomenon. The nodes that get altitude and slope relative to surface normal are there but we need to somehow obtain the normal's "heading". Can anyone see a way to do this?

You should be able to take the sine of the heading of the surface normal to obtain a value that influences plant growth. This value would vary between -1 and +1. If you didn't want negative values then you could add 1 and the value would vary from 0 to +2. If you wanted the value to vary between 0 and 1 then you could divide the number by 2. On a global scale, you could combine this with latitude somehow.

Kadri


Pablo i am sure there is probably a more sophisticated way, but i would use basically the sun for obtaining a mask for the ground.

PabloMack

#2
This phenomenon is not caused by shadows from the sun in any one position. This would cause a hard shadow and the mask would be too abrupt. This phenomenon is causes by a summing of the sun over the course of a day in all of its positions which would create a mask with very soft boundaries. (In reality it even involves the movement of the sun's arc over the course of a year) I am still leaning toward finding a way to obtain the surface-normal's heading. Perhaps a PS staff member needs to answer this question.

Kadri


You could do this with soft shadow and using more then 1 sun too.
But you are more after the scientific solution as it seems :)

PabloMack

Your suggestion is definitely something to think about.

dandelO

Could a function be created using Get Ray Origin? Maybe you could find some way to mask the normals that point a certain threshold angle, or by a Smooth Step gradient away from that?

Dune

You could use a 'get normal' (no pun intended), and rotate that.

Hetzen

Get Normal is what I would use too. I've used it to get more snow on one side of mountains before.

Get normal gives a colour output, positive and negative. So facing X is full red to negative full red. To simulate polar facing, you'd use the blue output for the z axis.

So use a blue to scalar to convert the output from a get normal to give you a scalar value from -1 to 1. To create a mask, use a clamp 01 to isolate the positive value. That should give you a mask on the northern slope of your terrain. Invert the get normal output if you want a southern facing mask.

To simluate latitude (would you actually see this in one scene?), I would use a get position to determine if your surface is above or below the equator. But as TG sets the origin 0,0,0 as the top of the planet, you'd need to define where your view is pointing, then offset the math. Which isn't really easy to explain without being a little bit more specific with the scene.

Dune

You can add a rotate X vector to increase coverage, and a multiply color to make it stronger, and use a color adjust for final adjustment. I didn't use a clamp 01, and it didn't make much difference. You can also add a rotate y vector to rotate the angle.

Hetzen

Colour Adjust is a good call Ulco. You can use it to set the base black level to say -0.5, so that there's some wrap around with the mask. (similar functionality to Pablo's +1 /2 in the OP).

It also has the clamp function built in, with the addition of gamma adjustment to shift the greyscale curve to push towards a fuller/thinner mask.

The rotate x seems a bit odd though. I would have thought you meant rotate y which would be usefull to tweak the angle your mask is working at, especially if you want your effect off axis. Not tried that.

Cheers

Jon

PabloMack

#10
Quote from: Dune on December 16, 2013, 06:23:00 AMYou could use a 'get normal' (no pun intended), and rotate that.

Going with your suggestion, I did a Get Normal then Rotate Y followed by Rotate Z. I then did a Convert Y to Scalar and then Clamp Scalar. Finally, I scaled this with a Multiply Node and then fed it into a (Fern) Population's Density Input. The Rotate Y controls the heading while the Rotate Z specifies the slope. The Multiply allows you to adjust the density. Thanks everyone. I think this will give me what I am looking for and I don't have to create any scene-specific files.

Hetzen

Good stuff. My concern would be with the multiple rotates in that chain, I could get easily lost where the final angle would be.

It could be clearer if you set your slope angle with a distribution/surface layer node, then multiply that with your z axis output from the Get Normal. You would be able to check if both directions were where you wanted them independantly by plugging each output into a surface layer's mask input to get a colour indication on the terrain surface.

Ulco's idea of using a Colour Adjust node is a very good one. Moss will grow around a surface depending on what shade it gets through out the day. So it won't always grow away from one sun position. It will grow more where it has less sun through out the day.

By using the black level in a colour adjust node, you can use some of the negative value from a get normal to get a mask that fades off as it faces the sun, rather than saying nothing grows facing south.

A value of -0.5 in the black level of a colour adjust means that black is now -0.5 of the input. So if you had -1 on a surface facing south, moss would grow when it's facing 45 degrees away from flat on south and grow in grey value as it faces north. Lowering the white point, means white will be more prevelant on the north side, thus increasing the population density. Gamma corection will increase/decrease the fall off between white and black.

Multiplying the output as you have will generate values greater than 1, which can have diverse effect's if you are using the mask to control colour for example in a texture. Brown x 1 = brown. Brown x 2 = lighter brown. Mask inputs on shaders are passive and will pass on their input to the overall output value usually.

bigben