Possible to use enableEdgesRendering and edgesColor on ground mesh to highlight edges?

With other meshes from MeshBuilder the edgesColor is shown around all the faces (e.g. the Polyhedron shown here). With the Ground mesh it seems it does not color the edges of each face but only the outer edges. Is it possible to colour the edges of each face that makes up a ground mesh using edgesColor or do I need to write a custom shader to do this? I assume if I find the fragment shader code for edgesColor then that will point me towards what custom shader I would need to write?


In the image and playground below, the ground mesh has been modifed to have random vertices raised up to create spikes. I would like to highlight the edges of all the vertices that make up this ground mesh and that will also help to highlight the edges connected to the raised vertices.

PG: Babylon.js Playground

It sounds like you want wireframe rendering. I wonder if you can use the new debug materials that @alexhuber added. @Evgeni_Popov any thoughts?

1 Like

looks like you need to enable edge rendering after setting the ground mesh vertices

1 Like

Yes, the edge renderer is not using a special shader, it is creating lines based on the mesh geometry. So, as @MeshSlayer pointed out, you have to enable the edge renderer after the geometry has been modified.

As @bghgary, you can also use the new debug material if you want to draw the mesh in full wireframe:

See Visualizing Mesh Data | Babylon.js Documentation for more options.