【发布时间】:2023-02-25 05:28:24
【问题描述】:
每个人
我正在研究太阳系行星的 3D 可视化。当我要应用纹理时,我手动计算了纹理坐标 (texcoords),并得到 the zig-zag artefact as appears in the image。
我相信我的计算可能有问题。我附上了下面的texcoords计算
# Compute Texture Coordinates
def get_texcoords(vertices):
texcoords = []
for v in vertices:
#thresholding
for i in range(3):
if np.abs(v[i]) > 1e-6:
v[i] = v[i]
elif np.abs(v[i]) < 1e-6:
v[i] = 0.0
# Compute position in uv-space
radius = np.sqrt(v[0]**2 + v[1]**2 + v[2]**2)
latitude = np.arcsin(v[2]/radius)
longitude = np.arctan2(v[1],v[0])
# Convert to texture coordinates
u = round(0.5 + longitude/(2*np.pi),5)
v = round(0.5 + latitude/np.pi,5)
texcoords.append([u,v])
return np.array(texcoords)
有什么方法可以消除这些人工制品,或者它有更聪明的方法来获取 vispy 中的纹理坐标。
感谢您的帮助和建议。
【问题讨论】: