Doubtful and confused with the framework used in the Ebook

I’m a newbie in the field of iOS in general and graphics in particular.
I’m really hard to find the answer:

  1. What is difference between Model I/O & MetalKit & Metal ?
  2. Forced me to combine all the above classes to write code ?
  3. Is there a way to easily visualize in each pipeline which class should I use ? (such a hierarchical tree)

Thanks for the knowledge you gave me, I’m in chapter 8: Textures (Ver 3.0). And I realized I learned a lot. But i’m really confused with each framework being used in the lesson

In code:

Hope you help me more.

Hi @nghiaphamsg and welcome to the forums :slight_smile: !

  1. Metal was the original framework when Metal first came out in 2014. The next year, Apple added MetalKit, which simply adds extra functionality to make Metal easier to use - for example MTKView is a MetalKit view that subclasses UIView. Model I/O however, is not specific to Metal - SceneKit uses it too. It’s for managing 3D assets, importing and exporting etc.

Where you show the text saying “it’s your engine”, that means that you could generate MTLBuffers that render vertices without using the convenient MetalKit methods or loading through Model I/O.

You can see what’s in each framework by looking at the Apple documentation:

Apple have recently updated the documentation pages for WWDC 2022, so the documentation is much easier to read, with all the items listed down the left.

  1. Yes, you would generally use all the above classes, depending on what you want to do. If you don’t do anything with models, then you won’t need to use Model I/O though.

  2. Not really. You initialise the app with MTLDevice, MTLCommandQueue. Each frame you create an MTLCommandBuffer and one or more MTLRenderCommandEncoders. Each render command encoder is a render pass, in which you might have multiple MTLRenderPipelineStates where you present MTLTextures and MTLBuffers to the GPU.

There’s a lot to get your head around, and I would recommend you do the early chapters several times, until you’re familiar with the above objects all of which you would use in any rendering situation. I would recommend especially redoing chapter 1, which has a basic overview of 3D rendering.

2 Likes

Thanks for the reply, it made me understand better
while I was posting this stupid question I found your lecture on youtube.

It really helped me restructure the content from chapter 1 to now.
You’re right. I need to watch it over and over again.
The Apple documentation is also very detailed, I understood better.
The code I posted above may be because I don’t understand all the method.

by the way I want to ask, will you continue to update Metal 3 after WWDC 2022 ?
Thank you very much

1 Like

We generally strive to update the books annually. Metal by Tutorials V3 came out a couple of months ago, and I haven’t yet seen anything at WWDC that makes the book out of date. Metal 3 has some great new features, but they aren’t for beginner Metallists.

1 Like