// Ref: https://twitter.com/SebAaltonen/status/878250919879639040
// 2 mads (mad_sat and mad), faster than regular sign
float3 FastSign(float x)
float FastSign(float x)
return saturate(x * FLT_MAX) * 2.0 - 1.0;
}
// Orthonormalizes the tangent frame using the Gram-Schmidt process.