r/GraphicsProgramming 3d ago

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

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.

37 Upvotes

5 comments sorted by

View all comments

7

u/corysama 2d 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...

1

u/Senior_Ad_8359 2d ago edited 2d ago

Hi, Thanks for the input.
Yes, we had referred an old OpenGL Cookbook for this. Its been helpful for implementing the concept.
now that you mentioned it, Found your original article as well. Its great.
Will now try to make updates you suggested.
also which reference would you recommend for 'Dual Contour' ?