计算平面UV坐标任意网格网格、坐标、平面、UV

由网友(是夜在熬我)分享简介:我有code,其产生的2D图形三角形网格。因为在大多数情况下,这些形状具有表面上的不均匀分布的顶点,我有一个问题,代UV的,这样它不会造成纹理变形。任何人都可以提出一些文章,书籍,code,它讲的UV计算在平面网格技术样本?谢谢I have code that generates triangle mesh fro...

我有code,其产生的2D图形三角形网格。因为在大多数情况下,这些形状具有表面上的不均匀分布的顶点,我有一个问题,代UV的,这样它不会造成纹理变形。任何人都可以提出一些文章,书籍,code,它讲的UV计算在平面网格技术样本? 谢谢

I have code that generates triangle mesh from 2d shapes. Because those shapes in most cases have uneven vertex distribution on the surface I have an issue with generation of UVs so that it wouldn't cause texture distortion. Anybody can suggest some articles, books, code samples that talk about techniques of UV calculation on planar meshes? Thanks

推荐答案

OK让我们看看,如果我理解你的问题。

ok lets see if I understood your question.

您有一个平面网格顶点(x_i,y_i,z_i),因为网格是平面的,你可以找到一个旋转导致与z_i = 0 来坐标 所以我会假设你的网也2D顶点(x_i,y_i) 第二,你有两个UV坐标的进你网嵌入平面的映射点。 让我们假设你有紫外线坐标(0,0)和映射(1,1) 即(0,0) - >(X_0,y_0)和(1,1) - >(X_1,Y_1)

然后就可以把所有的顶点-1 *(X_0,y_0),然后(0,0)映射到(0,0)的网格坐标系统和(1,1)映射到新坐标(X_1,Y_1') You have a planar mesh with vertices (x_i,y_i,z_i), since the mesh is planar you can find a rotation which leads to coordinates with z_i = 0 So I'll assume that your mesh is also 2D with vertices (x_i,y_i) Second, you have a mapping of two uv-coordinates to points in the plane into which you mesh is embedded. Lets assume you have a mapping for uv-coords (0,0) and (1,1) i.e. (0,0) -> (x_0, y_0) and (1,1) -> (x_1, y_1)

you can then translate all your vertices by -1*(x_0, y_0), then (0,0) maps to (0,0) on the meshes coord system and (1,1) maps to a new coord (x_1', y_1')

因此​​,对于您的网新COORDS任何一个顶点(x_i',y_i)相应的UV坐标是:(x_i'/ X_1,y_i/ Y_1')

So for any vertex in your mesh with new coords (x_i', y_i') the corresponding uv-coordinate is: (x_i' / x_1', y_i' / y_1')

希望有所帮助。

阅读全文

相关推荐

最新文章