使用 min3D 在 Android 上渲染导出的 3D 对象

发布于 2025-01-05 02:22:31 字数 810 浏览 0 评论 0原文

我正在为 Android 创建一款自行车赛车游戏。我计划在 Blender 中创建模型,将它们导出为 .obj 格式,然后在设备上渲染它们。我正在使用 min3D 框架来进行 obj 解析和渲染。我按照 此页面用于解析 obj 文件并将其呈现在屏幕上。当我尝试像立方体这样的简单对象时,一切正常,并且在屏幕上完美呈现。但是当我尝试加载从网上下载的简单自行车模型时,它不起作用。该应用程序崩溃了,我强行停止它。当我看到 LogCat 时,它要么是 java.lang.NumberFormatException,要么是 java.lang.NullPointerException,或者是 parse() 方法内的资源未找到异常。我不知道为什么会发生这种情况。

我对可能哪里出了问题有以下疑问:

1)根据给定的教程,我将文件名从.obj和.mtl更改为_obj和_mtl。但 obj 文件中有一行具有 .mtl 文件的名称。我把它改成了_mtl。但它仍然不起作用。我需要在其他地方做类似的事情吗?我需要以任何方式修改任何文件吗?

2) 有时我发现在 Blender 2.49 中创建的模型被解析和渲染,但在 Blender 2.6 中创建的模型却导致了这个问题。 min3D 也是在旧版本的 Blender 中创建的。那么我应该只使用 Blender 2.49 来创建模型并渲染它们吗?

PS:我对图形完全陌生,所以我为此奋斗了很多,但没有放弃。任何帮助将不胜感激。 :)

I'm creating a bike racing game for Android. I am planning to create models in Blender, export them to .obj format and then render them on the device. I'm using the min3D framework to do the obj parsing and rendering. I followed the tutorial in this page for parsing the obj file and to render it on the screen. When I tried simple object like a cube, everything works fine and it is rendered perfectly on the screen. But when I tried to load a simple bike model I downloaded from the web, it doesn't work. The app crashes and I force stop it. When I saw LogCat, it was either a java.lang.NumberFormatException, or java.lang.NullPointerException or a resource not found exception inside the parse() method. I have no clue why this happens.

I have the following doubts about where it possibly could have gone wrong:

1) According to the given tutorial, I changed the file names from .obj and .mtl to _obj and _mtl. But there was a line in the obj file that has the name of the .mtl file. I changed it to _mtl. Still it dint work. Is there something similar I need to do anywhere else? Do I need to modify any of the files in any way?

2) Sometimes I find that models created in Blender 2.49 are parsed and rendered but the models created in Blender 2.6 are causing this trouble. Also min3D was created during the older versions of Blender. So should I use only Blender 2.49 for creating the models and rendering them?

P.S: I'm completely new to graphics so I'm fighting a lot with this without giving up. Any help would be greatly appreciated. :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

勿忘心安 2025-01-12 02:22:31

我相信这是因为缺少纹理。您是否将纹理图像复制到 res/drawable 文件夹中?

I believe this is because of missing Texture. Did you copy the texture image into res/drawable folder?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文