How to set UV values for vertices using SUGeometryInputRef
I created a surface through SUGeometryInputAddFace. The code is as follows:
SUGeometryInputRef input = SU_INVALID;
SUGeometryInputCreate(&input);
size_t face_index;
int count = polygon.size();
SUPoint3D* points = new SUPoint3D[count];
SULoopInputRef loop = SU_INVALID;
SULoopInputCreate(&loop);
for(size_t i=0; i < count; i++){
SUGeometryInputAddVertex(input, &points[i]);
SULoopInputAddVertexIndex(loop, i);
}
SUResult addFace = SUGeometryInputAddFace(input, &loop, &face_index);
This face has no material. The material is on its parent, a group. I want to set a UV value for each vertex of this face. How can I set it?
If the material is not set on the face directly then you cannot set UVs on the face. When the material is coming from a parent group/component then all you get is default UV coordinates.
Let me ask it in another way.
I read a cylinder without material from my system. After writing it into SU, I assigned a material to the cylinder's parent, which is a group. I found that the material on the side of the cylinder was deformed.
But since the material is not on the surface, I can't modify the UV value of the side.
I have no way to solve this problem. test_export.zip
Here is my .skp file for your reference.
You can only assign UVs to a face when you apply the material to the face itself. Placing the material on a parent group/component will not let you add UV coordinates.