RenderKit / ospray

An Open, Scalable, Portable, Ray Tracing Based Rendering Engine for High-Fidelity Visualization
http://ospray.org
Apache License 2.0
982 stars 178 forks source link

Bug in intersectCylinder() function #482

Closed stukowski closed 2 years ago

stukowski commented 3 years ago

Hi! I just want to make you aware of an issue in the intersectCylinder() function of OSPRay. More specifically, in this section of the code:

https://github.com/ospray/ospray/blob/release-2.6.x/ospray/common/Intersect.ih#L114-L129

If the ray direction d is exactly perpendicular to the cylinder axis s, sd becomes zero and a division-by-zero follows and no hit is recorded. In my rendering application this leads to cylinder primitives disappearing if the camera uses a parallel projection and a cylinder is oriented exactly parallel to the camera's projection plane.

johguenther commented 2 years ago

Thanks for reporting. That code is currently not used in OSPRay (because curves are directly intersected by Embree now), but this will change. The correct way to check for the cylinder caps is to project the hits to the axis (instead of projecting the caps to the ray).

johguenther commented 2 years ago

v2.8 has a reworked intersectCylinder().