handling NaN #938
-
Hi, I wonder if there is any convenient way in Mitsuba to replace all NaN with 0? For example, if I do something with the ray intersection point, then there might be NaN values for rays that do not intersect at all. In this case, what would be like a standard way to handle the NaN values? Do I always need to mask out non-intersecting rays...? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, We can do But in general "there might be NaN values for rays that do not intersect at all" this is not supposed to be the case. For rays that don't intersect with anything, the preliminary intersection (by Optix/Embree) returns |
Beta Was this translation helpful? Give feedback.
Hi,
We can do
tensor[dr.isnan(tensor)] = 0
in python.But in general "there might be NaN values for rays that do not intersect at all" this is not supposed to be the case. For rays that don't intersect with anything, the preliminary intersection (by Optix/Embree) returns
pi.t
as inf, which inactivates these lanes (si.is_valid() tests if si.t is not inf) in all later computation. All fields should be zero-initialized. Nan usually happens because of a divide by zero or similar operation.