Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instanced-based Terrain Chunk implementation #23

Open
kenjinp opened this issue Nov 4, 2022 · 1 comment
Open

Instanced-based Terrain Chunk implementation #23

kenjinp opened this issue Nov 4, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@kenjinp
Copy link
Owner

kenjinp commented Nov 4, 2022

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 kenjinp added the enhancement New feature or request label Nov 4, 2022
@kenjinp kenjinp changed the title Instanced-based Chunk implementation Instanced-based Terrain Chunk implementation Nov 4, 2022
@kenjinp kenjinp moved this to Next up in Hello-Worlds Roadmap Nov 19, 2022
@kenjinp kenjinp moved this from Next up to Triage in Hello-Worlds Roadmap Nov 19, 2022
@kenjinp
Copy link
Owner Author

kenjinp commented Feb 11, 2023

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

@kenjinp kenjinp moved this from Triage to Next up in Hello-Worlds Roadmap Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Next up
Development

No branches or pull requests

1 participant