I'm trying to setup a mask similar to what Fresnel produces. Unfortunately Fresnel gives pretty bad results at grazing angles so I ended up using this :
float mask = abs(-viewDirTangentSpace.x / viewDirTangentSpace.z)
This gives a nice results but I would like to have values that evolves linearly. Is there a way to remap the range so it behaves like this (Photoshop) ?


I ended up doing this
float mask = abs(atan(-viewDirTangentSpace.x / viewDirTangentSpace.z) / (PI * 0.5));