From e5c0bba74068d20a7f7b7040c8ea29aad4f50e59 Mon Sep 17 00:00:00 2001 From: daemyung jang Date: Mon, 19 Apr 2021 19:19:02 +0900 Subject: [PATCH] Summerize Chapter 2: 3D Models --- 02-3d-models/README.md | 19 +++++++++++++++++++ README.md | 1 + 2 files changed, 20 insertions(+) create mode 100644 02-3d-models/README.md diff --git a/02-3d-models/README.md b/02-3d-models/README.md new file mode 100644 index 0000000..3b712e0 --- /dev/null +++ b/02-3d-models/README.md @@ -0,0 +1,19 @@ +# Chapter 2: 3D Models + +As I read this book, I summarize what I think is wrong. If you think my comments are wrong then please let me know. We can dicuss more and update your opinion. + +## Metal coordinate system + +The book doesn't mention that The Metal NDC(Normalized Device Coordinate) system is the left-hand coordinate system. + +![](https://upload.wikimedia.org/wikipedia/commons/b/b2/3D_Cartesian_Coodinate_Handedness.jpg) + +To show the train, this book modified the model file itself. It's not bad but I believe that the model file should be remained to original. Instead of changing y position to -1, we can modify the vertex shader code like below and get the same result. + +``` +vertex float4 vertex_main(const VertexIn vertex_in [[ stage_in ]]) { + float4 position = vertex_in.position; + position.y -= 1.0; // lower y position by -1 + return position; +} +``` diff --git a/README.md b/README.md index dd86fe3..5e7f9ed 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ You can also download the source code from [here](https://store.raywenderlich.co ## Summarize * [Chapter 1: Hello, Metal!](https://github.com/daemyung/MetalByTutorials/tree/main/01-introduction-to-metal) + * [Chapter 2: 3D Models](https://github.com/daemyung/MetalByTutorials/tree/main/02-3d-models) ## Copyright