rtcInterpolate0 with quad surfaces

rtcInterpolate0 with quad surfaces


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?




2 posts / 0 new

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:





Leave a Comment

Please sign in to add a comment. Not a member? Join today