Determining slope in shader
Asked Answered
L

2

0

So, I'm trying to figure out what the slope is in a shader so I can make changes to albedo based on that.
I assume I need to do something with the normal, but I'm really not sure what.

Lalalalage answered 29/4, 2023 at 0:30 Comment(0)
O
0

The slope angle is inverse cosine of the dot product of normal vector and up vector. For most things you can use the dot product directly without calculating the inv cosine. It'll vary in range 0-1.

Overdevelop answered 29/4, 2023 at 0:43 Comment(0)
L
0

Overdevelop works a treat, thank you!

Lalalalage answered 1/5, 2023 at 15:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.