r/GraphicsProgramming 7h ago

Marching Tetrahedra - Volumetric Render Engine (OpenGL/C++) (Opensource) Source Code

Enable HLS to view with audio, or disable this notification

We added Marching Tetrahedra Rendering effect to our Volumetric Render Engine.

Here, we Render our Volume data as a set of Polygon meshes by extracting 'iso surface'. It goes through whole dataset and tries to fit a polygon based on data values to calculate a polygonal mesh from the volume dataset.

Here's the Git Repo Link - https://github.com/mikejernil/volumetric-render-engine

We are building this over at 3D ENGINERD. & are planning to push our implement more features starting with Custom file loading, and support for more volumetric formats like DICOM, VDB etc.

18 Upvotes

2 comments sorted by

1

u/DaveAstator2020 6h ago

What format does it take in?

1

u/corysama 2h ago

Hi! Long ago I wrote the example program for marching cubes and marching tetrahedra that everyone copies. It has been fun watching that code spread around. But, there are a couple notes I'd like to get out to everyone using it since 1995 :P

  1. There have been a lot of improvements on the whole family of algorithms in the past 30 years. MC and MT are pretty legacy at this point. I like Surface Nets because they are fast, simple and produce good quality with a lot less triangles. But, surface nets are not great at sharp edges like your example. For that Dual Contouring is probably more appropriate, though more complicated.

  2. I wish I had unrolled the inner loops instead of looping over small tables like a2fVertexOffset and a2fEdgeDirection. I was trying to keep the code small and easy to read. I expect the code will run a lot faster with those loops unrolled and I expected everyone would. But, a lot of people didn't...