Tangent Space View Direction based factor value remap

19 Views Asked by At

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)

enter image description here

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) ?

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

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