Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Visual Computing (Graphics and Gaming)
- Intel® Embree Ray Tracing Kernels
- UV encoding while sampling a Subdivision Mesh object?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

David_B_3

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-23-2018
10:27 PM

64 Views

UV encoding while sampling a Subdivision Mesh object?

Hello,

Please I would like to know how are we supposed to generate the u,v coordinates when generating samples for a Subdivision Mesh object.

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?

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?

Thanks and best regards!

Link Copied

2 Replies

SvenW_Intel

Moderator

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-25-2018
10:51 PM

64 Views

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:

const unsigned int l = floorf(0.5f*U);

const unsigned int h = floorf(0.5f*V);

const unsigned int i = 4*h+l;

const float u = 2.0f*fracf(0.5f*U)-0.5f;

const float v = 2.0f*fracf(0.5f*V)-0.5f;

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 this quadrilateral. This encoding did not change with Embree 3.

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:

const unsigned int h = (i >>2) & 3;

const unsigned int l = i & 3;

const float U = 2.0f*l + 0.5f*u;

const float V = 2.0f*h + 0.5f*v;

David_B_3

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-26-2018
12:26 PM

64 Views

Hello, Sven.

That's great, thank you very much, I will try that! :-)

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.