Summerize Chapter 18: Rendering with Rays
This commit is contained in:
parent
ae0cf5ed91
commit
6e21d3a9e9
|
|
@ -0,0 +1,80 @@
|
||||||
|
# Chapter 18: Rendering with Rays
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## Signed distance functions
|
||||||
|
|
||||||
|
There is a runtime error in because Shaders.metal files isn't included in the bundle. But we have the default library.
|
||||||
|
|
||||||
|
In Renderer.swift, in initializeMetal(), replace this:
|
||||||
|
|
||||||
|
```
|
||||||
|
guard let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") else { fatalError() }
|
||||||
|
let input = try String(contentsOfFile: path, encoding: String.Encoding.utf8)
|
||||||
|
let library = try device.makeLibrary(source: input, options: nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
With:
|
||||||
|
|
||||||
|
```
|
||||||
|
let library = device.makeDefaultLibrary()!
|
||||||
|
```
|
||||||
|
|
||||||
|
## The raymarching algorithm
|
||||||
|
|
||||||
|
There is a runtime error in because Shaders.metal files isn't included in the bundle. But we have the default library.
|
||||||
|
|
||||||
|
In Renderer.swift, in initializeMetal(), replace this:
|
||||||
|
|
||||||
|
```
|
||||||
|
guard let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") else { fatalError() }
|
||||||
|
let input = try String(contentsOfFile: path, encoding: String.Encoding.utf8)
|
||||||
|
let library = try device.makeLibrary(source: input, options: nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
With:
|
||||||
|
|
||||||
|
```
|
||||||
|
let library = device.makeDefaultLibrary()!
|
||||||
|
```
|
||||||
|
|
||||||
|
## Creating random noise
|
||||||
|
|
||||||
|
There is a runtime error in because Shaders.metal files isn't included in the bundle. But we have the default library.
|
||||||
|
|
||||||
|
In Renderer.swift, in initializeMetal(), remove this:
|
||||||
|
|
||||||
|
```
|
||||||
|
let path = Bundle.main.path(forResource: "Shaders", ofType: "metal")
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace this:
|
||||||
|
|
||||||
|
```
|
||||||
|
let input = try String(contentsOfFile: path!, encoding: String.Encoding.utf8)
|
||||||
|
let library = try device!.makeLibrary(source: input, options: nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
With:
|
||||||
|
|
||||||
|
```
|
||||||
|
let library = device.makeDefaultLibrary()!
|
||||||
|
```
|
||||||
|
|
||||||
|
## Marching clouds
|
||||||
|
|
||||||
|
There is a runtime error in because Shaders.metal files isn't included in the bundle. But we have the default library.
|
||||||
|
|
||||||
|
In Renderer.swift, in initializeMetal(), replace this:
|
||||||
|
|
||||||
|
```
|
||||||
|
guard let path = Bundle.main.path(forResource: "Shaders", ofType: "metal") else { fatalError() }
|
||||||
|
let input = try String(contentsOfFile: path, encoding: String.Encoding.utf8)
|
||||||
|
let library = try device.makeLibrary(source: input, options: nil)
|
||||||
|
```
|
||||||
|
|
||||||
|
With:
|
||||||
|
|
||||||
|
```
|
||||||
|
let library = device.makeDefaultLibrary()!
|
||||||
|
```
|
||||||
|
|
@ -31,6 +31,7 @@ You can see color images in this book at [here](https://www.raywenderlich.com/bo
|
||||||
* [Chapter 14: Multipass & Deferred Rendering](https://github.com/daemyung/metal-by-tutorials/tree/main/14-multipass-rendering)
|
* [Chapter 14: Multipass & Deferred Rendering](https://github.com/daemyung/metal-by-tutorials/tree/main/14-multipass-rendering)
|
||||||
* [Chapter 15: GPU-Driven Rendering](https://github.com/daemyung/metal-by-tutorials/tree/main/15-gpu-driven-rendering)
|
* [Chapter 15: GPU-Driven Rendering](https://github.com/daemyung/metal-by-tutorials/tree/main/15-gpu-driven-rendering)
|
||||||
* [Chapter 16: Particle Systems](https://github.com/daemyung/metal-by-tutorials/tree/main/16-particle-systems)
|
* [Chapter 16: Particle Systems](https://github.com/daemyung/metal-by-tutorials/tree/main/16-particle-systems)
|
||||||
|
* [Chapter 18: Rendering with Rays](https://github.com/daemyung/metal-by-tutorials/tree/main/18-rendering-with-rays)
|
||||||
|
|
||||||
## Copyright
|
## Copyright
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue