Replies: 1 comment
-
Thank you for your kind words 🙏 First of all, I don't think you need to worry too much about it for a chess game. The main use-case of instanced meshes is if you have thousands or millions of instances (you can try its effect in the
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First of all, I'd like to thank you @asny for the great work you're doing. The crate is exactly what I was looking for for a new project I'm working on.
There's currently just one thing I'm struggling to understand: I'm not sure how to render multiple instances of an object efficiently, considering the transform of each instance potentially changes every frame.
Let's say I want to make a chess game. My first naive approach would be to create a
Mesh
for the board and one for every of the 32 pieces. However, this seems to be a lot of overhead, because everyMesh
stores its own vertex data, even though many pieces share the same geometry.Using
InstancedMesh
seems to be the better alternative in this case. For every type of piece, I'd create a singleInstancedMesh
, usingInstances
to set the transform of each instance. As far as I understand, the only way to change the transform of an instance is throughInstancedMesh::set_instances()
. Looking at the implementation, this method seems to be quite expensive and I'm not sure if it's supposed to be called multiple times per frame.I'm not sure if I miss something here or if my approach is somehow flawed. I'd be happy to hear your thoughts on this.
Beta Was this translation helpful? Give feedback.
All reactions