# Terrain
# Cubic Voxels
## Mesh Fitting
Turns cubes into larger, much simpler meshes with less triangles.
### Greedy Meshing
### Binary Mesh Fitting
## Vertex Pulling
Moving data out of the vertex buffer and into a constant (shared) buffer and a custom buffer which is able to store less per-face data.
# References
[[Vercidium]] has a couple of interesting videos with code on the topic.
## Mesh Fitting
```cardlink
url: https://youtu.be/qnGoGq7DWMc
title: "Blazingly Fast Greedy Mesher - Voxel Engine Optimizations"
description: "This greedy mesher is blazingly fast. Written with Rust and Bevy, using clever bitwise operations we can generate chunk meshes, an average of 0.000195 per 32..."
host: youtu.be
favicon: https://www.youtube.com/s/desktop/70217e23/img/favicon_32x32.png
image: https://i.ytimg.com/vi/qnGoGq7DWMc/maxresdefault.jpg
```
```cardlink
url: https://youtu.be/5zlfJW2VGLM
title: "When Your Game Is Bad But Your Optimisation Is Genius"
description: "The source code and demos are available here: https://patreon.com/vercidiumI spent the past 6 years creating a game engine, and I've been shocked at the thin..."
host: youtu.be
favicon: https://www.youtube.com/s/desktop/46720ae0/img/favicon_32x32.png
image: https://i.ytimg.com/vi/5zlfJW2VGLM/hqdefault.jpg
```
```cardlink
url: https://youtu.be/40JzyaOYJeY
title: "I Rebuilt My Game Engine To Optimise This Properly"
description: "The source code and demos are available here: https://patreon.com/vercidiumThe greedy meshing algorithm is available here: https://github.com/vercidium-patre..."
host: youtu.be
favicon: https://www.youtube.com/s/desktop/accca349/img/favicon_32x32.png
image: https://i.ytimg.com/vi/40JzyaOYJeY/maxresdefault.jpg
```
- https://github.com/vercidium-patreon/meshing
- [[Voxel Engine - BinaryMeshFitting]]
## Vertex Pulling
```cardlink
url: https://youtu.be/fjT98PpFjTM
title: "Block Models, Stairs and Mesh Optimizations"
description: "In this video I demonstrate you the new block models and stairs and I explain how I store my chunk meshes in memory.There is a simple optimization that is of..."
host: youtu.be
favicon: https://www.youtube.com/s/desktop/7c0eb0c2/img/favicon_32x32.png
image: https://i.ytimg.com/vi/fjT98PpFjTM/maxresdefault.jpg
```
- https://github.com/PixelGuys/Cubyz/blob/master/assets/cubyz/shaders/chunks/chunk_vertex.vs