Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set UV values ​​for vertices using SUGeometryInputRef #1025

Open
yuanningcz opened this issue Dec 24, 2024 · 3 comments
Open

How to set UV values ​​for vertices using SUGeometryInputRef #1025

yuanningcz opened this issue Dec 24, 2024 · 3 comments

Comments

@yuanningcz
Copy link

yuanningcz commented Dec 24, 2024

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?

@thomthom
Copy link
Member

thomthom commented Jan 6, 2025

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.

@yuanningcz
Copy link
Author

yuanningcz commented Jan 9, 2025

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.

@thomthom
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants