OBJ文件不同的格式 [英] OBJ File Different Formats

查看:101
本文介绍了OBJ文件不同的格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用自己的Java 3D游戏引擎,但是一切正常,但是我总是会出错. 我已经找到了错误,但是我绝对不知道如何解决这个问题. 我曾经用Blender创建我的OBJ文件.

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.

这是一个obj文件的示例.

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.

但是现在,当我创建OBJ文件时,我的脸看起来像这样:

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

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

我的顶点,textureCoords和法线看起来完全一样,但是我的解析器在读取人脸时遇到了问题.

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

我的解析器非常复杂,我认为将其复制到此处不会有帮助. 我只需要一种将文件从一种类型转换为另一种类型的方法. 无论如何,Blender中是否有告诉它如何保存文件的文件?

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.

问候, 芬兰人

推荐答案

来自 Wikipedia 在面部元素下-

使用顶点,纹理和法向索引列表来定义面.

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

缺少的第二个元素是纹理索引,指向要使用的vt行.要在obj导出中获取此数据,您需要解开对象创建uv,并在导出时启用 include UV .

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.

这篇关于OBJ文件不同的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆