Comments (8)
@unlugi No problem! With MeshLab installed, load up a mesh, then select
filters -> Remeshing, Simplification and reconstruction
then chose one of the simplification methods. tweak the settings until you get satisfactory results. You might want to try these settings on multiple meshes from your dataset to make sure they generalise well. Specifying a percentage reduction instead of a target number of faces may genealise better for example. Note that some methods break the manifold-ness ("repair non manifold vertices by splitting" may help).
Once a proper workflow is established, select filters -> show current filter script -> save script
This script can be run by calling the meshlab server from the command line, passing the script and mesh to process as arguments. This allows you to chain the manifoldPlus script followed by the simplification script in a Bash file looping over each mesh to process. I learned bash for this project so the following code is very messy and will need quite a lot of playing around with but should be an alright starting point. Note that the way you call meshlab server can change based on how it was installed. I've seen people just call meshlabserver
but my snap install needed snap run meshlab.meshlabserver
#!/bin/bash
# produces a folder for manifoldPlus output and another for the further simplified data
outputFolder="manifoldSimp"
simplificationScript="simplification.mlx"
for category in data/style/*; do
if [ -d $category ]; then
[ -d $category/manifold ] || mkdir $category/manifold
[ -d $category/$outputFolder ] || mkdir $category/$outputFolder
for filename in $category/train/*.obj; do
echo $(basename "$filename") "$filename"
[ -f "$category/manifold/$(basename "$filename")" ] || ./ManifoldPlus/build/manifold --input "$filename" --output "$category/manifold/$(basename "$filename")" --depth 8
[ -f "$category/$outputFolder/$(basename "$filename")" ] || snap run meshlab.meshlabserver -i "$category/manifold/$(basename "$filename")" -o "$category/$outputFolder/$(basename "$filename")" -s "$simplificationScript"
done
fi
done
My chosen model (meshCNN) produced OOM errors for meshes that were still too large after simplification (a problem of using percentage reduction simplification). You can call compute topological measures
within meshlab and parse the output to console to automatically remove large meshes during processing. This isnt recommended for doing like-for-like comparisons with other methods but can trim down the dataset for quick prototyping.
#!/bin/bash
# Skips meshes that start with over 90000 faces, and also doesn't output a file if the processed mesh does not end up less than 20000 faces
# name of class subfolder where remeshed files will be saved
outputFolder="trimmed"
meshInfoScript='getMeshInfo.mlx'
# link to meshLab script
simplificationScript="simplification.mlx"
# regex to extract number of faces from script output
regex='([0-9]+) fn'
function runMeshLabScript {
# input location: $1
# output location: $2
# script to use: $3
# return: array {input#faces, output#faces}
mapfile -t output < <(snap run meshlab.meshlabserver -i "$1" -o "$2" -s "$3" 2>/dev/null |
while IFS= read -r line; do
if [[ $line =~ $regex ]]; then
name="${BASH_REMATCH[1]}"
echo $name
fi
done)
}
for category in data/style/*; do
if [ -d $category ]; then
# make sub-folder if it doesn't not already exist
[ -d $category/$outputFolder ] || mkdir $category/$outputFolder
for filename in $category/train/*.obj; do
echo $(basename "$filename") "$filename"
# check if file has already been processed
if [ ! -f "$category/$outputFolder/$(basename "$filename")" ]; then
# if mesh has too many faces to begin with, give up
runMeshLabScript $filename $category/$outputFolder/$(basename "$filename") $meshInfoScript
echo "mesh has ${output[0]} faces"
if ((output[1] > 90000)); then
echo "to be deleted"
rm "$category/$outputFolder/$(basename "$filename")"
else
# parse output of script for input and processed mesh number of faces
runMeshLabScript "$filename" "$category/$outputFolder/$(basename "$filename")" "$simplificationScript"
echo "remeshed and simplified to ${output[1]} faces"
# throw away mesh if it is above a certain number of faces. Too computationally expensive to process by model
if ((output[1] > 20000)); then
echo "to be deleted"
rm "$category/$outputFolder/$(basename "$filename")"
fi
fi
fi
done
fi
done
I've since moved on from this project but let me know if you need any other help
from manifoldplus.
I also had this issue. My solution was to use the mesh simplification script that comes with MeshLab. The function "Simplification: quadratic edge collapse decimation" with a desired percentage reduction of for example 0.1, preserving boundary of the mesh etc. This action can then be automated to run from the command line similarly to the original simplify script from the other repo. Let me know if you need further help
from manifoldplus.
@CallumMcMahon Thank you for the suggestion! I am in a similar situation; could you please point me to MeshLab's mesh simplification script and give a few hints about automating it to run from the command line. Thanks!
from manifoldplus.
@CallumMcMahon Thank you so much for the detailed explanation and suggestions. I am trying it out for myself right now.
from manifoldplus.
@CallumMcMahon @hjwdzh
Hi, I also met such a problem and I have also tried meshlab to simplify the mesh from ManifoldPLUS. Some of the output from ManifoldPLUS have some holes in the surface, like this one:
.
Some other ManifoldPLUS outputs do not have such holes. But if I apply "Simplification: quadratic edge collapse decimation" from meshlab on it, some holes appear, like this one:
Do you have any suggestions on how to fix it? Whether on meshlab or some other method is ok.
Looking forward to you reply. Thank you very much!!
from manifoldplus.
@1999kevin Hi, have you solved the problem? I'm also trying to use Meshlab to simplify the meshes and find that it produces non-watertight meshes with holes. Do you have some advice?
from manifoldplus.
@CallumMcMahon @hjwdzh Hi, I also met such a problem and I have also tried meshlab to simplify the mesh from ManifoldPLUS. Some of the output from ManifoldPLUS have some holes in the surface, like this one:
.
Some other ManifoldPLUS outputs do not have such holes. But if I apply "Simplification: quadratic edge collapse decimation" from meshlab on it, some holes appear, like this one:
Do you have any suggestions on how to fix it? Whether on meshlab or some other method is ok. Looking forward to you reply. Thank you very much!!
hello, I have same issues, did you solve it?
from manifoldplus.
Related Issues (20)
- Question on zero-volume structures HOT 2
- License and Godot
- Output Mesh Missing UV Map HOT 1
- Build error
- renaming the executable name in examples.sh HOT 1
- Issues on converting ShapeNet meshes HOT 4
- Requires Manifold? HOT 2
- Output is NOT generated HOT 1
- How to generate color mesh output ?
- When the model have texture.
- point cloud reconstruction example HOT 4
- reconstion always bigger than the original model HOT 2
- Unable to build make -j8, what to do?
- License HOT 1
- ./manifold --input input.obj --output output.obj --depth 8 HOT 5
- Artifacts in the results HOT 4
- Watertight check with Trimesh HOT 5
- Simplify from Manifold HOT 1
- Installation problem HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from manifoldplus.