Skip to content

Commit

Permalink
Use specular or diffuse reflection for invalied cone angles
Browse files Browse the repository at this point in the history
  • Loading branch information
tobre1 committed Feb 6, 2025
1 parent 818fc90 commit fca5465
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/viennaray/rayReflection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,13 @@ template <typename NumericType, int D>
// (https://math.stackexchange.com/a/182936)
std::uniform_real_distribution<NumericType> uniDist;

assert(maxConeAngle >= 0. && maxConeAngle <= M_PI / 2. &&
"Cone angle not allowed");
if (maxConeAngle <= 0.) {
return ReflectionSpecular<NumericType>(rayDir, geomNormal);
}

if (maxConeAngle >= M_PI_2) {
return ReflectionDiffuse<NumericType, D>(geomNormal, rngState);
}

Vec3D<NumericType> direction;
// compute specular direction
Expand Down

0 comments on commit fca5465

Please sign in to comment.