开源软件名称(OpenSource Name):hhoppe/Mesh-processing-library开源软件地址(OpenSource Url):https://github.com/hhoppe/Mesh-processing-library开源编程语言(OpenSource Language):C++ 80.8%开源软件介绍(OpenSource Introduction):Mesh Processing LibraryOverviewThis package contains C++ libraries and programs demonstrating mesh processing research published in ACM SIGGRAPH (1992–1998):
The source code has been updated to modern C++ style and for cross-platform use. Requirements / dependenciesThe code can be compiled with Microsoft Visual Studio using the solution ( On Unix (Linux, Mac OS, and Cygwin),
the code compiles using the Reading/writing of images and videos is enabled using several options.
If available, image I/O can use On Mac OS X, it is necessary to install
Code compilationBuild using Microsoft Visual StudioOpen the
Build using GNU |
Hugues Hoppe, Tony DeRose, Tom Duchamp, John McDonald, Werner Stuetzle.
ACM SIGGRAPH 1992 Proceedings, 71-78.
Signed-distance field estimated from a set of unoriented noisy points.
Programs:
Recon Demos:
create_recon_*.{sh,bat} , view_recon_*.{sh,bat} |
|
Hugues Hoppe, Tony DeRose, Tom Duchamp, John McDonald, Werner Stuetzle.
ACM SIGGRAPH 1993 Proceedings, 19-26.
Traversing the space of triangle meshes to optimize model fidelity and conciseness.
Programs:
Meshfit Demos:
create_recon_* , view_recon_* , create_simplified_using_meshopt , view_simplified_using_meshopt |
|
Hugues Hoppe, Tony DeRose, Tom Duchamp, Michael Halstead, Hubert Jin, John McDonald, Jean Schweitzer, Werner Stuetzle.
ACM SIGGRAPH 1994 Proceedings, 295-302.
Subdivision surfaces with sharp features, and their automatic creation by data fitting.
Programs:
Subdivfit Demos:
create_recon_cactus , view_recon_cactus |
|
Hugues Hoppe.
ACM SIGGRAPH 1996 Proceedings, 99-108.
Efficient, lossless, continuous-resolution representation of surface triangulations.
Demos: create_geomorphs , view_geomorphs
|
|
Hugues Hoppe.
Computers & Graphics, 22(1), 1998, 27-36.
Progressive mesh data structures compatible with GPU vertex buffers.
Demos:
create_pm_club , view_pm_club , determine_approximation_error |
|
Hugues Hoppe.
ACM SIGGRAPH 1997 Proceedings, 189-198.
Lossless multiresolution structure for incremental local refinement/coarsening.
Demos:
create_sr_office , view_sr_office |
|
Hugues Hoppe.
IEEE Visualization 1998 Conference, 35-42.
Visually smooth adaptation of mesh refinement using cascaded temporal geomorphs.
Demos:
create_terrain_hierarchy , view_terrain_hierarchy , create_sr_terrain , view_sr_terrain , view_gcanyon_* |
|
Jovan Popovic, Hugues Hoppe.
ACM SIGGRAPH 1997 Proceedings, 217-224.
Progressive encoding of both topology and geometry.
Programs:
G3dOGL Demos:
view_psc_drumset |
After the code is compiled, the demos can be run as follows.
In Windows, create, view, and clean up all the results using the batch
scripts:
demos/all_demos_create_results.bat
demos/all_demos_view_results.bat
all_demos_clean.bat
On Unix-based systems (e.g. Linux, Mac OS, Cygwin), either run the bash
scripts:
demos/all_demos_create_results.sh
demos/all_demos_view_results.sh
demos/all_demos_clean.sh
or alternatively (and faster), invoke make
to create all results in parallel and then view them sequentially:
make [CONFIG=config] -j demos
Note that pressing the Esc key closes any open program window.
All programs recognize the argument --help
(or -?
) to show their many options.
The programs Filterimage
, Filtermesh
, Filtervideo
,
FilterPM
, and Filterframe
are all designed to:
std::cin
(or from files or procedures specified as initial arguments),std::cout
(unless -nooutput
is specified).For example, the Filterimage
command
Filterimage demos/data/gaudipark.png -rotate 20 -cropleft 100 -cropright 100 \
-filter lanczos6 -scaletox 100 -color 0 0 255 255 -boundary border -cropall -20 \
-setalpha 255 -color 0 0 0 0 -drawrectangle 30% 30% -30% -30% -gdfill \
-info -to jpg >gaudipark.new.jpg
alpha=0
) rectangular region in the image center,std::cerr
), andAs another example, the FilterPM
command
FilterPM demos/data/standingblob.pm -info -nfaces 1000 -outmesh | \
Filtermesh -info -signeddistcontour 60 -genus | \
G3dOGL -key DmDe
FilterPM demos/data/spheretext.pm -nf 2000 -outmesh | \
Filtermesh -angle 35 -silsubdiv -silsubdiv -mark | \
G3dOGL -key DmDeDbJ---- -st demos/data/spheretext.s3d
spheretext.s3d
file.Filtervideo demos/data/palmtrees_small.mp4 -filter keys -scaleu 1.5 >palmtrees_small.scale1.5.mp4
The command
Filtervideo demos/data/palmtrees_small.mp4 -info -trimbeg 4 -boundary clamped -trimend -20% | \
-tscale 1.5 -framerate 150% -croprectangle 50% 50% 400 240 -gamma 1.5 -bitrate 10m | \
VideoViewer demos/data/palmtrees_small.mp4 - -key =an
-
for std::cin
) together with the original video in an interactive viewer,This program reads a list of 3D (x, y, z) points assumed to be sampled near some unknown manifold surface, and reconstructs an approximating triangle mesh. For example,
Recon <demos/data/distcap.pts -samplingd 0.02 | \
Filtermesh -genus -rmcomp 100 -fillholes 30 -triangulate -genus | tee distcap.recon.m | \
G3dOGL -st demos/data/distcap.s3d -key DmDe
To show the progression of the Marching Cubes algorithm,
Recon <demos/data/distcap.pts -samplingd 0.02 -what c | \
Filtera3d -split 30 | G3dOGL -key DCDb -st demos/data/distcap_backside.s3d -terse
To show a similar streaming reconstruction of the surface mesh,
Recon <demos/data/distcap.pts -samplingd 0.02 -what m | Filtermesh -toa3d | \
Filtera3d -split 30 | \
G3dOGL demos/data/distcap.pts -key DCDb -st demos/data/distcap_backside.s3d -terse -input -key _Jo
The same program can also read a list of 2D (y, z) points to reconstruct an approximating curve:
Recon <demos/data/curve1.pts -samplingd 0.06 -grid 30 | \
Filtera3d -joinlines | tee curve1.a3d | \
G3dOGL demos/data/curve1.pts -input -st demos/data/curve1.s3d
Given an initial mesh and a list of 3D points, this program optimizes both the mesh connectivity and geometry to improve the fit, i.e. minimizing the squared distances from the points to the surface. For example,
Meshfit -mfile distcap.recon.m -file demos/data/distcap.pts -crep 1e-5 -reconstruct | \
tee distcap.opt.m | G3dOGL -st demos/data/distcap.s3d -key DmDe
The input points can also be sampled from an existing surface, e.g.:
Filtermesh demos/data/blob5.orig.m -randpts 10000 -vertexpts | \
Meshfit -mfile demos/data/blob5.orig.m -file - -crep 1e-6 -simplify | \
G3dOGL -st demos/data/blob5.s3d -key DmDe
To view the real-time fitting optimization,
Meshfit -mfile distcap.recon.m -file demos/data/distcap.pts \
-crep 1e-5 -outmesh - -record -reconstruct | \
G3dOGL -st demos/data/distcap.s3d -key DmDeDC -async -terse
This related program performs a similar optimization of a 1D polyline (either open or closed) to fit a set of 2D points. For example,
Polyfit -pfile curve1.a3d -file demos/data/curve1.pts -crep 3e-4 -spring 1 -reconstruct | \
G3dOGL demos/data/curve1.pts -input -st demos/data/curve1.s3d
In a subdivision surface representation, a coarse base mesh tagged with sharp edges defines a piecewise smooth surface as the limit of a subdivision process. Such a representation both improves geometric fidelity and leads to a more concise description.
Filtermesh distcap.opt.m -angle 52 -mark | \
Subdivfit -mfile - -file demos/data/distcap.pts -crep 1e-5 -csharp .2e-5 -reconstruct >distcap.sub0.m
1e-5
per vertex and .2e-5
per sharp edge, andTo view the result,
G3dOGL distcap.sub0.m "Subdivfit -mf distcap.sub0.m -nsub 2 -outn |" \
-st demos/data/distcap.s3d -key NDmDe -hwdelay 5 -hwkey N
This program computes measures of differences between two meshes. It samples a dense set of points from a first mesh and computes the projections of each point onto the closest point on a second mesh.
MeshDistance -mfile distcap.recon.m -mfile distcap.opt.m -bothdir 1 -maxerror 1 -distance
MeshDistance
loads the earlier results of mesh reconstruction and mesh optimization,Given a mesh, MeshSimplify
applies a sequence of edge collapse operations
to simplify it to a coarse base mesh while trying to best preserve the appearance of the original model.
It supports many different simplification criteria, as well as face properties,
edges tagged as sharp, and vertex and corner attributes
(nx,ny,nz normals,
r,g,b colors, and u,v texture coordinates).
MeshSimplify demos/data/club.orig.m -prog club.prog -simplify >club.base.m
*.prog
file, andThe next step is to reverse the sequence of stored edge collapses, i.e. forming a progressive sequence of vertex splits:
reverselines club.prog >club.rprog
We construct a concise progressive mesh by encoding the base mesh together with the sequence of vertex splits that exactly recover the original mesh:
Filterprog -fbase club.base.m -fprog club.rprog -pm_encode >club.pm
The complete process from the original mesh to the progressive mesh is implemented by the script call
demos/bin/meshtopm.{sh,bat} demos/data/club.orig.m >club.pm
Given a progressive mesh, we can interactively traverse its continuous levels of detail:
G3dOGL -pm_mode club.pm -st demos/data/club.s3d -lightambient .4
We can also define geomorphs between discrete levels of detail, e.g.
FilterPM club.pm -nfaces 2000 -geom_nfaces 3300 -geom_nfaces 5000 -geom_nfaces 8000 | \
G3dOGL -st demos/data/club.s3d -key SPDeN -lightambient .5 -thickboundary 1 -video 101 - | \
VideoViewer - -key m
This example displays a progressive mesh after truncating all detail below 300 faces and above 10000 faces:
FilterPM demos/data/standingblob.pm -nf 300 -truncate_prior -nf 10000 -truncate_beyond | \
G3dOGL -pm_mode - -st demos/data/standingblob.s3d
As an example of simplifying meshes with appearance attributes,
Filterimage demos/data/gaudipark.png -scaletox 200 -tomesh | \
MeshSimplify - -nfaces 4000 -simplify | \
G3dOGL -st demos/data/imageup.s3d -key De -lightambient 1 -lightsource 0
Within demos/create_sr_office
, the script call
meshtopm.{sh,bat} demos/data/office.nf80000.orig.m -vsgeom >office.sr.pm
creates a progressive mesh in which the simplified vertices are constrained to lie
at their original positions (-vsgeom
).
This enables selective refinement, demonstrated by
G3dOGL -eyeob demos/data/unit_frustum.a3d -sr_mode office.sr.pm -st demos/data/office_srfig.s3d \
-key ,DnDeDoDb -lightambient .4 -sr_screen_thresh .002 -frustum_frac 2
The mesh is adaptively refined within the view frustum, shown as the inset rectangle (key Do) or in the top view (key Dr). Drag the mouse buttons to rotate, pan, and dolly the object.
Within demos/create_sr_terrain.{sh,bat}
,
Filterimage demos/data/gcanyon_elev_crop.bw.png -tobw -elevation -step 6 -scalez 0.000194522 \
-removekinks -tomesh | \
Filtermesh -assign_normals >gcanyon_sq200.orig.m
demos/bin/meshtopm.{sh,bat} gcanyon_sq200.orig.m -vsgeom -terrain >gcanyon_sq200.pm
Then, within demos/view_sr_terrain.sh
,
(common="-eyeob demos/data/unit_frustum.a3d -sr_mode gcanyon_sq200.pm -st demos/data/gcanyon_fly_v98.s3d \
-texturemap demos/data/gcanyon_color.1024.png -key DeDtDG -sr_screen_thresh .02292 -sr_gtime 64 \
-lightambient .5"; \
export G3D_REV_AUTO=1; \
G3dOGL $common -geom 800x820+100+10 -key "&O" -key ,o----J | \
G3dOGL $common -geom 800x820+920+10 -async -killeof -input -key Dg)
For large terrain meshes, we form a hierarchical progressive mesh by partitioning the terrain mesh into tiles, simplifying each tile independently to form a progressive mesh, stitching the progressive meshes together 2-by-2, and recursively simplifying and merging at coarser pyramid levels.
An example is presented in demos/create_terrain_hierarchy
. It makes use of
StitchPM -rootname terrain.level0 -blockx 2 -blocky 2 -blocks 32 -stitch >terrain.level0.stitched.pm
to assemble each 2-by-2 set of progressive mesh tiles terrain.level0.x{0,1}.y{0,1}.pm
at the finest level.
The script demos/view_gcanyon_interactive
launches an interactive flythrough over a Grand Canyon terrain model,
using a progressive mesh precomputed from an original 4096×2048 height field.
Alternatively, demos/view_gcanyon_frames
shows a real-time flythrough using a pre-recorded flight path,
whereby keystroke commands embedded within the input stream automatically change viewing modes.
The program MinCycles
removes topological noise from a mesh
by iteratively pinching off the smallest nonseparating cycle of edges until a
specified criterion (cycle length, number of cycle edges, number of cycles, or mesh genus) is reached.
For example, within demos/create_topologically_simplified.{sh,bat}
,
FilterPM demos/data/office.pm -nf 200000 -outmesh | \
MinCycles - -fraccyclelength 1.2 -maxcyclelen 0.10 -closecycles | \
G3dOGL -st demos/data/office.s3d -key DeDEJ---- -thickboundary 0 -lightambient .9
0.10
.The G3dOGL
program shows interactive rasterized renderings of 3D (and 2D) geometry,
represented as
*.a3d
format),*.m
),*.pm
),*.srm
),*.psc
), or*.ply
files.Please see the many examples presented earlier.
The viewer can also read *.frame
elements to position the viewer and the objects in world space.
Elements of *.a3d
, *.m
, and *.frame
streams can all be interleaved in a single input stream.
The viewer can take image snapshots (see demos/create_rendered_mechpart_image
) and
record videos (see demos/create_rendered_mechpart_video
).
The mouse/keyboard UI controls include:
Mouse movements: left mouse: rotate middle mouse: pan right mouse: dolly shift-left: pan shift-middle mouse: roll shift-right mouse: zoom (mouse movements are with respect to current object; see '0-9' below) Important key strokes: ? : print complete list of keys D?: print list of keys prefixed by 'D' De: toggle edges Ds: toggle shading of faces Db: toggle backface culling Dm: toggle Gouraud/flat shading DP: save current window as an image file DS: toggle show some sliders S : toggle show some other sliders j : jump to a default viewpoint J : automatically rotate object D/: edit viewpoint filename , : read the viewpoint . : save the viewpoint 0-9: select object (0=eye_frame, 1=first object, 2=second object...) u : display/hide current object N : select next object P : select previous object -=: decrease/increase the magnitude of all movements f : toggle flying (usually with '0' eye selected)
To record a 6-second (360-frame) video of a rotating mesh and then view the resulting video:
G3dOGL demos/data/standingblob.orig.m -st demos/data/standingblob.s3d -key iioJ \
-video 360 output_video.mp4
VideoViewer output_video.mp4
The related program G3dVec
shows wireframe hidden-line-removed renderings of *.a3d
streams and *.m
meshes.
It can write vector-based Postscript figures (see demos/view_hidden_line_removed
).
In both programs, the keys ? and D? show a list of available keyboard commands.
The VideoViewer
program enables interactive viewing and simple editing of both images and videos.
Again, the key ? shows a list of available keyboard commands.
Press pageup/pagedown to quickly browse through the videos and/or images in a directory.
Audio is not currently supported.
*.m
)See the documentation at the end of libHh/GMesh.h
A mesh is a set of vertices and faces. These in turn also define edges and corners.
Arbitrary string tuples can be associated with vertices, faces, edges, and corners.
Examples of string tuples:
{normal=(.1 .2 .3) rgb=(1 1 1) matid=5 material="string"}
.
See the several demos/data/*.m
files for examples of the mesh format.
Note that the indices of vertices and faces start at 1 instead of 0;
in hindsight that was a poor choice.
*.a3d
, *.pts
)See the documentation at the end of libHh/A3dStream.h
The stream contains polygons, polylines, points, and control codes (like end-of-frame, end-of-input, change-of-object). Unlike in a mesh, these primitives do not share vertices. The stream can be either text or binary.
*.frame
, *.s3d
)See the documentation at the end of libHh/FrameIO.h
This text or binary format encodes a 4×3 affine transformation (plus an object id and a scalar field-of-view zoom). It is used to record default viewing configurations, and sequences of frames for flythroughs. It usually represents the linear transform from object space (or eye space) to world space. The stream can be either text or binary.
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论