Recent

Author Topic: 3D Mesh simplification  (Read 4816 times)

ChrisR

  • Jr. Member
  • **
  • Posts: 84
3D Mesh simplification
« on: May 30, 2016, 10:47:21 pm »
I recently ported a very fast mesh simplification algorithm to FPC/Lazarus/Delphi. This can reduce the level of detail in a triangulated mesh, allowing games to require less disk space and render more interactively. In particular, it can be used after one uses marching cubes to convert a 3D voxelwise volume into a triangulated mesh (see my open source Surf Ice software for an example of how to conduct marching cubes in Pascal). I would be happy for feedback from anyone who wants to try this out. The demo program will load a mesh saved in the popular Lightwave OBJ, decimate it the desired amount, and save the reduced mesh back to OBJ format:
  https://github.com/neurolabusc/Fast-Quadric-Mesh-Simplification-Pascal-
Since this algorithm is so quick, it can be used interactively to see the results.

lainz

  • Hero Member
  • *****
  • Posts: 3273
    • Lainz
Re: 3D Mesh simplification
« Reply #1 on: May 31, 2016, 01:46:51 am »
Hi, you've tried decimate from Blender?
https://wiki.blender.org/index.php/Doc:2.4/Manual/Modifiers/Generate/Decimate

How it compares to your application?

I did some tests and here are my results:

1) original dragon.obj > 213504 tris

1.1) simplify dragon.obj out.obj 0.2 > 106752 tris, 106752 faces, 53378 verts

1.2) blender decimate ratio 0.5 > 106752 tris, 71180 faces, 53378 verts

yes, both codes can generate same tris object with different settings.

your code is somewhat faster, but in blender I can live preview.

At the left yours output, at the right blender decimate:
http://postimg.org/image/5uq2hcibf/full/

ChrisR

  • Jr. Member
  • **
  • Posts: 84
Re: 3D Mesh simplification
« Reply #2 on: May 31, 2016, 03:20:20 pm »
Blender is a terrific program, but not something that Lazarus, Delphi or FPC users can directly integrate into their projects. I would point out that you can live view the performance with Sven's algorithm using my Surf Ice software
  https://www.nitrc.org/plugins/mwiki/index.php/surfice:MainPage#Advanced_Notes
which is open source, written in Lazarus, compiles to OSX/Windows/Linux using Intel/AMD/NVidia graphics cards.

The demo project I created does not live view because I wanted to create a minimal sample project that developers can plug into their own Lazarus, FPC or Delphi projects. It is also included in my Surf Ice code, but that is a much more complicated project and would not elegantly illustrate the code in a way that could be bolted on to other projects.

lainz

  • Hero Member
  • *****
  • Posts: 3273
    • Lainz
Re: 3D Mesh simplification
« Reply #3 on: June 01, 2016, 02:21:25 am »
Thanks for this is really usefull.

ChrisR

  • Jr. Member
  • **
  • Posts: 84
Re: 3D Mesh simplification
« Reply #4 on: June 06, 2016, 04:59:03 pm »
lainz, I have also added this mesh simplification to my simple modern OpenGL demo, allowing live viewing for the process:
  https://github.com/neurolabusc/plyview
This is a minimal project to view OBJ/PLY files, decimate meshes, and save to OBJ format. It is a bit more complicated than my command line project, but does allow mesh viewing and is no where near as complicated as my Surf Ice project.

lainz

  • Hero Member
  • *****
  • Posts: 3273
    • Lainz
Re: 3D Mesh simplification
« Reply #5 on: June 06, 2016, 05:26:32 pm »
Nice, I'll try it.