Primal Dual Mesh in Babylon / Voronoi - Delaunay Triangles

Hi,

I’m a newby and was curious if it’s possible to set up in Babylon.js a Primal Dual Mesh, that look like a Voronoi / Delaunay triangles combination, as explained in this blogpost by RedBlob:
https://www.redblobgames.com/x/1721-voronoi-alternative/

image

I’m also curious if Babylon.js works like a pure GPU shader combined with JS?

Like in my example is it possible having a triangulated mesh run in the Shader as the primal-mesh, with on top of that in JS the Barycentric dual-mesh that’s being calculated, and if so will this be efficient, or is it better to do all in JS?

Thanks in advance for your feedback,

M.

Welcome aboard!

You can certainly create polygons in Babylon.js, so if you know the math you can generate the polygons from your picture.

You don’t have compute shaders in WebGL, so it’s not really possible to perform the computation on the GPU. With WebGPU, we are going to support compute shaders, but it’s currently a work in progress and is not available yet. So, for the time being, you will have to do the math on the JS side.

Alright, thanks!

Looking forward to how WebGPU module will be integrated.

Hi!

It’s been a while since I looked at this kind of thing. I made a playground to convert 3D meshes to tetrahedrals meshes using Tetgen (compiled with emscripten).

1 Like

It does not seem to run for me in Chromium, anything special to do ?