I'm trying to create snow peak mountain and want the snow to only sit on the flatter section of the terrain. Obviously, on steep sections, there would be no snow. How do I do this in Max Arnold? I checked out utility and curvature nodes, but they don't seem to provide anything to create what I want. Thanks.
I found the answer. You can use the
1) State Vector - Set to N for Normals.
2) Use the Shuffle node and set it to B to isolate the up and down direction.
3) Use RGB Ramp to color the range or set the black and white paint. (Lower color point starts at .5 since normal map starting value is at .5 value.)
Hope this helps others.
Wrote this into an OSL shader.
2 features exposed:
- Power
- Slope
shader SnowMask ( float Power = 4.0 [[ float min =0.03, float max = 100. ]], float Slope = 0.5 [[ float min = 0.0, float max = 0.9999999 ]], output color Out = 1.0 ) { Out = pow((N[2] - Slope) / .5, 1.0 / Power); }
Awesome, that is pretty awesome. Do you have an elevation feature? Higher the elevation, the more snow coverage.
No, but that could be build into it.
The Power value is snow density and we can map that out over a distance to thin out snow in lower parts while having a massive top.
You can do this with core nodes.
I added something to this effect in addition to adding 4 different sets of textures to build the terrain. It's working, but my node network is getting complicated. Would rather have a single node deal with it. Also would be nice if we can get the Randomizebitmap node to have a feather feature to tile texture without edge seams.
Here, with very low Power, it has only snowed a little. Map this over v channel and pipe to Power in a normalized range which fits the current frame.
This returns a situation where you can map the density out over hight.
And finally,
Added density control over v, this is not a linear mask over some generic distribution, the altitude controls the amount it has snowed, it does not just fade out a constant procerudal over distance.
This way we can return both density inside a given range and play around with the slow in that particular range.
I just set it to thick mountain tops and then thin out relativly fast, so you can see effect is working.
Check this reply.
It does exactly what you say, fade actual density/power over the hight of the terrain.
https://answers.arnoldrenderer.com/answers/19900/view.html
You would want to add a UVW map modifier to the mesh, planar mapping.
Catch this mapping with an OSL UVW map, same channel number.
Into a range node and work in the scales so the gradient from the map gets more contrasty, thats all you want to focus on, then pipe to Power on SnowMask shader and Hight controls density as well.
It's the 17 lines of code in the code box in reply #1.
Select them and ctrl+c
Go into max and open the checker.osl node, and open the code window, select everything in there and press ctrl+v. Now the 17 lines should be the only thing in the code window.
Now, press compile in lower left corner of window.
Close window, shader is compiled and working.
Also you can try this shader :
http://zenopelgrims.com/dusty-arnold-shader/
We can add additional feature sets to the OSL shader such as Ambient occlusion, I already did this the first day I looked at it, but decided to pull the AO aspect, to also respect for occluded top surfaces, overhangs, this is easy, but pulled since trace call in OSL is not currently supported on the GPU, but once it is, most of these c++ shaders will return redundant, also core arnold nodes.