Colored Edges vanishing after merge (MergeMeshes vs. enableEdgesRendering)

Just starting with Babylonjs, first question ever from my side :wink: there might be more going forward …

When I create two planes with colored edges and merge them - after the merge the colored edges are gone. Is this an expected behavior? If yes - how to work around?
(I don’t want to use sprites or alike in this case, as I want that the text to be rendered)

I created this playground for it: https://playground.babylonjs.com/#5ZCGRM#5137
the merge of 3&4 happens in line 112.

why are plane 3 & 4 missing the red edges compared to 1 & 2?

Any feedback is very much appreciated. Thank you.

1 Like

Hello welcome!

You have to enable the edge rendere on the merged mesh:

Wasn’t clear from your question however if you wanted to preserve the edge after merging the meshes it’s imposibble. Since you are using a DynamicTexture you can draw the border onto the texture:

    const ctx = texturePlane4.getContext()
    ctx.beginPath();
    ctx.rect(x1, y1, x2, y2);
    ctx.stroke();
    texturePlane4.update()

As an alternative you could choose babylon.js GUI:

https://doc.babylonjs.com/features/featuresDeepDive/gui/gui

Thank you!

Enabling the edge rendering on the merged mesh does the trick and was what I was looking for.

I played a bit with the second option drawing a border onto the texture - however it seems that this does not work in parallel to displaying the text within the dynamic texture. If I would need this (and not being able to figure it out myself) in the future I would raise another question. But nothing for now.

Thanks again

1 Like

Yes it does. You can draw to the texture as you were drawing to a canvas2d. Limitless possibilities!