api-issue-tracker icon indicating copy to clipboard operation
api-issue-tracker copied to clipboard

How to set UV values ​​for vertices using SUGeometryInputRef

Open yuanningcz opened this issue 1 year ago • 3 comments

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?

yuanningcz avatar Dec 24 '24 12:12 yuanningcz

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.

thomthom avatar Jan 06 '25 15:01 thomthom

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.

image

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.

yuanningcz avatar Jan 09 '25 07:01 yuanningcz

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.

thomthom avatar Jan 10 '25 14:01 thomthom