Nice, I love the control you can have with your solution @witch-dev. Thank you for sharing the code.
Why did you base the lerp on the Saturate output? Not questioning it because I know something better, but asking because I’m learning.
Because linear interpolates generally take an alpha value between 0 and 1. Saturate works like a clamp between 0 - 1, so in order to avoid any unwanted negative values coming out of the Lerp, you should clamp the alpha input.
You could always go outside of 0 - 1 but it depends on your use. In most cases, there is a specific purpose to blend between 2 fixed inputs so you clamp the alpha to never get anything outside of the 2 inputs.
It’s definitely a hack, but hey it works, great job!
Rosegoldslugs explained it very well, though admittedly, in this case, it’s not really needed. The values won’t go out of the 0-1 range anyway (At least with reasonable input values).
Also, the abs node after the dot product should probably be a saturate instead.
@**witch-dev**Nice workaround but not suitable for every situation. Imagine looking down a extreme slope. Or having watery/wet layer on the ground. It will look very wrong.
I was playing with this issue with the following approaches for OpenLand. Here are some of the methods I tried:
- Distance-based specular modifications
- Camera vector (fresnel) based specular modifications
- Camera vector (fresnel) based normal modifications (as suggested by @witch-dev
But all these need some input from the user & it still looks bad in some cases.
Recently, I tried specular = 1-roughness
method & it really works well for my use cases. Here’s bit more about it: