Open kenjinp opened 2 years ago
Apparently I forgot this, so here's a stack overflow that I found while trying to figure out ways to do this https://stackoverflow.com/questions/41880864/how-to-use-three-js-instancedbuffergeometry-instancedbufferattribute
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.