Well, I’ve been trying to recreate a scene from a game I once played, and it needs lots of vegetation rocks and stuff. And I’m always looking for ways to use BJS methods to reduce draw calls and vertices, and have used instances for a long time. But BJS now has “thin instances” - so I thought I would give them a try.
I looked at the docs, and for a non-coder like me was immediately frightened off when I saw the word “matrix”. But I remembered @PirateJC 's video on “Thin Instances” and the code seemed so easy and I settled in to see what I could create. I also wanted to be able to use Blender to define where the “thin” instances would go. I solved that after I followed a link that @JohnK posted that led me to this little BJS method :
var positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
So I created a mesh for my terrain that I deleted faces from, then triangulated the remaining faces, and then finally one last delete of triangles.(see image below highlighting the residual faces. This I used to place my “thin” instances across an up/down terrain. I did not use all the vertices - just some. And finally, in my code did a dispose of that mesh
Here is the result :
Now, I’m pondering how to scale, rotate and use different materials for the mesh used for the “thin” instances - probably have to repeat the process with different meshes to be instanced.
I use the mixMaterials script to paint the terrain and with the mixmap in Blender I’m able to keep objects of the path.
So the trees are instances created with geometry nodes in Blender, the bushes with “thin” instances, and the windows, wall pillars and wall ivy done manually with instances.
TY to @PirateJC and @JohnK . Helped this crap coder a lot
Stay Safe All, gryff