# Metal by Tutorials

**URL:** https://forums.kodeco.com/c/books/metal-by-tutorials/44.md?page=11

[Latest](https://forums.kodeco.com/latest.md) · [Categories](https://forums.kodeco.com/categories.md) · [Tags](https://forums.kodeco.com/tags.md)

**Page:** 12

---

## [Chapter 15 rendering artifacts](https://forums.kodeco.com/t/chapter-15-rendering-artifacts/60654)

<div class="topic-metadata">

**Author:** [@bpashch](https://forums.kodeco.com/u/bpashch)\
**Replies:** 4\
**Last updated:** [January 27, 2019, 5:06am UTC](https://forums.kodeco.com/t/chapter-15-rendering-artifacts/60654 "2019-01-27T05:06:49Z")

</div>

I’m getting these artifacts when running Chapter 15 provided final project on late 2013 rMBP 15" (GT 750m GPU) Any ideas why this might be happening?

---

## [CH14: Build GBuffer Pass Descriptor](https://forums.kodeco.com/t/ch14-build-gbuffer-pass-descriptor/60376)

<div class="topic-metadata">

**Author:** [@mjeragh](https://forums.kodeco.com/u/mjeragh)\
**Replies:** 1\
**Last updated:** [January 22, 2019, 2:07pm UTC](https://forums.kodeco.com/t/ch14-build-gbuffer-pass-descriptor/60376 "2019-01-22T14:07:18Z")

</div>

After adding all the code up to page 404 I get this error when executing on a iMac retina screen \[MTLDebugBlitCommandEncoder validateCopyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationS…

---

## [Ch 14 - G-buffer](https://forums.kodeco.com/t/ch-14-g-buffer/60176)

<div class="topic-metadata">

**Author:** [@danielloriaux](https://forums.kodeco.com/u/danielloriaux)\
**Replies:** 3\
**Last updated:** [January 20, 2019, 10:55am UTC](https://forums.kodeco.com/t/ch-14-g-buffer/60176 "2019-01-20T10:55:41Z")

</div>

Hi all, I have a question about the G-buffer. The concept of it is understood and I even got it to work on another project of mine. However, the book only covers one shader (excluding the composition), which creates the…

---

## [Chapter 2 - Challenge Rotating the mushroom](https://forums.kodeco.com/t/chapter-2-challenge-rotating-the-mushroom/58714)

<div class="topic-metadata">

**Author:** [@izzywizz](https://forums.kodeco.com/u/izzywizz)\
**Replies:** 2\
**Last updated:** [January 1, 2019, 6:53pm UTC](https://forums.kodeco.com/t/chapter-2-challenge-rotating-the-mushroom/58714 "2019-01-01T18:53:32Z")

</div>

Hia👋 Awesome tutorials btw. I was attempting the challenge for chapter 2 and managed to reposition the mushroom just about using Euler values from the SceneKit node inspector (I didn’t do the blender mushroom tutorial,…

---

## [Chapter 8 importing my own glTF models](https://forums.kodeco.com/t/chapter-8-importing-my-own-gltf-models/55720)

<div class="topic-metadata">

**Author:** [@harrymorris](https://forums.kodeco.com/u/harrymorris)\
**Replies:** 6\
**Last updated:** [December 15, 2018, 11:58pm UTC](https://forums.kodeco.com/t/chapter-8-importing-my-own-gltf-models/55720 "2018-12-15T23:58:56Z")

</div>

Hey I’m loving your book. I’ve just finished chapter 8 and wanted to import some of my glTFs which I have exported from blender. But the program won’t run. On line 767 in GLFTAsset.swift, I am getting a Fatal error sayin…

---

## [Ch 4: MathLibrary](https://forums.kodeco.com/t/ch-4-mathlibrary/57293)

<div class="topic-metadata">

**Author:** [@kwakita](https://forums.kodeco.com/u/kwakita)\
**Replies:** 3\
**Last updated:** [December 14, 2018, 9:28am UTC](https://forums.kodeco.com/t/ch-4-mathlibrary/57293 "2018-12-14T09:28:57Z")

</div>

I think I found a bug in init(eye:, center:, up:) of MathLibrary.swift. It says let W = float4(w.x, w.y, x.z, 1) but the third argument should be w.z rather than x.z. This fix alone seems not address the look-at tran…

---

## [Chapter 21 Intersection buffer hack scares me](https://forums.kodeco.com/t/chapter-21-intersection-buffer-hack-scares-me/56564)

<div class="topic-metadata">

**Author:** [@cocheret](https://forums.kodeco.com/u/cocheret)\
**Replies:** 2\
**Last updated:** [November 29, 2018, 9:41am UTC](https://forums.kodeco.com/t/chapter-21-intersection-buffer-hack-scares-me/56564 "2018-11-29T09:41:30Z")

</div>

In the Raytracing shadeKernel the intersectionBuffer (Swift name for the MTLBuffer) is passed in as pointer to an array of Intersection structs: kernel void shadeKernel(uint2 tid \[\[ thread\_position\_in\_grid\]\], …

---

## [Chapter 21 Shader Attributes](https://forums.kodeco.com/t/chapter-21-shader-attributes/56558)

<div class="topic-metadata">

**Author:** [@cocheret](https://forums.kodeco.com/u/cocheret)\
**Replies:** 2\
**Last updated:** [November 29, 2018, 6:34am UTC](https://forums.kodeco.com/t/chapter-21-shader-attributes/56558 "2018-11-29T06:34:26Z")

</div>

In Chapter 21 when writing the shaders for the ray tracer it seems, for the first time in the book, the arguments to the shaders are not being qualified with attributes. E.g. kernel void accumulateKernel(constant Unifor…

---

## [Chapter 11 compute pass](https://forums.kodeco.com/t/chapter-11-compute-pass/56386)

<div class="topic-metadata">

**Author:** [@octavo](https://forums.kodeco.com/u/octavo)\
**Replies:** 1\
**Last updated:** [November 27, 2018, 11:17am UTC](https://forums.kodeco.com/t/chapter-11-compute-pass/56386 "2018-11-27T11:17:07Z")

</div>

Hello, in kernel function tessellation\_main, i don’t see any boundary check on pid. But it looks like the thread grid size (threadgroupsPerGrid \* threadsPerThreadgroup) doesn’t match the data size (tessellation factors b…

---

## [Chapter 7 hangs GPU on iOS](https://forums.kodeco.com/t/chapter-7-hangs-gpu-on-ios/56243)

<div class="topic-metadata">

**Author:** [@fuhunter](https://forums.kodeco.com/u/fuhunter)\
**Replies:** 2\
**Last updated:** [November 27, 2018, 9:06am UTC](https://forums.kodeco.com/t/chapter-7-hangs-gpu-on-ios/56243 "2018-11-27T09:06:24Z")

</div>

Hey Guys, after following instructions in Chapter 7 to see the normal map applied to the cottage, the GPU hangs when executing on iOS, while running fine with no errors executing on macOS. I assume that there is no “bi…

---

## [Chapter 16 crashes my GPU](https://forums.kodeco.com/t/chapter-16-crashes-my-gpu/55788)

<div class="topic-metadata">

**Author:** [@arroz](https://forums.kodeco.com/u/arroz)\
**Replies:** 3\
**Last updated:** [November 20, 2018, 2:47am UTC](https://forums.kodeco.com/t/chapter-16-crashes-my-gpu/55788 "2018-11-20T02:47:09Z")

</div>

Hi, I followed the chapter 16 tutorial up to the point where fireworks should show on the Live View. I’m using a Mid 2014 MBP with the Intel Iris 1536 MB chip which I acknowledge it’s not the best GPU ever, but so far i…

---

## [General question about .metal file organization](https://forums.kodeco.com/t/general-question-about-metal-file-organization/55467)

<div class="topic-metadata">

**Author:** [@cocheret](https://forums.kodeco.com/u/cocheret)\
**Replies:** 1\
**Last updated:** [November 15, 2018, 12:50am UTC](https://forums.kodeco.com/t/general-question-about-metal-file-organization/55467 "2018-11-15T00:50:58Z")

</div>

For a complex app with lots of MSL shader functions and utility functions, it makes some sense to split things between multiple .metal files. If functions in one file need to refer to functions in other files, I assume w…

---

## [Ch 15 triple buffering index error](https://forums.kodeco.com/t/ch-15-triple-buffering-index-error/52921)

<div class="topic-metadata">

**Author:** [@bababoega](https://forums.kodeco.com/u/bababoega)\
**Replies:** 3\
**Last updated:** [November 9, 2018, 6:32am UTC](https://forums.kodeco.com/t/ch-15-triple-buffering-index-error/52921 "2018-11-09T06:32:35Z")

</div>

In chapter 15 when you start applying triple buffering we have to place the following code in the update(deltaTime) function. uniforms\[currentUniformIndex\].projectionMatrix = camera.projectionMatrix uniforms\[currentUnif…

---

## [Chapter 13 matrix order confusion](https://forums.kodeco.com/t/chapter-13-matrix-order-confusion/54792)

<div class="topic-metadata">

**Author:** [@cocheret](https://forums.kodeco.com/u/cocheret)\
**Replies:** 2\
**Last updated:** [November 7, 2018, 7:29pm UTC](https://forums.kodeco.com/t/chapter-13-matrix-order-confusion/54792 "2018-11-07T19:29:57Z")

</div>

In the section where Shaders.metal is modified the first time to handle instances there is one line that confuses me… Instances instance = instances\[instanceID\]; out.position = uniforms.projectionMatrix \* uniforms.v…

---

## [Ch 2 Challenge Problem](https://forums.kodeco.com/t/ch-2-challenge-problem/54769)

<div class="topic-metadata">

**Author:** [@jg764551](https://forums.kodeco.com/u/jg764551)\
**Replies:** 2\
**Last updated:** [November 7, 2018, 1:40am UTC](https://forums.kodeco.com/t/ch-2-challenge-problem/54769 "2018-11-07T01:40:06Z")

</div>

Hello, I’m able to get the train.obj to appear properly after following along with the instructions. Yet, I find that the playground in the Challenge folder is merely the same as the one in the Starter and Final folder…

---

## [Drawing to Multiple MTKViews](https://forums.kodeco.com/t/drawing-to-multiple-mtkviews/54557)

<div class="topic-metadata">

**Author:** [@johnlobe](https://forums.kodeco.com/u/johnlobe)\
**Replies:** 2\
**Last updated:** [November 4, 2018, 3:07pm UTC](https://forums.kodeco.com/t/drawing-to-multiple-mtkviews/54557 "2018-11-04T15:07:22Z")

</div>

Having read through Chapter 14 ( Multipass and Deferred Rendering ), I am intrigued by the possibility of viewing several textures at once in a window while an app is rendering and combining them. I have created a View …

---

## [Lots of New Things to Check Out!](https://forums.kodeco.com/t/lots-of-new-things-to-check-out/52249)

<div class="topic-metadata">

**Author:** [@johnlobe](https://forums.kodeco.com/u/johnlobe)\
**Replies:** 1\
**Last updated:** [November 1, 2018, 10:18pm UTC](https://forums.kodeco.com/t/lots-of-new-things-to-check-out/52249 "2018-11-01T22:18:30Z")

</div>

I’m not sure that this qualifies as a ‘Topic’, but I am just looking through the final chapters and sample projects for Metal by Tutorials - Super fun, thanks for all of the work and creativity! Time to put my phone on …

---

## [Chapter 10 Antialiasing section](https://forums.kodeco.com/t/chapter-10-antialiasing-section/53559)

<div class="topic-metadata">

**Author:** [@12o1v](https://forums.kodeco.com/u/12o1v)\
**Replies:** 5\
**Last updated:** [October 31, 2018, 12:57am UTC](https://forums.kodeco.com/t/chapter-10-antialiasing-section/53559 "2018-10-31T00:57:31Z")

</div>

When I toggle antialiasing on, my view just flickers, badly. Also, the view becomes almost unresponsive, it won’t scale and other toggle keys stop working (like ‘t’ in this example). It looks like the flicker is around …

---

## [Stuck at Home base (Hello Metal) on](https://forums.kodeco.com/t/stuck-at-home-base-hello-metal-on/44646)

<div class="topic-metadata">

**Author:** [@thehumbleog](https://forums.kodeco.com/u/thehumbleog)\
**Replies:** 14\
**Last updated:** [October 30, 2018, 10:41pm UTC](https://forums.kodeco.com/t/stuck-at-home-base-hello-metal-on/44646 "2018-10-30T22:41:33Z")

</div>

Hi everyone, Just got the book and very excited to start trying things out, however I can’t get past the very first sample - I’ve followed the coding to the T and can’t seem to render the red circle in Playground, there…

---

## [Ch 2 - positioning the train model](https://forums.kodeco.com/t/ch-2-positioning-the-train-model/53997)

<div class="topic-metadata">

**Author:** [@kwakita](https://forums.kodeco.com/u/kwakita)\
**Replies:** 1\
**Last updated:** [October 29, 2018, 4:30am UTC](https://forums.kodeco.com/t/ch-2-positioning-the-train-model/53997 "2018-10-29T04:30:44Z")

</div>

I felt difficulty following the instruction written in page 55 in the PDF edition. I finished Victoria Wenderlich’s tutorial on Blender but still could not figure out how I can expose the Node inspector in Blender. I k…

---

## [Ch 8 buffer management question](https://forums.kodeco.com/t/ch-8-buffer-management-question/53748)

<div class="topic-metadata">

**Author:** [@cocheret](https://forums.kodeco.com/u/cocheret)\
**Replies:** 3\
**Last updated:** [October 29, 2018, 4:23am UTC](https://forums.kodeco.com/t/ch-8-buffer-management-question/53748 "2018-10-29T04:23:55Z")

</div>

There is a lot of magic going on with the glTF code, which I haven’t yet had time to go through. However, I can see that it is managing the pipeline state including setting up things like the vertex descriptors. What is…

---

## [Ch 4 confusion over specular calculation](https://forums.kodeco.com/t/ch-4-confusion-over-specular-calculation/53486)

<div class="topic-metadata">

**Author:** [@cocheret](https://forums.kodeco.com/u/cocheret)\
**Replies:** 3\
**Last updated:** [October 22, 2018, 6:11am UTC](https://forums.kodeco.com/t/ch-4-confusion-over-specular-calculation/53486 "2018-10-22T06:11:00Z")

</div>

They say that getting computer graphics right is all about having the correct number of sign errors. I was scratching my head over the specular calculation for a while since it didn’t seem to match the diagram with the L…

---

## [Chapter 4, use of buffer(0) for both vertex and fragment shaders](https://forums.kodeco.com/t/chapter-4-use-of-buffer-0-for-both-vertex-and-fragment-shaders/53381)

<div class="topic-metadata">

**Author:** [@cocheret](https://forums.kodeco.com/u/cocheret)\
**Replies:** 1\
**Last updated:** [October 20, 2018, 4:44pm UTC](https://forums.kodeco.com/t/chapter-4-use-of-buffer-0-for-both-vertex-and-fragment-shaders/53381 "2018-10-20T16:44:22Z")

</div>

In chapter 4, when implementing the shader functions for the playground at the beginning, the vertex function takes vertices in buffer(0) and the fragment function takes color in buffer(0). So there are 2 things I’m unsu…

---

## [Ch 20 water ripple effect](https://forums.kodeco.com/t/ch-20-water-ripple-effect/53306)

<div class="topic-metadata">

**Author:** [@bababoega](https://forums.kodeco.com/u/bababoega)\
**Replies:** 1\
**Last updated:** [October 19, 2018, 12:37pm UTC](https://forums.kodeco.com/t/ch-20-water-ripple-effect/53306 "2018-10-19T12:37:55Z")

</div>

In chapter 20 when working on the ripple effect of the water. Once we introduce the ripple values for both the X and Y direction it is done as follows: float2 rippleX = float2(uv.x + timer, uv.y); float2 rippleY = float…

---

## [CHh 16 particles](https://forums.kodeco.com/t/chh-16-particles/52948)

<div class="topic-metadata">

**Author:** [@bababoega](https://forums.kodeco.com/u/bababoega)\
**Replies:** 2\
**Last updated:** [October 16, 2018, 12:17pm UTC](https://forums.kodeco.com/t/chh-16-particles/52948 "2018-10-16T12:17:18Z")

</div>

In chapter 16 when trying the premade fire particle emitter for the first time. The particles should automatically (by premade code) scaling down as they move up the screen. However the size of the particles stays the sa…

---

## [GPU hangs when rendering with two render encoders?](https://forums.kodeco.com/t/gpu-hangs-when-rendering-with-two-render-encoders/52851)

<div class="topic-metadata">

**Author:** [@dormouse](https://forums.kodeco.com/u/dormouse)\
**Replies:** 6\
**Last updated:** [October 15, 2018, 1:20pm UTC](https://forums.kodeco.com/t/gpu-hangs-when-rendering-with-two-render-encoders/52851 "2018-10-15T13:20:00Z")

</div>

Hello! I’m trying to make use of G-buffer in my project and I’m using a project from Chapter 14 as a reference. For some reason GPU hangs for about 5 seconds if I try to render composition quad in a separate pass, and co…

---

## [Clear texture crash](https://forums.kodeco.com/t/clear-texture-crash/52665)

<div class="topic-metadata">

**Author:** [@monkyu](https://forums.kodeco.com/u/monkyu)\
**Replies:** 1\
**Last updated:** [October 12, 2018, 5:02am UTC](https://forums.kodeco.com/t/clear-texture-crash/52665 "2018-10-12T05:02:24Z")

</div>

I was meeting a problem when I try to clear the texture content use the method: attention: the autoResizeDrawable is true CGSize blankSize = CGSizeMake(self.bounds.size.width, self.bounds.size.height); self.region = …

---

## [Chapter 15 semaphore issue?](https://forums.kodeco.com/t/chapter-15-semaphore-issue/52407)

<div class="topic-metadata">

**Author:** [@zzyzy](https://forums.kodeco.com/u/zzyzy)\
**Replies:** 7\
**Last updated:** [October 10, 2018, 5:03am UTC](https://forums.kodeco.com/t/chapter-15-semaphore-issue/52407 "2018-10-10T05:03:16Z")

</div>

First question: Concerning the Renderer “draw” routine in Chap 15 of Metal Tutorials, beginning with a semaphore.wait. I’m looking more at the sample code than the book. (The only mentions of semaphore in the book are…

---

## [Metal, V1.0 Missing Chapters 1-3](https://forums.kodeco.com/t/metal-v1-0-missing-chapters-1-3/52264)

<div class="topic-metadata">

**Author:** [@billcod](https://forums.kodeco.com/u/billcod)\
**Replies:** 2\
**Last updated:** [October 9, 2018, 11:57am UTC](https://forums.kodeco.com/t/metal-v1-0-missing-chapters-1-3/52264 "2018-10-09T11:57:28Z")

</div>

I just upgraded to the new full release of Metal, and it seems to be missing Chapters 1-3 in the files. I just saved the ones from the previous release, but you might check this out. Thanks.

---

## [Future topic on metal gpgpu](https://forums.kodeco.com/t/future-topic-on-metal-gpgpu/47790)

<div class="topic-metadata">

**Author:** [@dng88](https://forums.kodeco.com/u/dng88)\
**Replies:** 2\
**Last updated:** [August 31, 2018, 3:02am UTC](https://forums.kodeco.com/t/future-topic-on-metal-gpgpu/47790 "2018-08-31T03:02:20Z")

</div>

Reading the Beta book version now 0.4. and I guess it is off the topic. Still is there any extra on gpgpu.

[Previous page](https://forums.kodeco.com/c/books/metal-by-tutorials/44.md?page=10)

[Next page](https://forums.kodeco.com/c/books/metal-by-tutorials/44.md?page=12)
