<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic intersection test with increased tolerance in Intel® Embree Ray Tracing Kernels</title>
    <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/intersection-test-with-increased-tolerance/m-p/1158316#M754</link>
    <description>&lt;P&gt;I am trying to test collision detection by using embree. For this configuration I need more flexible intersection test (meaning&amp;nbsp;larger epsilon) for&amp;nbsp;triangle meshes.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if I consider a&amp;nbsp;triangle with following vertices (v0, v1, v2)&lt;/P&gt;&lt;P&gt;v0.x = 0.; v0.y = 0.; v0.z = 0.;&lt;/P&gt;&lt;P&gt;v1.x = 0.; v1.y = 100.; v1.z = 0.;&lt;/P&gt;&lt;P&gt;v2.x = 100.; v2.y = 100.; v2.z = 100.;&lt;/P&gt;&lt;P&gt;and the ray with&lt;/P&gt;&lt;P&gt;org.x = -eps; org.y = 0.; org.z = -10.;&lt;/P&gt;&lt;P&gt;dir.x = 0.; dir.y = 0.; dir.z = 1.;&lt;/P&gt;&lt;P&gt;where (eps &amp;gt; default eps)&lt;/P&gt;&lt;P&gt;The ray won't intersect the triangle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I found this article and applied what&amp;nbsp;this comment suggested&lt;/P&gt;&lt;P&gt;&lt;A href="https://software.intel.com/en-us/forums/embree-photo-realistic-ray-tracing-kernels/topic/755654#comment-1918389" target="_blank"&gt;https://software.intel.com/en-us/forums/embree-photo-realistic-ray-tracing-kernels/topic/755654#comment-1918389&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For some test cases&amp;nbsp;it worked fine&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;but for the other cases it didn't work because&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;it was not able to pass node intersection test &lt;/STRONG&gt;before actually going into triangle intersection test.&lt;/P&gt;&lt;P&gt;For a single ray test, I guess it has something to do with&amp;nbsp;this part of the code in&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;node_intersector1.h&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;template&amp;lt;int N, int Nx&amp;gt;
      __forceinline size_t intersectNodeRobust(const typename BVHN&amp;lt;N&amp;gt;::AlignedNode* node, const TravRay&amp;lt;N,Nx,true&amp;gt;&amp;amp; ray, vfloat&amp;lt;Nx&amp;gt;&amp;amp; dist)
    {      
      const vfloat&amp;lt;N&amp;gt; tNearX = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.nearX)) - ray.org.x) * ray.rdir_near.x;
      const vfloat&amp;lt;N&amp;gt; tNearY = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.nearY)) - ray.org.y) * ray.rdir_near.y;
      const vfloat&amp;lt;N&amp;gt; tNearZ = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.nearZ)) - ray.org.z) * ray.rdir_near.z;
      const vfloat&amp;lt;N&amp;gt; tFarX  = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.farX )) - ray.org.x) * ray.rdir_far.x;
      const vfloat&amp;lt;N&amp;gt; tFarY  = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.farY )) - ray.org.y) * ray.rdir_far.y;
      const vfloat&amp;lt;N&amp;gt; tFarZ  = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.farZ )) - ray.org.z) * ray.rdir_far.z;
      const vfloat&amp;lt;N&amp;gt; tNear = max(tNearX,tNearY,tNearZ,ray.tnear);
      const vfloat&amp;lt;N&amp;gt; tFar  = min(tFarX ,tFarY ,tFarZ ,ray.tfar);
      const vbool&amp;lt;N&amp;gt; vmask = tNear &amp;lt;= tFar;
      const size_t mask = movemask(vmask);
      dist = tNear;
      return mask;
    }&lt;/PRE&gt;

&lt;P&gt;The problem is that I have no idea what this code means.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question is&lt;/P&gt;
&lt;P&gt;1. Can I modify the way intersection test works with&amp;nbsp;bounding volumes?&lt;/P&gt;
&lt;P&gt;2. if 1 is not possible, can I modify the way bounding volumes are created?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the above&amp;nbsp;are&amp;nbsp;not good idea, I'll try user geometry.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jun 2019 08:14:36 GMT</pubDate>
    <dc:creator>Lee__Heungson</dc:creator>
    <dc:date>2019-06-03T08:14:36Z</dc:date>
    <item>
      <title>intersection test with increased tolerance</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/intersection-test-with-increased-tolerance/m-p/1158316#M754</link>
      <description>&lt;P&gt;I am trying to test collision detection by using embree. For this configuration I need more flexible intersection test (meaning&amp;nbsp;larger epsilon) for&amp;nbsp;triangle meshes.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if I consider a&amp;nbsp;triangle with following vertices (v0, v1, v2)&lt;/P&gt;&lt;P&gt;v0.x = 0.; v0.y = 0.; v0.z = 0.;&lt;/P&gt;&lt;P&gt;v1.x = 0.; v1.y = 100.; v1.z = 0.;&lt;/P&gt;&lt;P&gt;v2.x = 100.; v2.y = 100.; v2.z = 100.;&lt;/P&gt;&lt;P&gt;and the ray with&lt;/P&gt;&lt;P&gt;org.x = -eps; org.y = 0.; org.z = -10.;&lt;/P&gt;&lt;P&gt;dir.x = 0.; dir.y = 0.; dir.z = 1.;&lt;/P&gt;&lt;P&gt;where (eps &amp;gt; default eps)&lt;/P&gt;&lt;P&gt;The ray won't intersect the triangle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I found this article and applied what&amp;nbsp;this comment suggested&lt;/P&gt;&lt;P&gt;&lt;A href="https://software.intel.com/en-us/forums/embree-photo-realistic-ray-tracing-kernels/topic/755654#comment-1918389" target="_blank"&gt;https://software.intel.com/en-us/forums/embree-photo-realistic-ray-tracing-kernels/topic/755654#comment-1918389&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For some test cases&amp;nbsp;it worked fine&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;but for the other cases it didn't work because&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;it was not able to pass node intersection test &lt;/STRONG&gt;before actually going into triangle intersection test.&lt;/P&gt;&lt;P&gt;For a single ray test, I guess it has something to do with&amp;nbsp;this part of the code in&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;node_intersector1.h&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;template&amp;lt;int N, int Nx&amp;gt;
      __forceinline size_t intersectNodeRobust(const typename BVHN&amp;lt;N&amp;gt;::AlignedNode* node, const TravRay&amp;lt;N,Nx,true&amp;gt;&amp;amp; ray, vfloat&amp;lt;Nx&amp;gt;&amp;amp; dist)
    {      
      const vfloat&amp;lt;N&amp;gt; tNearX = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.nearX)) - ray.org.x) * ray.rdir_near.x;
      const vfloat&amp;lt;N&amp;gt; tNearY = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.nearY)) - ray.org.y) * ray.rdir_near.y;
      const vfloat&amp;lt;N&amp;gt; tNearZ = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.nearZ)) - ray.org.z) * ray.rdir_near.z;
      const vfloat&amp;lt;N&amp;gt; tFarX  = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.farX )) - ray.org.x) * ray.rdir_far.x;
      const vfloat&amp;lt;N&amp;gt; tFarY  = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.farY )) - ray.org.y) * ray.rdir_far.y;
      const vfloat&amp;lt;N&amp;gt; tFarZ  = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.farZ )) - ray.org.z) * ray.rdir_far.z;
      const vfloat&amp;lt;N&amp;gt; tNear = max(tNearX,tNearY,tNearZ,ray.tnear);
      const vfloat&amp;lt;N&amp;gt; tFar  = min(tFarX ,tFarY ,tFarZ ,ray.tfar);
      const vbool&amp;lt;N&amp;gt; vmask = tNear &amp;lt;= tFar;
      const size_t mask = movemask(vmask);
      dist = tNear;
      return mask;
    }&lt;/PRE&gt;

&lt;P&gt;The problem is that I have no idea what this code means.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question is&lt;/P&gt;
&lt;P&gt;1. Can I modify the way intersection test works with&amp;nbsp;bounding volumes?&lt;/P&gt;
&lt;P&gt;2. if 1 is not possible, can I modify the way bounding volumes are created?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the above&amp;nbsp;are&amp;nbsp;not good idea, I'll try user geometry.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2019 08:14:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/intersection-test-with-increased-tolerance/m-p/1158316#M754</guid>
      <dc:creator>Lee__Heungson</dc:creator>
      <dc:date>2019-06-03T08:14:36Z</dc:date>
    </item>
    <item>
      <title>I am self-answering my</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/intersection-test-with-increased-tolerance/m-p/1158317#M755</link>
      <description>&lt;P&gt;I am self-answering my question. I modified the above intersection test&amp;nbsp;with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:cpp; class-name:dark;"&gt;      const vfloat4 eps_x = float(ulp) * (vfloat4::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x + ray.farX)) - vfloat4::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x + ray.nearX)));
      const vfloat4 eps_y = float(ulp) * (vfloat4::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x + ray.farY)) - vfloat4::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x + ray.nearY)));
      const vfloat4 eps_z = float(ulp) * (vfloat4::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x + ray.farZ)) - vfloat4::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x + ray.nearZ)));

      const vfloat&amp;lt;N&amp;gt; tNearX = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.nearX)) - eps_x - ray.org.x) * ray.rdir_near.x;
      const vfloat&amp;lt;N&amp;gt; tNearY = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.nearY)) - eps_y - ray.org.y) * ray.rdir_near.y;
      const vfloat&amp;lt;N&amp;gt; tNearZ = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.nearZ)) - eps_z - ray.org.z) * ray.rdir_near.z;
      const vfloat&amp;lt;N&amp;gt; tFarX  = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.farX )) + eps_x - ray.org.x) * ray.rdir_far.x;
      const vfloat&amp;lt;N&amp;gt; tFarY  = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.farY )) + eps_y - ray.org.y) * ray.rdir_far.y;
      const vfloat&amp;lt;N&amp;gt; tFarZ  = (vfloat&amp;lt;N&amp;gt;::load((float*)((const char*)&amp;amp;node-&amp;gt;lower_x+ray.farZ )) + eps_z - ray.org.z) * ray.rdir_far.z;
      
&lt;/PRE&gt;

&lt;P&gt;with the following change in contants.h&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp; class-name:dark;"&gt;struct UlpTy
  {
    __forceinline operator double( ) const { return std::numeric_limits&amp;lt;double&amp;gt;::epsilon(); }
    __forceinline operator float ( ) const { return float(1.e-3); }
  };&lt;/PRE&gt;

&lt;P&gt;I am testing this even though I am not sure what kind of side effects these change will cause.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 05:16:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/intersection-test-with-increased-tolerance/m-p/1158317#M755</guid>
      <dc:creator>Lee__Heungson</dc:creator>
      <dc:date>2019-06-04T05:16:00Z</dc:date>
    </item>
    <item>
      <title>If you really need larger</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/intersection-test-with-increased-tolerance/m-p/1158318#M756</link>
      <description>&lt;P&gt;If you really need larger epsilons during BVH traversal it might be easier to adjust the final tNear, tFar values instead of each dimension individually. However, BVH traversal in robust mode is already conservative in the node intersection test, so I'm just wondering why you need even larger epsilons?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 16:30:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/intersection-test-with-increased-tolerance/m-p/1158318#M756</guid>
      <dc:creator>BenthinC_Intel</dc:creator>
      <dc:date>2019-06-04T16:30:41Z</dc:date>
    </item>
    <item>
      <title>Quote:Carsten Benthin (Intel)</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/intersection-test-with-increased-tolerance/m-p/1158319#M757</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Carsten Benthin (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you really need larger epsilons during BVH traversal it might be easier to adjust the final tNear, tFar values instead of each dimension individually. However, BVH traversal in robust mode is already conservative in the node intersection test, so I'm just wondering why you need even larger epsilons?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the idea.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Speaking of&amp;nbsp;your question I assume you mean "conservative" as a ray not missing some triangles. In my application which is a sort a contact algorithm of the finite element analysis, when the ray almost hit the boundary of a surface but technically didn't intersect it, it should still be treated as intersected. Because the nonlinear equation solver becomes unstable when the small changes in the solution vector cause jumps of&amp;nbsp;contact forces between two value (0 to 1 or 1 to 0) in&amp;nbsp;consecutive iterations.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2019 05:29:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/intersection-test-with-increased-tolerance/m-p/1158319#M757</guid>
      <dc:creator>Lee__Heungson</dc:creator>
      <dc:date>2019-06-05T05:29:00Z</dc:date>
    </item>
  </channel>
</rss>

