hello-worlds icon indicating copy to clipboard operation
hello-worlds copied to clipboard

Instanced-based Terrain Chunk implementation

Open kenjinp opened this issue 1 year ago • 1 comments

Flatten CPU draw-calls of terrain chunks by implementing them as instance geometries. Then, pass the vertex buffer to a shader that uses per-instance uniforms so that each individual mesh can get it's own vertex displacement.

https://protectwise.github.io/troika/three-instanced-uniforms-mesh/

"You can set per-vertex attributes with the usual BufferAttribute and per-instance attributes with InstancedBufferAttribute, the latter using gl.vertexAttribDivisor."

CAVEAT: will only work with geometries with the same number of vertices all the way down. This probably won't work on the #11 RingWorld implementation, which allows for irregular subdivisions.

kenjinp avatar Nov 04 '22 21:11 kenjinp