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
Screen Shot 2022-06-06 at 23.47.24

In code:
Screen Shot 2022-06-06 at 23.50.00 1

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.
Screen Shot 2022-06-07 at 18.11.55

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

Hello,

I came to the forum to ask a very similar question as the original author. Although this post is 2 years old now, I am new to graphics programming and Apple in general.

Currently I am finding it overwhelming, like the original author mentioned I don’t think it helps with the amount of different classes/structs all starting with M for some reason my brain has a hard time figuring out which framework the class/struct is from.

The information from this post has helped me, I may need to go over some of the chapters again. Currently on chapter 4 (The Vertex Function). The programmable stages seem to make the most sense to me so far, but that might be due to me having a very small amount of experience with WebGL.

1 Like