Hi guys, need a little help here. This is my use case: I have a tiled terrain which has 1 material. User clicks a button signalling intention to place an object on terrain and visual should indicate available tiles for object placement. This is a fairly common use-case even in 2d or isometric games, cf, pics below.
My current implementation was to create multiple instances of a simple square disc with a yellow material and place them at selected coordinates. This informs the user where he can place objects on.
this.disc0 = BABYLON.MeshBuilder.CreateDisc("super disc0", {radius:1.4/2,tessellation: 4}, this.scene);
this.disc0.isPickable = false;
this.disc0.position.y = 999;
this.disc0.setMaterialByID("yellowmat_with_alpha");
Once the user action is completed/aborted, the instanced discs are disposed. The problem I’m facing is a perf hit when the scene has to create multiple such instances. In the pics above, the number of yellow tiles created eveytime the user initiates object placement is around 800. The fps takes a significant hit and I find perceptible lag navigating the canvas. Granted, this is an edge use case.
My question is: how can I highlight/glow selected faces on, say, a subdivide plane/sphere w/o taking a perf hit. I’ve tried glow: https://www.babylonjs-playground.com/#2Q4S2S#47 but this only works with multimaterials. I can’t seem to make it work with only submeshes and a single material. Any thoughts ?
Happy to submit a PR if needed, I see this as a fairly common use case for most game devs.