How to create realistic .scn files?

风流意气都作罢 提交于 2019-12-03 01:41:35

问题


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.

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

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


回答1:


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

  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

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.

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.

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

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/

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.

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.

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

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.

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.

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

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




回答2:


Xcode's SceneKit editor isn't a 3D art authoring package — just like its SpriteKit editor and Interface Builder components aren't equivalent to the likes of Photoshop, Illustrator, Pixelmator, Affinity Designer, etc. To create 3D art assets yourself, you'll need to learn Blender, Maya, 3DS Max, or one of the other major 3D authoring tools. Beware, the learning curve to becoming a 3D artist is a bit steeper than learning how to paint in 2D.

What the SceneKit editor is for is taking the output from a 3D artist and preparing or combining it for use in a SceneKit-based app or game — tweaking material definitions so they look right with SceneKit's renderer, arranging separate assets to create a game level or other scene, adding dynamic SceneKit-specific features like particle effects and physics, etc.

You bridge between these two worlds by exporting assets from your 3D art tools in one of the formats SceneKit can import. Digital Asset Exchange (.dae) is one of the best options here, but through SceneKit's lower level counterpart, Model I/O, you can also import other formats like OBJ or Pixar USD.

When you open those in Xcode, you get the SceneKit editor, so you can start marking SceneKit-specific edits and save the results for use in your app as .scn files.


There are a few things you can do in the process of authoring and prepping 3D assets that makes them look more realistic in ARKit. The ARKit session from WWDC (and the ReadMe file in the sample code project attached to that session) includes a few such tips:

  • use physically based materials
  • "bake" ambient occlusion and other static lighting effects
    • add invisible shadow planes



回答3:


You can create your realistic 3D models in .DAE format which is supported by many tools. Then in Xcode, you can convert that .DAE file to .SCN format. For conversion, check this

How to convert .DAE to .SCN




回答4:


The best way to make realistic 3d models is to use the any of following software packages:

Autodesk Maya, Autodesk 3DS Max, Maxon Cinema 4D, The Foundry Modo, or Blender.

These 3D authoring tools allow you create Polygonal and NURBS geometry. But any realistic 3D objects needs not only ideal shape but also a perfect texture. So, each aforementioned package contains its own UV Texture Editor allowing you to interactively view, place and edit objects' textures. In UV Texture Editor you can select, move, scale, and generally modify the UV topology for a surface very much like you work with other modeling tools. You can also view the image associated with the assigned texture map as a backdrop within such a UV Texture Editor and modify the UV layout to match as required.

Shader, what belongs to the 3D surface of your object, may contain many different textures (usually in jpeg, png, or tiff). These textures are: diffuse color, transparency, roughness, bump, metalness, reflectivity, refractivity, specularity, translucency, etc. These textures make 3D object look realistic. Look at the picture below, there are 28 render passes, some of them can be textures in slots of shading material:

Here you can find Maya modeling courses by Pluralsight.

Here you can find Maya shading and texturing course.

I personally prefer Autodesk Maya. It has modular system for plug-ins and a variety of input and output 2D and 3D formats. Here's awesome example of virtual 3D car in a real environment:

When your 3D model and textures are ready for export you need to save .DAE file in Maya.

In Xcode just create the new .SCN file in the .scnassets folder, and then drag this .DAE file into the scene.

Or you can use in iOS 12 in Xcode 10 brand new .USDZ file format from Pixar. Just drag-and-drop it in your SCENE.



来源:https://stackoverflow.com/questions/44814390/how-to-create-realistic-scn-files

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