<?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 UV encoding while sampling a Subdivision Mesh object? in Intel® Embree Ray Tracing Kernels</title>
    <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/UV-encoding-while-sampling-a-Subdivision-Mesh-object/m-p/1143776#M711</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Please I would like to know how are we supposed to generate the u,v coordinates when generating samples for a Subdivision Mesh object.&lt;/P&gt;

&lt;P&gt;There are algorithms to generate stratified samples for triangles and quads, but Embree Subdivision Mesh objects use special encoded u,v coordinates. When a ray hits a Subdivision Mesh, the ray u,v coordinates are already encoded and ready to be used in rtcInterpolate, but how can I manually generate stratified u,v coordinates myself that are correctly encoded to be used with rtcInterpolate in a subdivision mesh?&lt;/P&gt;

&lt;P&gt;Also, as now there is a new Embree v3-beta0 with a different API I would please like to know whether there is a different way to do this in Embree v3?&lt;/P&gt;

&lt;P&gt;Thanks and best regards!&lt;/P&gt;</description>
    <pubDate>Sat, 24 Feb 2018 06:27:53 GMT</pubDate>
    <dc:creator>David_B_3</dc:creator>
    <dc:date>2018-02-24T06:27:53Z</dc:date>
    <item>
      <title>UV encoding while sampling a Subdivision Mesh object?</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/UV-encoding-while-sampling-a-Subdivision-Mesh-object/m-p/1143776#M711</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Please I would like to know how are we supposed to generate the u,v coordinates when generating samples for a Subdivision Mesh object.&lt;/P&gt;

&lt;P&gt;There are algorithms to generate stratified samples for triangles and quads, but Embree Subdivision Mesh objects use special encoded u,v coordinates. When a ray hits a Subdivision Mesh, the ray u,v coordinates are already encoded and ready to be used in rtcInterpolate, but how can I manually generate stratified u,v coordinates myself that are correctly encoded to be used with rtcInterpolate in a subdivision mesh?&lt;/P&gt;

&lt;P&gt;Also, as now there is a new Embree v3-beta0 with a different API I would please like to know whether there is a different way to do this in Embree v3?&lt;/P&gt;

&lt;P&gt;Thanks and best regards!&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2018 06:27:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/UV-encoding-while-sampling-a-Subdivision-Mesh-object/m-p/1143776#M711</guid>
      <dc:creator>David_B_3</dc:creator>
      <dc:date>2018-02-24T06:27:53Z</dc:date>
    </item>
    <item>
      <title>For quadrilateral faces the</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/UV-encoding-while-sampling-a-Subdivision-Mesh-object/m-p/1143777#M712</link>
      <description>&lt;P&gt;For quadrilateral faces the UV encoding is standard. For other faces (e.g. triangles), the subdivision surfaces section of the API describes the decoding of the UV coordinates:&lt;/P&gt;

&lt;P&gt;const unsigned int l = floorf(0.5f*U);&lt;/P&gt;

&lt;P&gt;const unsigned int h = floorf(0.5f*V);&lt;/P&gt;

&lt;P&gt;const unsigned int i = 4*h+l;&lt;/P&gt;

&lt;P&gt;const float u = 2.0f*fracf(0.5f*U)-0.5f;&lt;/P&gt;

&lt;P&gt;const float v = 2.0f*fracf(0.5f*V)-0.5f;&lt;/P&gt;

&lt;P&gt;Here i, is the i'th quadrilateral you get when doing a Catmull Clark subdivision step and u/v are the local hit coordinates of&amp;nbsp;this quadrilateral. This encoding did not change with Embree 3.&lt;/P&gt;

&lt;P&gt;Note that the 3 quadrilateral you get after subdividing a triangle using the Catmull Clark rules have same area. Thus you can just uniformly sample a random quadrilateral i, and then uniformly sample the local u/v coordinates. Then you need to invert the above decoding to encode the uv's and pass them to rtcInterpolate:&lt;/P&gt;

&lt;P&gt;const unsigned int h = (i &amp;gt;&amp;gt;2) &amp;amp; 3;&lt;/P&gt;

&lt;P&gt;const unsigned int l = i &amp;amp; 3;&lt;/P&gt;

&lt;P&gt;const float U = 2.0f*l + 0.5f*u;&lt;/P&gt;

&lt;P&gt;const float V&amp;nbsp;= 2.0f*h + 0.5f*v;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 06:51:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/UV-encoding-while-sampling-a-Subdivision-Mesh-object/m-p/1143777#M712</guid>
      <dc:creator>SvenW_Intel</dc:creator>
      <dc:date>2018-02-26T06:51:35Z</dc:date>
    </item>
    <item>
      <title>Hello, Sven.</title>
      <link>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/UV-encoding-while-sampling-a-Subdivision-Mesh-object/m-p/1143778#M713</link>
      <description>&lt;P&gt;Hello, Sven.&lt;/P&gt;

&lt;P&gt;That's great, thank you very much, I will try that! :-)&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 20:26:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Embree-Ray-Tracing-Kernels/UV-encoding-while-sampling-a-Subdivision-Mesh-object/m-p/1143778#M713</guid>
      <dc:creator>David_B_3</dc:creator>
      <dc:date>2018-02-26T20:26:31Z</dc:date>
    </item>
  </channel>
</rss>

