Summerize Chapter 13: Instancing & Procedural Generation

This commit is contained in:
daemyung jang 2022-03-26 13:52:42 +09:00
parent 8ce020f800
commit 45057b6fb7
No known key found for this signature in database
GPG Key ID: 44160C9958A9C67B
4 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,40 @@
# Chapter 13: Instancing & Procedural Generation
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.
## Morphing
Morphing which is explaned by this book isn't the cannonical way of morphing. Morphing is usually a morphable mesh where primitives attributes are obtained by adding the original attributes to a weighted sum of targets attributes.
![](./morphing.png)
For instance, the the position of vertices for the primitive at index i are computed in this way:
```
primitives[i].attributes.POSITION +
weights[0] * primitives[i].targets[0].POSITION +
weights[1] * primitives[i].targets[1].POSITION +
weights[2] * primitives[i].targets[2].POSITION + ...
```
Apple's animoji is the most famous example of morphing.
![](./animoji.webp)
## Miscalculation of the world position
In Nature.metal and Houses.metal, the world position is calculated incorrectly, replace:
```
out.worldPosition = (uniforms.modelMatrix * vertexIn.position
* instance.modelMatrix).xyz;
```
With:
```
out.worldPosition = (uniforms.modelMatrix * instance.modelMatrix
* vertexIn.position).xyz;
```
The result isn't changed because the world position is not used anywhere.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

View File

@ -27,6 +27,7 @@ You can see color images in this book at [here](https://www.raywenderlich.com/bo
* [Chapter 10: Fragment Post-Processing](https://github.com/daemyung/metal-by-tutorials/tree/main/10-trees-and-fog)
* [Chapter 11: Tessellation & Terrains](https://github.com/daemyung/metal-by-tutorials/tree/main/11-tesselation-and-terrains)
* [Chapter 12: Environment](https://github.com/daemyung/metal-by-tutorials/tree/main/12-environment)
* [Chapter 13: Instancing & Procedural Generation](https://github.com/daemyung/metal-by-tutorials/tree/main/13-procedural-generation)
## Copyright