<?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 Oh I see my bug now, sizeof in Intel® Embree Ray Tracing Kernels</title>
    <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161253#M766</link>
    <description>&lt;P&gt;Oh I see my bug now,&amp;nbsp;&lt;STRONG&gt;sizeof(RTCRay)&lt;/STRONG&gt; should be&amp;nbsp;&lt;STRONG&gt;sizeof(RTCRayHit)&lt;/STRONG&gt;! Sorry for wasting your time, it is working now!&lt;/P&gt;</description>
    <pubDate>Thu, 28 Feb 2019 15:54:00 GMT</pubDate>
    <dc:creator>Burr__Adam</dc:creator>
    <dc:date>2019-02-28T15:54:00Z</dc:date>
    <item>
      <title>How is RTCRay::id set and what values to expect?</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161249#M762</link>
      <description>&lt;P&gt;I am trying to use&amp;nbsp;RTCIntersectContext::RTCFilterFunctionN with&amp;nbsp;rtcIntersect1M with per-ray data. I see this in the docs:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;callback functions may be invoked with an arbitrary packet size (of size 1, 4, 8, or 16) and different ordering as specified initially. For this reason, one may have to use the&amp;nbsp;rayID&amp;nbsp;component of the ray to identify the original ray, e.g. to access a per-ray payload.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;But it isn't&amp;nbsp;clear to me how&amp;nbsp;RTCRay::id is supposed to be set. I tried initializing the ray stream&amp;nbsp;with&amp;nbsp;consecutive ids (0 to stream size) but the ids returned by&amp;nbsp;RTCRayN_id contain many zeros, large out of range values. I'm probably missing something in the docs or tutorials but I can't figure out how it should work.&lt;/P&gt;&lt;P&gt;Let me know if you want to see any code.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 20:58:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161249#M762</guid>
      <dc:creator>Burr__Adam</dc:creator>
      <dc:date>2019-02-27T20:58:59Z</dc:date>
    </item>
    <item>
      <title>Just checked and we did not</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161250#M763</link>
      <description>&lt;P&gt;Just checked and we did not test that feature. We have the intersection_filter tutorial which used the ray.mask to pass an id. However, I just changed that tutorial to use the ray.id to pass the id, which works fine. Could you please try again. Also are the other ray components correct? Please note that inside the filter function you may get presented with ray packets, thus N may not be 1.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 06:28:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161250#M763</guid>
      <dc:creator>SvenW_Intel</dc:creator>
      <dc:date>2019-02-28T06:28:12Z</dc:date>
    </item>
    <item>
      <title>I was processing the packet</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161251#M764</link>
      <description>&lt;P&gt;I was processing the packet&amp;nbsp;but I wasn't checking the valid flag per ray, the large ids were coming from invalid rays in the packets.&lt;/P&gt;&lt;P&gt;Now the ids look a bit better now but still strange, some are valid but many are 0. I'll keep looking at it today and see if I can understand better what's going on.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 13:09:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161251#M764</guid>
      <dc:creator>Burr__Adam</dc:creator>
      <dc:date>2019-02-28T13:09:47Z</dc:date>
    </item>
    <item>
      <title>Using RTCRay::id in</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161252#M765</link>
      <description>&lt;P&gt;Using RTCRay::id in RTCIntersectContext::RTCFilterFunctionN&amp;nbsp;seems to work fine with&amp;nbsp;rtcIntersect1 but not with&amp;nbsp;rtcIntersect1M in my code.&lt;/P&gt;&lt;P&gt;Here is how I'm setting up the ray stream and filter:&lt;/P&gt;
&lt;PRE class="brush:; class-name:dark;"&gt;    RTCIntersectContext context;
    rtcInitIntersectContext (&amp;amp;context);
    context.flags = RTC_INTERSECT_CONTEXT_FLAG_COHERENT;
    context.filter = rayFilter;

    std::vector &amp;lt; RTCRayHit &amp;gt; rays (streamSize);

    for (uint i = 0; i &amp;lt; streamSize; ++i) {
        RTCRay&amp;amp; ray = rays&lt;I&gt;.ray;
        ray.org_x = cameraPoint.x;
        ray.org_y = cameraPoint.y;
        ray.org_z = cameraPoint.z;
        ray.tnear = 0.f;
        ray.dir_x = rayDirs&lt;I&gt;.x;
        ray.dir_y = rayDirs&lt;I&gt;.y;
        ray.dir_z = rayDirs&lt;I&gt;.z;
        ray.time = 0.f;
        ray.tfar = std::numeric_limits&amp;lt;float&amp;gt;::infinity ();
        ray.mask = 0;
        ray.id = i;
        ray.flags = 0;
    }&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;This is my simplified context filter function:&lt;/P&gt;

&lt;PRE class="brush:cpp; class-name:dark;"&gt;void rayFilter (const RTCFilterFunctionNArguments* args)
{
    // get context data:
    const IntersectContext* context =
            static_cast&amp;lt;const IntersectContext*&amp;gt; (args-&amp;gt;context);

    // iterate over packet:
    for (uint i = 0; i &amp;lt; args-&amp;gt;N; ++i) {
        if (args-&amp;gt;valid&lt;I&gt; == 0) {
            continue;
        }

        // this works in rtcIntersect1 but skips some ids
        //   and returns many zeros inside of rtcIntersect1M:
        const uint id = RTCRayN_id (args-&amp;gt;ray, args-&amp;gt;N, i);
    }
}
&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;Using&amp;nbsp;rtcIntersect1 works fine,&amp;nbsp;the ids work as expected in the filter function:&lt;/P&gt;

&lt;PRE class="brush:cpp; class-name:dark;"&gt;    for (uint i = 0; i &amp;lt; streamSize; ++i) {
        rtcIntersect1 (scene_, &amp;amp;context, &amp;amp;rays&lt;I&gt;);
    }&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;But without changing any other code, the filter seems to get bad ids when I use&amp;nbsp;rtcIntersect1M&amp;nbsp;instead:&lt;/P&gt;

&lt;PRE class="brush:cpp; class-name:dark;"&gt;    rtcIntersect1M (scene_, &amp;amp;context, rays.data(), streamSize, sizeof(RTCRay));&lt;/PRE&gt;

&lt;P&gt;Thanks again for all your help!&amp;nbsp;This is not a showstopper&amp;nbsp;problem for me,&amp;nbsp;I can use&amp;nbsp;rtcIntersect1 for now, it is fast enough.&amp;nbsp;I was just curious to try ray streaming.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 15:27:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161252#M765</guid>
      <dc:creator>Burr__Adam</dc:creator>
      <dc:date>2019-02-28T15:27:00Z</dc:date>
    </item>
    <item>
      <title>Oh I see my bug now, sizeof</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161253#M766</link>
      <description>&lt;P&gt;Oh I see my bug now,&amp;nbsp;&lt;STRONG&gt;sizeof(RTCRay)&lt;/STRONG&gt; should be&amp;nbsp;&lt;STRONG&gt;sizeof(RTCRayHit)&lt;/STRONG&gt;! Sorry for wasting your time, it is working now!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 15:54:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/How-is-RTCRay-id-set-and-what-values-to-expect/m-p/1161253#M766</guid>
      <dc:creator>Burr__Adam</dc:creator>
      <dc:date>2019-02-28T15:54:00Z</dc:date>
    </item>
  </channel>
</rss>

