Highlighted ground submeshes becomes black

Hi,
I want to highlight ground submeshes individuallly. I know submesh cannot be directly highlighted so I used clones. However when I use a single clone for highlighting, the lines goes around the edges of the whole area to be able to make tiles highlight individually I created clone of the ground for each tile and also a new highlight object. This created the look I want but then the tiles start to appear black.

I have repeated the problem in this sample. The problem starts to happen after a couple of minutes.
https://playground.babylonjs.com/#8VDULN#16

This is how highlighted mesh looks after a while:

I don’t know what I am doing wrong or it is actually a bug of HighlightLayer.

Seems that your script creates too much Highlight textures

In normal conditions there should be just two Highlight textures:

2 Likes

Yes, I am creating new highlightlayer each step.
I changed my script. I created 64 highlightlayer for each tile at the begining and then using only addMesh/removeMesh to the highlightlayer. I can’t repeat the problem. It works! Thank you @labris!

https://playground.babylonjs.com/#8VDULN#18

1 Like