Home

Awesome

UPDATE

After finishing this try-out project I made Flappy bird colne with Metal, go check it out https://github.com/haawa799/Metal-Flaps

METAL_Playground

Task: Create complex 3D scene app using Apples new Metal framework, using Swift as much as possible.

NOTE1: Since I'm trying to use Swift where it's posiible, this code is not super efficient or fast, there are some wrappers which are not recommanded in this kind of projects.

Hope to improve it as new Xcode betas will come out.

NOTE:

  1. For now (Xcode 6 - beta2) requires -Ofast compiler flag to build.

  2. iOS 8 and device with A7 required! Doesn't work on simulator.

alt tag alt tag alt tag alt tag alt tag

Model importing script Obj_Convert.py

In part 5 i wrote simple python script which parse OBJ file (generated from Blender or any other 3D model tool) and produce Swift class and txt file.

Here are steps on how I used it to get that Ram rendered. Here's a link to free 3D model http://www.3dvia.com/models/67EC495D6F415365/ramiro-the-ram, thanks to dipsy.

  1. Put your OBJ and MTL file (generated from Blender) into one folder alt tag

  2. Make sure that both OBJ and MTL files have same name, and this name will be your Swift class name, in my case it's "ram.obj" and "ram.mtl"

  3. Put Obj_Convert.py file into same folder alt tag

  4. From terminal cd to your folder alt tag

  5. Run following command "python Obj_Convert.py name" name should be equal to .obj and .mtl file names in my case it's "ram" alt tag

  6. Check you folder, .swift and .txt files should be there, drag and drop them into your project alt tag alt tag

  7. Double check .swift file, wethere texture name is correct alt tag

  8. Use imported model as any other Model subclass inside your MetalViewController