问题描述
我有一组产品的 3D CAD 文件.我想创建一个查看器,以便用户可以在 3D 中自由旋转对象.
I have a 3D CAD file of a set of products. I want to create a viewer so that the user can freely rotate the object in 3D.
我最好怎么做?
1) 我曾想过在图像周围每 30 度导出一系列 360 度图像,但每个产品大约需要 360 个图像.然后正确处理处理对象旋转所需的矩阵的代码.看起来非常过分,但可行.
1) I had thought about exporting a series of 360 degree images every 30 degrees around the image, but that would be around 360 images per product. Then right the code to handle the matrix that would be required to handle rotation of the object. Seems very excessive, but doable.
2) OpenGL - 不过我从来没有用它做过任何 3d 动画.
2) OpenGL - I have never done any 3d animation using this, though.
如果有帮助,我们正在使用 LightWave 3D.
We are using LightWave 3D, if that helps.
推荐答案
我建议采用 3-D 渲染路线,即使它可能需要比多切片图像方法更多的前期工作.从长远来看,它将提供更大的灵活性,我认为您最终将能够产生更令人愉悦的体验(小应用程序二进制大小、更平滑的旋转等).此外,一旦您完成了显示代码,您就可以将任意模型添加到您开始使用的模型中,并更轻松地对这些模型进行调整.
I'd recommend going with the 3-D rendering route, even though it might require more upfront work than the multiple sliced images approach. It will provide much greater flexibility over the long run, and I think you'll be able to generate a more pleasing experience in the end (small application binary size, smoother rotation, etc.). Also, once you have the display code done, you'll be able to pull in arbitrary models to add on to the ones you started with, and make tweaks to those models more easily.
这个问题 指出了多种方法,您可以将 LightWave 模型导入 OpenGL ES 应用程序可用的格式.看起来您可能需要通过 Blender 或其他中介才能完成此操作.
This question points out a number of ways that you might be able to import LightWave models into formats usable by an OpenGL ES application. It looks like you'll probably need to pass through Blender or another intermediary to accomplish this.
一旦您拥有可以使用的形式的模型,您就可以构建几个适用于 iPhone/iPad 的开源 3-D 渲染应用程序,例如我的 分子 应用程序.我的应用程序是为显示 3-D 分子结构而构建的,但人们对其进行了修改以支持根据自己的需要渲染其他模型,所以我知道这是可能的.我在 我在 iTunes U 上的课程.
Once you have the model in a form that you can work with, you can build off of several open source 3-D rendering applications for the iPhone / iPad, such as my Molecules application. My application is built for displaying 3-D molecular structures, but people have modified it to support rendering other models for their own needs, so I know that's possible. I go into detail on how this application works in the video for the OpenGL ES session of my class on iTunes U.
OpenGL ES 一开始可能看起来很吓人,但我只花了三个星期的晚上和周末的开发时间来构建 Molecules 的初始版本,并且在开始该项目之前我没有真正的 OpenGL 经验.现在有很多很棒的资源,所以入门比以往任何时候都容易.
OpenGL ES may seem intimidating at first, but it only took me three weeks of nights-and-weekends development to build the initial version of Molecules, and I had no real OpenGL experience before starting that project. There are many great resources out there now, so it's easier than ever to get started.
这篇关于对象的 3D 自由旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!