Contour 3d surface

How to make a 3d surface from contour lines or (Three-dimensional contour plot) in three.js
Thanks in advanced.

The LatheGeometry uses plots to create itself, but then this is not exactly plotting z- slides on a 2D surface since it assumes rotating the plots around an axis to build the geometry. Other than that, I believe that manually .push-ing the plot array into the position attribute in a roughly similar manner to the example from the BufferGeometry is one way of doing it (reading about buffer attributes too might help with that). Of course, you can always iterate over some of the (X, Y, Z) components of the position vectors and compute the others based on some function, I reckon. Not sure if it covers all Matlab specific cases as I have no experience with that, but you’ll never know before you try. Alternatively, you can use BufferGeometry’s .setFromPoints() method in a similar fashion.

Once the position array is built, you’d need to do yourgeometry.computeVertexNormals(); and yourgeometry.attributes.position.needsUpdate = true; and make sure a certain order of those positions is followed according to the number of “segments” that you want your shape to have. Mind you, I’m not really an expert in this area, but that’s my take on it, other folks are free to add or correct what I wrote.