Fixed a rare case of NaN in Cycles
ClosedPublic

Authored by Stefan Werner (swerner) on May 19 2016, 10:51 AM.

Details

Summary

This fixes a rare case where NaNs could exist inside Cycles. When certain invalid meshes were passed in, Cycles would try too normalize a zero length normal during its setup stage. While it does check against division by zero, it still returns a zero length normal and passes it on to the path tracing kernel. The kernel then operates under the assumption that normals are valid, and in the case of such a zero length normal, would eventually create NaNs that propagate through and result in black pixels.

Diff Detail

Repository
rB Blender
Stefan Werner (swerner) retitled this revision from to Fixed a rare case of NaN in Cycles.May 19 2016, 10:51 AM
Stefan Werner (swerner) updated this object.
Stefan Werner (swerner) set the repository for this revision to rB Blender.

We should perhaps remove degenerate faces all together, but think suggested approach would also work.

As far as I know you should only be able to get a zero length normal with zero area faces, which you can't hit. But of course with float rounding issues it's not so simple, and this workaround for these rare cases seems ok.

@Brecht Van Lommel (brecht), i'm not so much sure you can't hit zero sized faces with the watertight approach we've currently got. Would need to be checked tho as we don't implement paper one to one.

This revision was automatically updated to reflect the committed changes.

Somewhat with Blender on Mac OS I managed to create 6 NAN objects and when on a visible layer always render the scene black when only using a lamp as light.
World and mesh lights illuminate the scene.

Screen Recording:
https://drive.google.com/file/d/0Byzv_NlyKp_2T0Z1cEFFM2trNWc/view

File:
https://drive.google.com/file/d/0Byzv_NlyKp_2MWpGVEl1dHVvUUk/view

JA12 pointed out the NaN bug.
https://blenderartists.org/forum/showthread.php?432909-any-idea-why-any-new-lamp-does-not-illuminate-the-geometry

To solve it all objects that share the data (6 objects) have to be selected and the via Alt G reset. Then rendering works fine.
I have no recollection how I created this 3 piece circular pattern too.

@claas eicke (cekuhnendev), please submit bug as a proper bug report, not as a comment in a code review .

@claas eicke (cekuhnendev), please submit bug as a proper bug report, not as a comment in a code review .

sure can do - I thought this might NaN report here was a better place.

it's rarely a good idea to drag up old closed tickets, this one had been closed for a year+ the other ticket you spammed 5+ years! In those cases it's usually better to start a new ticket,