如何创建逼真的 .scn 文件? [英] How to create realistic .scn files?

查看:131
本文介绍了如何创建逼真的 .scn 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看看苹果示例 AR 应用,有许多逼真的物体(杯子、蜡烛等).然而,在 Xcode 上使用场景工具包编辑器很明显,这仅允许您创建基本对象.

Looking at the apple sample AR app, there are many realistic looking objects (cup, candle, etc). However working with the scene kit editor on Xcode it is clear that this only allows you to create basic objects.

我的问题是,可以使用什么软件/文件来创建逼真的 scn 对象?我确信有软件可以让您创建 3D 模型并将它们转换为 scn 文件.就是不知道用什么软件或者什么文件可以转成scn

My question is, what software/file can be used to create realistic scn objects? I'm sure that there is software that allows you to create 3D models and covert them to scn files. I just don't know which software to use or what files can be converted to scn

注意:我知道这个问题对于 Stackoverflow 指南来说可能过于模糊/宽泛.我只是不知道在哪里提出我的问题,这似乎是最好的地方

Note: I understand that this question may be too vague/broad for the Stackoverflow guidelines. I just don't know where to pose my question and this seems like the best place

推荐答案

为了让一些现有的模型可以使用,这就是我所做的……只是我所知道的基础知识.

To get some existing models to work with, here is what I did...just the basics that I know.

  1. 我去了 Turbosquid 并找到了适合我的 3D 模型.
  2. 确保它有 OBJ 文件.购买和下载.
  3. 接下来下载 Blender.导入您刚购买的 OBJ 文件.
  4. 导出 DAE 文件.
  5. 将 DAE 文件和任何纹理(png 文件)拖到项目中的 .scnassets 文件夹中.
  6. 单击 .scnassets 文件夹中的 DAE 模型.单击以选择场景图中的对象.
  7. 点击右上角的地球仪.
  8. 我单击了漫反射"并选择了我拖入的 PNG 之一以将其应用于模型
  1. I went to Turbosquid and found a 3D model that would work for me.
  2. Make sure it has the OBJ files. Buy and download.
  3. Next download Blender. Import the OBJ file you just bought.
  4. Export a DAE file.
  5. Drag the DAE files and any textures (png files) into the .scnassets folder in your project.
  6. Click on the DAE model in the .scnassets folder. Click to select the object in the Scene graph.
  7. Click the globe in the upper right.
  8. I clicked Diffuse and selected one of the PNGs I dragged in to apply it to the model

您也可以跳过 Blender 转换,只使用免费的在线 OBJ 到 DAE 转换工具之一.去谷歌上查询.并尝试在 Turbosquid 上购买一个便宜的 5 美元范围模型,它只有一个 OBJ 文件而不是很多其他零件.它们太大了,无论如何都会产生其他问题作为入门方法.

You can also skip the Blender conversion and just use one of the free online OBJ to DAE conversion tools. Google it. And try to buy a cheap $5 range model on Turbosquid that just has a OBJ file and not a lot of other piece parts. They are too big and create other issues as a starter approach anyway.

更新 在 Xcode 中观看了关于 Model IO 的 Apple WWDC 演示后,我现在看到您可以将 OBJ 文件放入您的 .scnassets 文件夹中.选择该文件,转到编辑器并选择转换为 SCN 文件.这也应该有效,但我还没有尝试过.值得尝试使用 OBJ 文件的副本.

Update After watching a Apple WWDC presentation on Model IO in Xcode, I now see that you could drop in a OBJ file into your .scnassets folder. Select that file, go to Editor and select Convert to SCN file. That should work also but I have not tried. Worth trying with a copy of your OBJ file.

2018 年 12 月更新:我一直在处理 3D 文件.以下是有关此问题的一些增量帮助.

Update December 2018: I've been working more with 3D files. Here is some incremental help on this issue.

尝试使用 MeshLab 导入您的 3D 模型并将其转换为 .DAE 文件.将 .DAE 文件拖到 Xcode 中的文件夹中.这就是您将要用于在您的应用程序中显示的内容.

Try using MeshLab to import your 3D model and convert it to a .DAE file. Drag the .DAE file into a folder in Xcode. That is what you are going to use to display in your app.

  1. http://www.meshlab.net/

如果您的源 3D 模型是 .OBJ 文件,则有两个相关文件应与 .OBJ 文件位于同一文件夹中.它们是 *.mtl 文件和 *.jpg 或 *.BMP 文件..mtl 文件可以用 TextEdit 打开.

If your source 3D model is a .OBJ file, there are two related files that should be in the same folder as the .OBJ file. These are a *.mtl file and a *.jpg or *.BMP file. The .mtl file can be opened with TextEdit.

打开并确保它有一行写着:map_Kd *.jpg..jpg 是环绕 3D 网格文件的纹理图像.我发现最好确保您的纹理文件是 .jpg 格式.如果不是,请将其更改为 .jpg 格式(例如,在预览中将其重新保存为 jpeg),然后编辑新的 .jpg 文件名的 .mtl 文件.

Open and make sure it has a line that says: map_Kd *.jpg. The .jpg is the texture image the wraps around the 3D mesh file. I've found that it is best to make sure your texture file is in .jpg format. If it isn't, change it to .jpg format (in Preview for example by resaving it as a jpeg) and then edit the .mtl file for the new .jpg file name.

我有一些 .bmp 格式的纹理文件,我刚刚转换为 .jpg,编辑了 .mtl 文件,结果很好.

I had some texture files that were .bmp and I just converted to .jpg, edited the .mtl file and I was good.

第二个问题是 .obj 文件中节点的名称..obj 文件也可以用 TextEdit 打开..obj 文件应引用同一文件夹中的 .mtl 文件.如果没有,你就有问题.

The second issue is the name of the node in the .obj file. The .obj file can also be opened with TextEdit. The .obj file should reference the .mtl file in the same folder. If not, you have a problem.

这是棘手的部分.当你在 SceneKit 场景中向 rootNode 添加 childNode 时,你必须填写withName:"文本名称.打开您从 .obj + .jpg + .mtl 制作的转换后的 .DAE 文件(导入 MeshLab 时使用了所有三个文件,但导出到 .DAE 后,只有 .DAE 文件),然后搜索节点身份证 = .它可能会说:node id="node".如果是这样,那么node"这个词是您在scene.rootNode.childNode(withName:"的"withName:"属性中为文本名称输入的childNode的名称node",递归地:true) 调用.

And here is the tricky part. When you are adding a childNode to the rootNode in a SceneKit scene, you have to fill in the "withName:" text name. Open the converted .DAE file that you have made from your .obj + .jpg + .mtl (all three are used when importing into MeshLab but after exporting to .DAE, there is only the .DAE file), and search for "node id =" . It might say: "node id="node". If so, the word "node" is the name of the childNode you enter for your text name in the "withName:" property of the scene.rootNode.childNode(withName: "node", recursively: true) call.

您可以将节点名称 ID 更改为 node(如果尚未更改).

You can change your node name ID to node if it isn't already.

希望这会有所帮助.许多小时的工作和其他人的帮助,以了解下一轮使用 3D 模型的工作.

Hope this helps. Many hours of work and help from others to understand this next round of working with 3D models.

这篇关于如何创建逼真的 .scn 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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