<?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 Ok I found the issue. You in Intel® Embree Ray Tracing Kernels</title>
    <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126475#M650</link>
    <description>&lt;P&gt;Ok I found the issue. You should not update any information in the ray if you reject the hit. Just do not change the ray at all and your code will work.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jun 2017 05:30:21 GMT</pubDate>
    <dc:creator>SvenW_Intel</dc:creator>
    <dc:date>2017-06-14T05:30:21Z</dc:date>
    <item>
      <title>Fitler function for User Defined Geometry</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126472#M647</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;I meet a problem when setting filter function for a user defined geometry. I searched on the internet and it says I should invoke filter function by myself in the intersect function (https://software.intel.com/en-us/forums/embree-photo-realistic-ray-tracing-kernels/topic/707268). What I want to do is just to collect all the intersected points along a ray.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;I don't how this goal is achieved, Is my code correct? Can anybody help me, thank you!&lt;/P&gt;

&lt;P&gt;void cellIntersectFunc(void* cell_i, RTCRay&amp;amp; ray, size_t item) {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; "intersect" &amp;lt;&amp;lt; endl;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;const Cell* cells = (const Cell*)cell_i;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;const Cell&amp;amp; cell = cells[item];&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;Vec3fa dRcp = 1/ray.dir;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;Vec3fa upper_right = cell.left_bottom + Vec3fa(cell.xzExtent, cell.yExtent, cell.xzExtent);&lt;BR /&gt;
	//&amp;nbsp;&amp;nbsp; &amp;nbsp;int nearAxis = -1, farAxis = -1;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i = 0; i &amp;lt; 3; i++) {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;const float origin = ray.org&lt;I&gt;;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;const float minVal = cell.left_bottom&lt;I&gt;, maxVal = upper_right&lt;I&gt;;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (ray.dir&lt;I&gt; == 0) {//The ray is parallel to the planes.&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (origin &amp;lt; minVal || origin &amp;gt; maxVal) {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;else {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;float t1 = (minVal - origin) * dRcp&lt;I&gt;;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;float t2 = (maxVal - origin) * dRcp&lt;I&gt;;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;bool flip = t1 &amp;gt; t2;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (flip)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;swap(t1, t2);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (t1 &amp;gt; ray.tnear) {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ray.tfar = t1;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;/*if (t2 &amp;lt; ray.tfar) {&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;ray.tfar = t2;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}*/&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;if (!(ray.tnear &amp;lt;= ray.tfar))&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;ray.geomID = cell.geomID;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;ray.primID = (unsigned int)item;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp;intersectionFilter(cell_i, ray);&lt;/STRONG&gt;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;return;&lt;BR /&gt;
	}&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;void intersectionFilter(void* ptr, RTCRay&amp;amp; ray_i)&lt;BR /&gt;
	{&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;RTCRay2&amp;amp; ray = (RTCRay2&amp;amp;)ray_i;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;ray.hit_geomIDs[ray.lastHit] = ray.geomID;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;ray.lastHit++;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;ray.geomID = RTC_INVALID_GEOMETRY_ID;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;ray.primID = RTC_INVALID_GEOMETRY_ID;&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; "hello" &amp;lt;&amp;lt; endl;&lt;BR /&gt;
	}&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 08:50:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126472#M647</guid>
      <dc:creator>Jianbo_Q_</dc:creator>
      <dc:date>2017-06-12T08:50:02Z</dc:date>
    </item>
    <item>
      <title>Code looks good to me. What</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126473#M648</link>
      <description>&lt;P&gt;Code looks good to me. What is the problem with that code?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 04:34:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126473#M648</guid>
      <dc:creator>SvenW_Intel</dc:creator>
      <dc:date>2017-06-13T04:34:40Z</dc:date>
    </item>
    <item>
      <title>At the first intersection, it</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126474#M649</link>
      <description>&lt;P&gt;At the first intersection, it works. but I have set geomID to invalid in my filter function. But the ray does not go further. There is no second intersection. But I am sure there should be. So I am not very sure whether there are some problems about how to invoke this function.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 13:07:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126474#M649</guid>
      <dc:creator>Jianbo_Q_</dc:creator>
      <dc:date>2017-06-13T13:07:34Z</dc:date>
    </item>
    <item>
      <title>Ok I found the issue. You</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126475#M650</link>
      <description>&lt;P&gt;Ok I found the issue. You should not update any information in the ray if you reject the hit. Just do not change the ray at all and your code will work.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 05:30:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126475#M650</guid>
      <dc:creator>SvenW_Intel</dc:creator>
      <dc:date>2017-06-14T05:30:21Z</dc:date>
    </item>
    <item>
      <title>Thank you very much. I tested</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126476#M651</link>
      <description>&lt;P&gt;Thank you very much. I tested your comments, it works. Another solution is to set&amp;nbsp;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;&amp;nbsp;ray.tfar = inf&amp;nbsp;in the filter function.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 14:28:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/Fitler-function-for-User-Defined-Geometry/m-p/1126476#M651</guid>
      <dc:creator>Jianbo_Q_</dc:creator>
      <dc:date>2017-06-20T14:28:19Z</dc:date>
    </item>
  </channel>
</rss>

