ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/Development/ray/src/util/disk2square.cal
(Generate patch)

Comparing ray/src/util/disk2square.cal (file contents):
Revision 2.6 by greg, Wed Oct 30 17:25:37 2024 UTC vs.
Revision 2.7 by greg, Fri Nov 14 23:51:42 2025 UTC

# Line 66 | Line 66 | out_square_y = (out_square_b + 1)/2;
66          The following forumulas compute Shirley-Chiu bin "scbin" based on:
67  
68          RHS             - right-handed system (-1 for left-handed coords)
69 +        JTR             - bin jitter/mixing amount (0 for sharp boundaries)
70          Dx,Dy,Dz        - Incident direction (normalized, towards surface front)
71          rNx,rNy,rNz     - Surface normal (normalized, away from surface)
72          Ux,Uy,Uz        - Up direction vector (does not need to be normalized)
# Line 74 | Line 75 | out_square_y = (out_square_b + 1)/2;
75          ordered with the "up" direction changing fastest.
76   }
77   RHS = 1;
78 + JTR = 0;
79                                  { Compute oriented axis values }
80   inc_dz = -Dx*rNx-Dy*rNy-Dz*rNz;
81   inc_rx = -RHS*(Dx*(Uy*rNz-Uz*rNy) + Dy*(Uz*rNx-Ux*rNz) + Dz*(Ux*rNy-Uy*rNx));
# Line 83 | Line 85 | inc_radf = if(inc_den2-1e-7, sqrt((1 - inc_dz*inc_dz)/
85                                  { Pass to formulas in first section }
86   in_disk_x = inc_rx*inc_radf;
87   in_disk_y = -inc_ry*inc_radf;
88 +                                { Random perturbation for final bin # }
89 + jtr1 = JTR*(.5 - rand(1.958*Dx - 5.386*Dy - 3.772*Dz));
90 + jtr2 = JTR*(.5 - rand(-6.334*Dx - 2.165*Dy + 7.953*Dz));
91 +
92 + yndx = if(JTR, min(max(0,floor(out_square_x*SCdim + jtr1)),SCdim-1),
93 +                floor(out_square_x*SCdim));
94 + xndx = if(JTR, min(max(0,floor(out_square_y*SCdim + jtr2)),SCdim-1),
95 +                floor(out_square_y*SCdim));
96                                  { Compute final bin (-1 if behind surface) }
97 < scbin = if(inc_dz,
88 <                floor(out_square_x*SCdim)*SCdim + floor(out_square_y*SCdim),
89 <                -1);
97 > scbin = if(inc_dz, yndx*SCdim + xndx, -1);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)