Skip to content

Instantly share code, notes, and snippets.

@quizcanners
Last active December 18, 2019 19:44
Show Gist options
  • Save quizcanners/c6e43393ab30245e79bf5fc3788841dc to your computer and use it in GitHub Desktop.
Save quizcanners/c6e43393ab30245e79bf5fc3788841dc to your computer and use it in GitHub Desktop.
inline float3 DetectSmoothEdge(float3 edge, float3 junkNorm, float3 sharpNorm, float3 edge0, float3 edge1, float3 edge2) {
edge = max(0, edge - 0.965) * 28;
 float allof = edge.r + edge.g + edge.b;
float border = min(1, allof);
float3 edgeN = edge0*edge.r + edge1*edge.g + edge2*edge.b;
float junk = min(1, (edge.g*edge.b + edge.r*edge.b + edge.r*edge.g)*2);
return normalize((sharpNorm*(1 - border)+ border*edgeN)*(1 - junk) + junk*(junkNorm));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment