OBJ File Different Formats

你。 提交于 2019-12-12 01:44:47

问题


I am working on my own java 3D Game Engine, everything is working perfectly fine BUT i allways get a mistake. I've found the error, but I've absolutely no idea how to solve this. I haved used Blender for creating my OBJ Files.

Here is an excample for one obj file.

v 0.500000 -0.500000 -0.500000
vt 0.748573 0.750412
vn -1.000000 -0.000000 -0.000000
f 5/1/1 4/3/1 8/4/1

These are the most relevant informations i need for drawing my objects on the screen.

But now, when i create my OBJ Files, my faces look like this:

f 2//1 3//2 4//3

my vertices, textureCoords and normals look like excatly the same, but my parser gets a problem when reading the faces.

My Parser is quit complex and i dont think it would help to copy it in here. I just need a way for converting my files from one type to the other. Is there anyway in Blender for telling it how to save my files ?

I would be very happy if someone could help me with this.

Greetings, Finn


回答1:


From wikipedia under face elements -

Faces are defined using lists of vertex, texture and normal indices.

the missing second element is the texture index, pointing to which vt line to use. To get this data in an obj export you need to unwrap the object to create the uv's and enable include UV's when exporting.



来源:https://stackoverflow.com/questions/35395840/obj-file-different-formats

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