I'm currently learning how isosurfaces are extrated from volumetric data. I already understood the original marching cubes algorithm which is based on 3D-voxel data which stores only values of either 1 or 0. For learning purposes I implemented the easier version of it for 2D-volumetric data called marching squares algorithm. Results are shown below:

enter image description here

After all I read that the marching cubes algorithm can benefit of float values in the voxels instead of the binary values in terms of interpolating the vertices. However I do not understand how this should work simply because I'm missing the rules of which values should only be assumed for the voxels and also how the interpolation based on them would be done.

Could someone give me a fundamental view of how interpolation with the marching cubes algorithm is asumed to work? An example with 2D would be fine but showing how it works in 3D would be even nicer.

PS: For references, I read such stuff here.


1 Answer 1


I worked it out on my own. I'm trying to write it down correctly so it's readable for newcomers.


First of all, interpolation itself requires that there are float values and not binary values. This gives the ability to create different edge-crossing-vertices. How it's going I'm explaining now.

The interpolation which is needed here is linear interpolation. For understanding purposes I'll explain it here too.

General Interpolation

After all, what is interpolation? Well good question. Interpolation is described as name for algorithms which smooth a given input of data e.g. points (with n-dimensions). Simpler there are points searched between the points for a given interpolation value. First it's required to give the points a base so that's clear where points are searched for in between. After that a specific algorithm for the interpolation has to be chosen. There are different kinds of interpolation algorithm out there each for a specific application. Best known is linear interpolation which results for a value one point on a line which crosses two input points.

The formula for linear interpolation (2D here) is as following (simply maths): $$ y = y_{0} + (value - x_{0} ) * \frac{y_{1} - y_{0} }{x_{1} - x_{0}} $$ with $$ value \in \mathbb{R} \wedge 0 <= value <= 1 $$

After all with this formula it's possible to apply interpolation on the vertices of the marching cubes algorithm which requires following rules.

  1. The voxels must have a floating value instead of a binary value.
  2. The value of the voxels must be only between zero and one
  3. There must be a boundary value be declared which describes whether a voxel is supposed to be in surface.

Looking back to the blog the boundary value is called the iso surface value. This value describes as explained whether a voxel is being asumed to be in the surface so for acquiring the edge crossing. This is important to know because without it you wouldn't find out where even a edge-crossing computation is needed.

The interpolation is done on each coordinate of the two voxels position where and crossing-edge vertex is. The implementation is quite easy and looks like this (extracted from here):

   Linearly interpolate the position where an isosurface cuts
   an edge between two vertices, each with their own scalar value
XYZ VertexInterp(isolevel,p1,p2,valp1,valp2)
double isolevel;
XYZ p1,p2;
double valp1,valp2;
   double mu;
   XYZ p;

   if (ABS(isolevel-valp1) < 0.00001)
   if (ABS(isolevel-valp2) < 0.00001)
   if (ABS(valp1-valp2) < 0.00001)
   mu = (isolevel - valp1) / (valp2 - valp1);
   p.x = p1.x + mu * (p2.x - p1.x);
   p.y = p1.y + mu * (p2.y - p1.y);
   p.z = p1.z + mu * (p2.z - p1.z);



The interpolation of the edge-crossing vertices is a nice feature for smoothing the presentation of voxels.However the interpolation relies on that there are already floating values which means that it cannot smooth your existing binary data. For such cases different algorithms and approaches are needed.

  • $\begingroup$ Interpolation is a technique of estimating value between discrete points, here in the end it smooths. $\endgroup$
    – Evil
    Commented Mar 4, 2017 at 14:16
  • $\begingroup$ @Evil Feel free to improve the writing of my answer. It's appreciated :) $\endgroup$ Commented Mar 4, 2017 at 15:11
  • $\begingroup$ Could you help to answer here please with real example? computergraphics.stackexchange.com/questions/9899/… $\endgroup$
    – Arsenius
    Commented May 31, 2021 at 9:23
  • $\begingroup$ @Arsenius I think I know what the solution to your problem is, however I'm short on time right now. I'll answer it later. $\endgroup$ Commented May 31, 2021 at 20:02
  • $\begingroup$ @realvictorprm thanks a lot, looking forward... $\endgroup$
    – Arsenius
    Commented Jun 2, 2021 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.