How to re-scale thin instance buffers by some factor and maintain their original position (translation)?

This pg demos a rock mesh thin instance buffer, and it’s larger scaled-up counter part being rendered in different locations:

What I want to do is keep the larger rock at it’s original position (the smaller rock). Can someone please explain why and how to fix this?

Thank you in advance!

I would create a new smaller buffer and copy the previous one into.
Once a buffer is used, I don’t think it’s possible to resize it. You can update portions but the buffer size stays the same.

1 Like

I think what @arcman7 wants to do is to make the rock larger, not the buffer size (?)

If that is so, @arcman7 what you did is ok, the problem being that the rock is not centered in its local coordinate system. You can recenter it by offseting the vertices by the bounding box center:

3 Likes

@Cedric @Evgeni_Popov

Thank you both for the quick response!

@Evgeni_Popov was right in regards to what I meant, and I’m sorry Cedric if the wording wasn’t clear. I do try, but sometimes I’m off the mark.

@Evgeni_Popov this is perfect btw. I should have asked sooner lol. Thanks again!

@Cedric @Evgeni_Popov

I think it’s safe to say that any mesh not centered within it’s own local coordinate system is likely to exhibit strange behavior not intended by the user of the mesh (just think: developers who aren’t designers downloading gltf assets from websites such as sketchfab). I think I’ve experienced other issues caused by the same problem that Cedric has happened to help me with in the past.

Is this a common problem? If so, and it’s not just me, I’d like to start brainstorming on a plugin or utility function within Babylon.js that will “clean up” a given mesh. I recall non-positive scaling determinants also being another potential issue that could be cleaned.

In short, I’d like a way for a non-designer or graphical artist to drop in a mesh and being able to export an equivalent gltf file that just doesn’t have any of these weird issues. I’m willing to contribute on this front if you guys deem it a good idea.