Skip to content

Instantly share code, notes, and snippets.

@joshuazt
Last active May 11, 2022 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuazt/520ce0fdf1de2ec551b4d4fcf8e3c6f9 to your computer and use it in GitHub Desktop.
Save joshuazt/520ce0fdf1de2ec551b4d4fcf8e3c6f9 to your computer and use it in GitHub Desktop.
vector dir = chv('dir');
float angle = dot(@N, dir);
float fitangle = fit(angle, -1, 1, 0, 1);
float blend = chramp('blend', fitangle);
@Cd = blend;
vector tmp = cross(@N, dir);
vector cross = cross(@N, tmp);
v@N = lerp(@N, cross, blend);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment