Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
28 Views

variable interpolation in subdivs

Hi,

I'm currently trying to figure out how to go about the interpolation of per-face-point variables in subdivision surfaces. My input data consists of 3, 4 and 5 side faces describing the polygon cage. Because my data is not per vertex, I understand this prevents me from using the rtInterpolate2 function with a user vertex buffer, and instead I'm looking at the sample code in the pathtracer tutorial (getTextureCoordinatesSubdivMesh) handling the first two cases.

So far so good, however I'm a bit confused about how to interpret the UV information on non-quadrilaterals - I understand from the docs that we can unpack the barycentric coordinates into subpatch index and per-patch-uv. Since the subdivision of the input N-gon will produce quads, am I right to understand that we would then have to figure out the quad resulting from the subpatch our evaluated point lies in, and from there on revert to the bilinear interpolation by manually generating the additional interpolated vertices? sounds like this could get complicated quickly when considering creases and edges, so I was wondering if perhaps I'm missing something out and there's an alternative method.

Thanks in advance for your help

0 Kudos
2 Replies
Highlighted
Moderator
28 Views

You would have to generate a second structurally compatible subdivision mesh and use that for interpolation only. The interpolate tutorial show an example of this. In this second subdivision mesh, you would set the index buffer to the indices of the per-face vertex data, and the RTC_USER_VERTEX_BUFFER0 to the data to interpolate. When you hit the subdivision mesh, you can use this second mesh with the rtcInterpolate function to get the proper result.

0 Kudos
Highlighted
Beginner
28 Views

Thanks Sven, that gives me something to look into.

0 Kudos