Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPU(s)

rtcInterpolate0 with quad surfaces

Aguerre__Jose
Beginner
873 Views

Hi,

I am trying to get the color of a point inside a quad using rtcInterpolate0. I took the code from the "interpolation" example: 

               rtcSetGeometryVertexAttributeCount(quadGeom, 1);
               rtcSetSharedGeometryBuffer(quadGeom, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 0, RTC_FORMAT_FLOAT3, vertices_color.data(), 0, sizeof(glm::vec3), vertices_color.size());

               (.....)

                glm::vec3 color(0.0f, 0.0f, 0.0f);
                unsigned int gID = query.hit.geomID;
                unsigned int pID = query.hit.primID;
                float u = query.hit.u;
                float v = query.hit.v;

                {
                rtcInterpolate0(rtcGetGeometry(eScene, gID), pID, u, v, RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE, 0, &color.x, 3);
                }

The results I'm getting are correct, but I don't understand what are the u and v values supposed to represent. With triangles, I guess they are barycentric coordinates, but with quads these coordinates do not exist. Is embree dividing each quad into 2 triangles?

Thanks,

Jose

 

0 Kudos
1 Reply
BenthinC_Intel
Employee
873 Views

Hi Jose,

 

Embree is handling a quad as two triangles. Please have a look at the RTC_GEOMETRY_TYPE_QUAD section in the Embree documentation:

https://www.embree.org/api.html#rtc_geometry_type_quad

 

 

 

0 Kudos
Reply