What to do if a control point contains multiple UVs?

ltes50414
Explorer
Explorer

What to do if a control point contains multiple UVs?

ltes50414
Explorer
Explorer

Here is the code piece that I'm using for importing texture UV from FBX:

Noname.jpg

The "Result" is a vector which has the same size as control points.

I imagine the number of UVElement->GetDirectArray() should have the same number as control point.

So I wrote the loaded UV with control point index to the Result.

 

However here is the problem: The UV counts could be different than control point counts!

I realized the same control point index could have multiple UV values...

 

Do I simply sum the UVs and average them?

Or there is a way to get proper weight for blending the UVs?

None of official sample seems to mention this.

Many thanks!

0 Likes
Reply
Accepted solutions (1)
321 Views
1 Reply
Reply (1)

ltes50414
Explorer
Explorer
Accepted solution

Turns out it's caused by wrong index buffer in my code.

I found building indices with GetPolygonVertex() was wrong.

Instead, the index stored in UVElement->GetIndexArray() provides the proper indices!

 

This really surprises me, I thought GetControlPoints can be used for vertex buffer directly.

And I just built index buffer with GetPolygonVertex(). But I was wrong.

I need to get index array from UV element, and reconstruct a larger vertex buffer with some duplicate control points.

 

In my case, a mesh has 81 control points and the max value in GetPolygonVertex() is 80. However, the UV index can be up to 101 in the mesh. The mesh supposes to have 102 control points! I guess those duplicated points are "optimized" during export. But it's fine, I'll just construct my data based on index array of UV element.

0 Likes