Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/appleseed/renderer/modeling/bsdf/orennayarbrdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,15 @@ namespace

// Project outgoing and incoming vectors onto the tangent plane
// and compute the cosine of the angle between them.
const Vector3f V_perp_N = normalize(project(outgoing, n));
const Vector3f I_perp_N = normalize(incoming - n * cos_in);
// Do not use normalize() as V_perp and I_perp can be zero.
const Vector3f V_perp = project(outgoing, n);
const Vector3f I_perp = incoming - n * cos_in;
const float V_perp_norm = norm(V_perp);
const float I_perp_norm = norm(I_perp);
if (V_perp_norm == 0.0f || I_perp_norm == 0.0f)
return;
const Vector3f V_perp_N = V_perp / V_perp_norm;
const Vector3f I_perp_N = I_perp / I_perp_norm;
const float delta_cos_phi = dot(V_perp_N, I_perp_N);

// Compute C1 coefficient.
Expand Down