Closed learnerandtrainer closed 3 years ago
I guess what you want to do is to apply a UV texture over a mesh.
SharpGLTF allows you to set the UV coordinates of a vertex, provided you know how to calculate it.
What you want to do is UV Mapping
, or UV Unwrapping
... you probably need other libraries like UVAtlas or define your own algorythms to calculate the UVs before feeding them to SharpGLTF.
These are huge and complex topics, beyond the scope of SharpGLTF library, which is a 3D format import/export library, not a general geometry library.
Hi vpenades, As you said I want apply UV texture over a mesh. Actualy I have mapping cordinates that calculated by CreateTextureByUvVectore function ,and it mapped to triangle but when I looked to geometry completly , the texture repeats itself . I dont know there is any function or parameter , for mesh MetarialBuilder or any object , that to make wrap image to geometry completly There is any soultion like I said , Have you any opinion thanks
You can try to scale down the final UV by dividing it by 100.
Other than that, there is no "magic" parameter that makes the image to wrap the geometry completely.
The usual procedures to "wrap" a geometry with an image are Planar UV Mapping
, Spherical UV Mapping
, or more complex algorythms like Least Squares Conformal mapping
mixed with UV Atlas
, which is what's actually used to "wrapping a geometry with an image"
Your code looks like nothing of these, and in fact, using normals to calculate UVs seems wrong. I believe you think what you want to do is easy to do and there's some cheap trick you can use, but you really don't know how difficult it is.... that's why people use Blender and 3DSMax to do it.
Hi vpenades , I know it is so dificult but I thought it have been implemented because I saw below issue https://github.com/vpenades/SharpGLTF/issues/85
But you're setting the UVs, because I can see a texture showing up in you screenshot, so the problem is different.
You need to learn more about UV mapping to use the library correctly.
Hi, I have some triangles and pictures . I want to set textures on the geometries. But when i add triangles to mesh , images doesnt wrap to all geometry as you can see below. Have any opinion what woul be cause of it? Can any one help me?
My Code
Tringles And Some Vertex