generate contour from the 3D model

Hello forum,

I have to create contour around the 3D model . Can anyone refer me to any algorithms that does it efficiently ?


Don’t understand your question. Can U provide an example - perhaps pictures of a 3D model with and without the ‘contour’?

Contours, or a silhouette?

How is the model represented? Triangle mesh? Parametric surfaces? Voxels?

I think I found a solution while googling it up.

What do you think ?

so far started with the triangular mesh.

Personally, I’d be inclined to do it via rasterisation rather than geometrically.

Essentially the same thing as glTexGen() in GL_OBJECT_LINEAR mode, but using a shader to avoid thickening of the contour lines on near-perpendicular surfaces.

Any example opengl code you could refer me to ?

from math, you should use a series of planes with equal distance to cut the 3D model, get their crossover points, then connect them, you will get the contour.

if you have the model, you can discharge the z value, enough.

There`s a simpler alternative.
Draw your model on a clear Z-buffer and save the resulting Z-buffer to a texture. You now have a depth mask of your model.
Now load it into a pixel shader and calculate the contour using dilation from mathematical morphology.

If you export the lines as DXF, you should be able to load them into QGIS. Once they are in QGIS, you need to create an attribute that contains the elevation of each line (ie. a data column with a number). Depending on the total number of lines you could possibly do this manually.

If doing it manually is not an option, you could concievably do some Python sorcery to iterate through the lines in some intelligent way to calculate the elevation. However, the best scenario would be if you could get the contours as proper geodata with 3D coordinates from the person who originally created the PDF.

When you have the contours prepared with an elevation attribute (or 3D coordinates if you could get them from the source), you can use the interpolation tool in the raster menu in QGIS to turn them into a heightmap raster. After that you can use that raster as a displacement map in your 3D-modelling software.

As the tutorial also mentions, there is a Blender plugin to directly import a heightmap raster and turn it into a 3D-surface as well.

Note that I’m assuming you’re not interested in keeping the original geographic coordinate system, but just want a model for visualisation.