How to import Magicalvoxel file into Xcode and use it - ios

I recently came across software called Magicalvoxel. It is pretty cool if I can import some object into my Swift game project. I searched on the Internet but I could not find any good resource, though there were some how to for Unity. In doing so, should I make a game project with SceneKit or Spritekit? I am not sure about how to achieve this.

You can use File > Export > obj and import exported geometry into Xcode.
And you should use SceneKit for such 3d objects.

Related

Import .FBX into android studio with no materials

I am new at ARcore, and I am learning it right now.
i am following a tutorial to build my first ARcore app.
Heres the link https://www.youtube.com/watch?v=2xkZUPUbgoM
this tutorial works very well, but when i try to add my custom fbx object in to my project, there is no material at all, just like this:
picture
but the fbx object in the tutorial works very fine and like this.
picture
i've been noticed that it will create a .fbm directory when i import sceneform asset. but i selected embed media when i export my obj in to .fbx at 3ds max, it should suppose with a material inside .fbx
i need help
the fbx file:
https://drive.google.com/open?id=173TislIayOSBTzuesVJXE81MeByy_aKF
I think your problem might be in the type of material.
The bear is usingenter image description here a standard material and you are using a generic

SceneKit SCNNode init(mdlObject:) missing?

I'm using Xcode 7.3.1, Swift 2.x, iOS target is 9.3. I can find convenience init init(MDLObject mdlObject: MDLObject) in Apple docs, but I don't see it in my project. I opened standard game project starter, SceneKit is imported. I've tried:
Double checking iOS version
Adding import ModelIO
Finding "mdlObject:" in header files in SceneKit.framework - not found
Looking for alternative methods (maybe Apple moved it somewhere) but there are no other inits with that parameter, no class function, nor I found any corresponding export function in MDLObject
Cleaning project...
I can see all SceneKit classes, and I can create MDLAsset (part of ModelIO, can return MDLObjects) instance.
Any ideas, maybe I've overlooked something obvious?
the following should do
import SceneKit.ModelIO

Use FBX file with 3D model in iOS native app

I have a requirement to display an interactive 3D model (the client supplies few FBX files) in one of the screens in a native Objective-C/Swift app.
I know that there's a possibility to work with Unity/Cocos3D but then the entire app will have to be Unity/Cocos3D based. In my case the app has to be native and only one screen (one of the tabs in the tab bar controller) should integrate the 3D model that the user can move/rotate etc.
Thanks.
The FBX SDK is available on iOS and I wrote a little tutorial to demo how to use it here. However, the FBX SDK does contain a viewport/canvas for displaying FBX file on any OS. For displaying FBX you would need to create your own view. There is couple of solutions you can use here:
without programming, you can use the 'FBX Review'. This tools is free and designed to display FBX, DAE, OBJ, ... files
you can implement your own viewport/view such as an obj view like I did here, but it would probably need to be rewritten. I wrote it overnight for a hack, so it needs to be optimized.
you use the iOS SceneKit library which would be a better approach than implementing your own view.
If you go with option 3 above, you can use Unity to export a Collada (.dae) file for importing into SceneKit thru the collada exporter. You can buy the exporter on the Unity Asset Store directly; there's one for Unity 5.x and one for Unity 2017.

How to convert Blender blend (or obj) file to Qualcom Vuforia .h file

I'm developing an iOS app with augmented reality using Qualcomm Vuforia and I have difficulty in understanding how to create 3D models from Blender (or other softwares). All the examples use .h files with the coordinates of the vertices to generate i.e. a teapot.
I can not find documentation useful for me.
Is there a tool to convert .blend or .obj files to .h (OpenGL ES)?
thanks
I developed a script called mtl2opengl that does exactly what you need, based on the project obj2opengl. The script works with .obj and .mtl files, which I think can be exported straight from Blender, and produces .h files with vertex data. I use it extensively in my iOS augmented reality applications (though I haven't used the Vuforia SDK yet) and the accompanying resources include a sample Xcode project too. Hope it helps!
You should check out BlenderVuforiaExport (developed by a coworker of mine) here:
https://github.com/StickyBeat/BlenderVuforiaExport
It exports objects from Blender to the same .h-format used in the Vuforia example project.
I don't know much about vufoia, but here are two answers about using blender to get 3d models and displaying them on iPhone. These may help you.
How to get proper number of vertices in OBJ file from DCC tools such as Blender for use in OpenGL ES?
Put a Cinema 4D model and Texture into an iPhone App

Loading 3D model in iOS

I'm creating a game application from scratch with xcode for iOS, and I've use the OpenGL Game projet template to create mine.
I've searched a lot in the past few days, but I can't find any tutorials or example as to how I would load 3D model (via .obj files) in my application. I've found some documentation on loading them onto an app with a console script, but I need to do it programmatically.
Any help would be very appreciated
Also, my 3D models are created using blender
The future will be here momentarily — SceneKit, available in OS X since v10.8, will be in iOS 8. It can build and render a scene with COLLADA (.DAE) models directly. No need for third-party tools or code, nothing complicated to learn.
Apple's documentation is pretty good but if you prefer then other tutorials are available.
OpensceneGraph has support for iOS and a lot of prebuilt code which can help you develop the game. It supports loading OBJ models.
I recommend to use an Engine (like isgl3d, nineveh, Cocos3D, ...) for creating a 3D game, it will be hard if you use Opengl for a start.
Note: you can search for a list of game engine to choose the suitable one for you game, cause there is a lot of game engine, open-source or paid engine.
You can download the zip file from here and then run ./obj2opengl.pl 3DModel.obj in terminal .It will give you 3DModel.h file as output.
You need to use glDrawArrays instead of glDrawElements as the .h file contains array.
Obj files are simple to parse and are well described on wikipedia. You should be able to load them in one or 2 hours. But if you want to load the materials you need to invest some more time in your engine and into loading the obj file.

Resources