Coder Social home page Coder Social logo

Comments (12)

mcallieri avatar mcallieri commented on May 18, 2024 1

Another possible cause for the Screened Poisson filter to fail is that the new Poisson does require valid normals on ALL points. Try to see if the model can be merged in MeshLab.
If needed, to remove points with invalid normals, you may use "conditional vertex selection" using "nx == 0" as selection criteria, and then "delete selected vertices".

from meshlab.

granzuglia avatar granzuglia commented on May 18, 2024

I confirm the issue.
The "no additional memory available!!! memory required: 91928760" is a harmless warning and it's not related with the problem. Instead, I suppose, you get something like "[ERROR] Failed to open file: PR_XXXXX". That's a specific problem related with the filter_screened_poisson filter. Please confirm if you get this message too. We are working on that issue.

from meshlab.

leonardo89 avatar leonardo89 commented on May 18, 2024

I don't get error to open file but this output:

C:\Program Files\VCG\MeshLab2016> .\meshlabserver -i .\model.stl -o out.ply -s .\script.xml
Loading Plugins:
Current Plugins Dir is: C:/Program Files/VCG/MeshLab2016/plugins
Total 241 filtering actions
Total 12 io plugins
Opening a file with extention stl
Mesh C:/Program Files/VCG/MeshLab2016/model.stl loaded has 2514423 vn 838141 fn
output mesh  C:/Program Files/VCG/MeshLab2016/out.ply
Apply FilterScript: 'C:/Program Files/VCG/MeshLab2016/script.xml'
FilterScript
Reading filter with name Screened Poisson Surface Reconstruction
Starting Script of 1 actionsfilter: Screened Poisson Surface Reconstruction
no additional memory available!!! memory required: 70403844
Problem with filter: Screened Poisson Surface Reconstruction
Failed to apply script file C:/Program Files/VCG/MeshLab2016/script.xml

Thank you

from meshlab.

granzuglia avatar granzuglia commented on May 18, 2024

Maybe i found the problem. Screened Poisson filter creates temporary files, unfortunately if you launch meshlabserver.exe from C:/Program Files/VCG/MeshLab2016/ Windows doesn't allow you to save output files in the C:/Program Files subfolders. An easy workaround is to launch meshlabserver from the directory where you have the input files. For instance suppose you have the file in C:\test you should do

  • cd C:\test
  • "C:\Program Files\VCG\MeshLab2016\meshlabserver.exe" -i input.ply -w output.mlp -s myscript.xlm

In C:\test now you should have a file called Poissonmesh_out.ply containing the result of the screened poisson filter. Let me know if it solves your problem.

PS I used the -w option because it will save automatically all the meshes generated by the filters included in the script files. Being the Screened poisson filter a filter creating a new layer if you want to save the output file generated by the poisson filter you should write something like

  • "C:\Program Files\VCG\MeshLab2016\meshlabserver.exe" -i input.ply -o out1.ply -o poisson_res.ply -s myscript.xlm
    poisson_res.ply will contained the result of the screened poisson algorithm, while out1.ply will contain a copy of the input.ply file.

We will try to fix the problem in the next release of MeshLab.

from meshlab.

leonardo89 avatar leonardo89 commented on May 18, 2024

It is not a folder permission problem, I tried calling script from another path, changed Meshlab folder permission, etc..

And neither a normals problem (I do Re-Compute Vertex Normals filter before poisson).

:(

from meshlab.

granzuglia avatar granzuglia commented on May 18, 2024

the problem could be related with unreferenced vertices...did you try to call the filter "remove unreferenced vertices" before the screened poisson filter?

Obviously i assume that you launched the filter on the meshes inside MeshLab itself and you were able to get a meaningful result....

from meshlab.

leonardo89 avatar leonardo89 commented on May 18, 2024

Yes, there aren't unrefered vertices. Inside Meshlab filter works fine. It is from meshlabserver that there are problems.

from meshlab.

granzuglia avatar granzuglia commented on May 18, 2024

Can you upload somewhere the smallest mesh causing you this problem?

from meshlab.

leonardo89 avatar leonardo89 commented on May 18, 2024

Deleting vertices with normals = 0 prior to filter seem to work.
But pre-clean of Poisson shouldn't do it?

Thanks

from meshlab.

leonardo89 avatar leonardo89 commented on May 18, 2024

Here is a sample model
scan.zip

Screened Poisson Pre-clean doesn't work so I have to make:

<filter name="Conditional Vertex Selection">
  <Param description="boolean function" value="nx == 0" name="condSelect" type="RichString" tooltip="type a boolean function that will be evaluated in order to select a subset of vertices&lt;br>example: (y > 0) and (ny > 0)"/>
 </filter>
 <filter name="Delete Selected Vertices"/>
<filter name="Remove Unreferenced Vertices"/> 
<filter name="Re-Compute Vertex Normals">
  <Param enum_val3="As defined by N. Max" value="0" description="Weighting Mode:" enum_val0="None (avg)" enum_val1="By Angle" name="weightMode" type="RichEnum" enum_cardinality="4" tooltip="" enum_val2="By Area"/>
 </filter>

Before applying Poisson. After that I apply Simplification: Quadric Edge Collapse Decimation:

 <filter name="Simplification: Quadric Edge Collapse Decimation">
  <Param value="70000" description="Target number of faces" name="TargetFaceNum" type="RichInt" tooltip="The desired final number of faces."/>
  <Param value="0" description="Percentage reduction (0..1)" name="TargetPerc" type="RichFloat" tooltip="If non zero, this parameter specifies the desired final size of the mesh as a percentage of the initial size."/>
  <Param value="0.3" description="Quality threshold" name="QualityThr" type="RichFloat" tooltip="Quality threshold for penalizing bad shaped faces.&lt;br>The value is in the range [0..1]&#xa; 0 accept any kind of face (no penalties),&#xa; 0.5  penalize faces with quality &lt; 0.5, proportionally to their shape&#xa;"/>
  <Param value="false" description="Preserve Boundary of the mesh" name="PreserveBoundary" type="RichBool" tooltip="The simplification process tries to do not affect mesh boundaries during simplification"/>
  <Param value="1" description="Boundary Preserving Weight" name="BoundaryWeight" type="RichFloat" tooltip="The importance of the boundary during simplification. Default (1.0) means that the boundary has the same importance of the rest. Values greater than 1.0 raise boundary importance and has the effect of removing less vertices on the border. Admitted range of values (0,+inf). "/>
  <Param value="false" description="Preserve Normal" name="PreserveNormal" type="RichBool" tooltip="Try to avoid face flipping effects and try to preserve the original orientation of the surface"/>
  <Param value="false" description="Preserve Topology" name="PreserveTopology" type="RichBool" tooltip="Avoid all the collapses that should cause a topology change in the mesh (like closing holes, squeezing handles, etc). If checked the genus of the mesh should stay unchanged."/>
  <Param value="true" description="Optimal position of simplified vertices" name="OptimalPlacement" type="RichBool" tooltip="Each collapsed vertex is placed in the position minimizing the quadric error.&#xa; It can fail (creating bad spikes) in case of very flat areas. &#xa;If disabled edges are collapsed onto one of the two original vertices and the final mesh is composed by a subset of the original vertices. "/>
  <Param value="false" description="Planar Simplification" name="PlanarQuadric" type="RichBool" tooltip="Add additional simplification constraints that improves the quality of the simplification of the planar portion of the mesh."/>
  <Param value="false" description="Weighted Simplification" name="QualityWeight" type="RichBool" tooltip="Use the Per-Vertex quality as a weighting factor for the simplification. The weight is used as a error amplification value, so a vertex with a high quality value will not be simplified and a portion of the mesh with low quality values will be aggressively simplified."/>
  <Param value="false" description="Post-simplification cleaning" name="AutoClean" type="RichBool" tooltip="After the simplification an additional set of steps is performed to clean the mesh (unreferenced vertices, bad faces, etc)"/>
  <Param value="false" description="Simplify only selected faces" name="Selected" type="RichBool" tooltip="The simplification is applied only to the selected set of faces.&#xa; Take care of the target number of faces!"/>
 </filter>

But result is very bad with meshlabserver

result

Same script loaded by Meshlab GUI:

result_meshlab

Which seem right, so something is wrong with meshlabserver.

Here the full script used:
script.zip

from meshlab.

mcallieri avatar mcallieri commented on May 18, 2024

ok, found: MeshLab server works like MeshLab, the concept of "current" layer is important.
In MeshLab (GUI), when you use the poisson filter, a new layer is created, but the CURRENT layer is still the first one. In order to apply simplification to the new layer, you have to firstly make it the current one.
You may do it using filter->mesh layer->"change the current layer"

so, in the script, after the poisson filter, and before the simplification, add

<filter name="Change the current layer">
  <Param tooltip="The name of the current mesh" type="RichMesh" value="1" name="mesh" description="Mesh"/>
 </filter>

And the simplification will be applied correctly to the newly created layer. (remember to save both layers, and not just the first)

in alternative, you may remove the first layer, as it is not useful anymore, using filter->mesh layer->"delete current mesh".
just add after poisson and before simplyfication

In this way you will also have the advantage of saving only ONE layer, that is your final result

I would use this script: newscript.zip

and call it with:
meshlabserver.exe -i scan.ply -o result.ply -s newscript.xml

Finally:
why simplyfying scan.ply makes a mess? because the mesh is made of unconnected triangles... all vertices are replicated, and each triangle is on its own. it is impossible to simplify, because there is no connected surface.

the "remove unreferenced vertices" and "recompute normals" are not really useful, in this case. I removed them from "newscript.xml"

from meshlab.

leonardo89 avatar leonardo89 commented on May 18, 2024

Thank you very much for the explanation. Layer concept of meshlab is not so intuitive, some filter create new layers, other not..

I think issues can be summarized with the following:

  • Pre-clean
  • Memory warning message

Last question: there is a way to use Poisson with multi thread? Meshlab output display:

Running Screened Poisson Reconstruction (Version 9.0)
Using 1 threads

Thank you again
Ciao

from meshlab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.