Skip to content

Commit

Permalink
Merge pull request PixarAnimationStudios#1060 from barfowl/glsl_tri_d…
Browse files Browse the repository at this point in the history
…egen_normal

Minor improvement to degenerate normals in GLSL Bezier triangle
  • Loading branch information
davidgyu authored Feb 14, 2019
2 parents ec231f8 + 1cdbb72 commit aa3f75f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions opensubdiv/osd/glslPatchCommon.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -1172,10 +1172,17 @@ OsdEvalPatchBezierTriangle(ivec3 patchParam, vec2 UV,
dNv = cross(dUV, dPv) + cross(dPu, dVV);

if (nLength < nEpsilon) {
float DU = (UV.x == 1.0) ? -1.0 : 1.0;
float DV = (UV.y == 1.0) ? -1.0 : 1.0;
// Use 1st order Taylor approximation of N(u,v) within patch interior:
if (w > 0.0) {
N = dNu + dNv;
} else if (u >= 1.0) {
N = -dNu + dNv;
} else if (v >= 1.0) {
N = dNu - dNv;
} else {
N = -dNu - dNv;
}

N = DU * dNu + DV * dNv;
nLength = length(N);
if (nLength < nEpsilon) {
nLength = 1.0;
Expand Down

0 comments on commit aa3f75f

Please sign in to comment.