Calculating UV coordinates during mesh extrusion

纵然是瞬间 提交于 2019-12-11 05:05:12

问题


I'm currently implementing a mesh extrusion algorithm for plane shapes, let's assume for a rectangle.

When I extrude this rectangle I create four new sides (resulting in 8 new triangles) and a new bottom for the 3d shape.

This works fine when I duplicate all vertices so that my final cube has 24 of them. But I'd like to avoid these extra vertices now so that I have only 8 vertices. Unfortunately, in this case I do not know how to calculate the UV coordinates and I keep getting wrong results as shown in the image below.

The correct result would look like this (with duplicated faces):

My first question is: Is it possible to generate a good uv map with just 8 vertices (and hence 8 uv coordinates) for a cube?

Second is: How? :)

Thanks for your help.

来源:https://stackoverflow.com/questions/50293056/calculating-uv-coordinates-during-mesh-extrusion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!