Search - User list
Full Version: calculate slope in Copernicus?
Root » Technical Discussion » calculate slope in Copernicus?
Dougie0047
Hi,
I would really like to find a method of calculating the slope of a height field, inside Copernicus. I know that there is a labs tool that does that in the sop context, but I'm looking for something purely COPs if possible. For now I have not been able to find any nodes or combinations thereof that does or helps me do this. But then again, maybe I've been looking in the wrong spot?

Btw, I know that there is a slope direction, but I'm looking for the "raw" slope with no directionality.

Can anyone help?

Thanks,
Dag
jsmack
Can you just get the magnitude of the directional slope field?
Dougie0047
Ah. I did not think about that. I can use a uvtomono node. By default the operation is set to Magnitude/Length, so that should do it. Seems like I have to do some serious remapping after this though. First remap to get the result to a normalized 0-1 range and then a second one to get the range into something more useful since I seem to be getting a one pixel dark line on the imported height field (see attached image). But, yes, seems to work. If for some reason this is not how I should do it, do shout out.

@jsmack: thanks!

Dag
jsmack
the border line is due to needing neighboring pixels to compute the slope. Along the border there are no neighbors, so the border condition is used to define what the neighbor would be.

Constant uses a single value for any sample outside of the boundaries, regardless of where. This would cause the slope to be equal to the value of the border pixel--probably not what you want.
Wrap will use the pixel on the opposite side as the neighbor. The slope depends on how different the opposite side is-for tiled patterns this is what you want for anything else it will be unpredictable.
Clamp/streak will extend the border value out to infinity. causing the slope to be zero on the edge, this is also probably not what you want.
Mirror would bounce back from the edge and use the neighbor in the opposite direction to calculate slope. The slope would then be streaked for a pixel along the border. this is probably the least egregious option. I'm not sure if mirror exists in COPs as border condition though.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB