Skip to content

Commit

Permalink
fix importance singularity
Browse files Browse the repository at this point in the history
  • Loading branch information
iaomw committed Jan 15, 2025
1 parent f41ebeb commit b4ed874
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion zenovis/xinxinoptix/LightBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ float LightBounds::importance(Vector3f p, Vector3f n) const {
return 0;

// Return final importance at reference point
float importance = phi * cosThetap / d2;
//float importance = phi * cosThetap / d2;
float r2 = 1.0f; float d = sqrtf(d2);
float importance = phi * cosThetap * 2.0f / ( d * sqrtf(d2 + r2) + d2 + r2 );

DCHECK(importance >= -1e-3);
// Account for $\cos\theta_\roman{i}$ in importance at surfaces
if (n[0]!=0 && n[1]!=0 && n[2]!=0) {
Expand Down
5 changes: 4 additions & 1 deletion zenovis/xinxinoptix/LightTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ struct CompactLightBounds {
return 0;

// Return final importance at reference point
float importance = phi * cosThetap / d2;
//float importance = phi * cosThetap / d2;
float r2 = 1.0f; float d = sqrtf(d2);
float importance = phi * cosThetap * 2.0f / ( d * sqrtf(d2 + r2) + d2 + r2 );

DCHECK(importance >= -1e-3f);

if (n[0]!=0 && n[1]!=0 && n[2]!=0) {
Expand Down

0 comments on commit b4ed874

Please sign in to comment.