ACVD icon indicating copy to clipboard operation
ACVD copied to clipboard

ACVD fails using .obj format as input

Open RogersDoug opened this issue 9 years ago • 12 comments

I built ACVD on Windows 10 64 bit, VS2015, VTK 7.0.0.

Using .obj files as input does not correctly generate output ply files.

RogersDoug avatar Mar 12 '16 20:03 RogersDoug

Do you have an example file to share and/or a log?

valette avatar Mar 12 '16 21:03 valette

The vtx obj reader is increasing the point count if there are normals or texture coordinates causing the remesh to fail.

https://www.dropbox.com/s/qd8rprg3o6p7ncr/bunny.zip?dl=0

As a test, I eliminated normals and texture coordinates from the OBJ reader. This fixed the issue, but it is an not ideal fix. Can ACVD be extended to support vertex attributes like normals and texture coordinates?

RogersDoug avatar Mar 12 '16 22:03 RogersDoug

Is there a way to get a list of all the clustered faces that will produce a vertex on the reduced mesh?

RogersDoug avatar Mar 12 '16 22:03 RogersDoug

The vtx obj reader is increasing the point count if there are normals or texture coordinates causing the remesh to fail.

https://www.dropbox.com/s/qd8rprg3o6p7ncr/bunny.zip?dl=0

Launching ACVD on this mesh gives me : ./ACVD bunny.obj 1000 0 load : bunny.obj


Mesh with 69664 polygons, 208992 points, 208992 edges Bounding Box: [-94.6899, 32.9874, -61.8736] [61.0091, 187.321, 58.7997] The mesh is made of 69664 triangles 208992 non-manifold edges and 208992 boundary edges The mesh has 69664 connected components Valences entropy: 0 0 disconnected vertices, 208992 connected vertices 100 percent of irregular vertices Mesh geometry quality: AngleMin=0.000472145 AverageMinAngle=36.744 Qmin=7.1367e-06 Qav=0.712631 P30=2.35081

The two important lines are : The mesh is made of 69664 triangles The mesh has 69664 connected components

which means that this is a triangle soup and not a surface mesh. Triangles need to be connected.

As a test, I eliminated normals and texture coordinates from the OBJ reader. This fixed the issue,

Are you shure you have not also merged vertices to get a one-connected component mesh?

valette avatar Mar 15 '16 09:03 valette

Is there a way to get a list of all the clustered faces that will produce a vertex on the reduced mesh?

the code is not written but in ACVD.cxx, you can get the clustering result as Clusterging->GetClustering() which returns for each vertex its associated cluster i.e. the vertex in the new mesh

valette avatar Mar 15 '16 09:03 valette

which means that this is a triangle soup and not a surface mesh. Triangles need to be connected.

They are connected as a surface in the in the input file, but the obj reader splits them. There are two issues.

  1. obj read splits points if the attributes are difference (texture coordinate or normals)

  2. ACVD does not support vertex attributes.

RogersDoug avatar Mar 15 '16 23:03 RogersDoug

obj read splits points if the attributes are difference (texture coordinate or normals)

If that's really the case, it is a problem from vtkOBJReader, you should ping vtk developers; the easiest way would be the vtkusers mailing list

ACVD does not support vertex attributes.

Do you mean that you want also vertex attributes to be present in the simplified mesh?

valette avatar Mar 16 '16 09:03 valette

Do you mean that you want also vertex attributes to be present in the simplified mesh?

Yes. That is exactly what I want. I want the normals and texture coordinates and all vertex data for the simplified mesh.

So we are on the same page, let me make some definitions. A point is a 3d position only (x,y,z). A vertex has a point and other attributes like a normal or texture coordinate. For a cube that has vertex normals for each face, you will have eight points, but 24 vertices (6 faces x 4 verts/face). Each vertex on the face will have the same normal. To maintain discontiguous normals or texture coordinates on a per vertex basis, you must duplicate the points (or have the verts refer to them).

Points image

Normals

image

It looks like the OBJ reader duplicates points, when it should duplicate vertices.

So after simplification, I would like to get the vertex attributes. Ideally the simplification process would be based on vertices, not points only.

Also it would be better to only collapse edges that are along seams or toward them to maintain visual quality of texture and normal borders.

RogersDoug avatar Mar 17 '16 03:03 RogersDoug

I think putting more logic in attributes handling will be very difficult, as handling these attributes is user-dependent.

What about providing the clustering results (a vertex -> cluster lookup table), using clustering->GetClustering? I could easily do that, and the remaining would have to be performed by the end-user.

valette avatar Apr 11 '16 09:04 valette

The simplification process need to be affected. Handling material or texture boundary conditions would be more useful and could be implemented the same way that boundary conditions are.

See the section 6 about preserving boundary conditions. http://cseweb.ucsd.edu/~ravir/190/2016/garland97.pdf

RogersDoug avatar May 09 '16 15:05 RogersDoug

ACVD handles boundaries differently, see section VI.D here : https://hal.archives-ouvertes.fr/hal-00537025/document

I had forgotten to expose this option. I just did it in this commit : f66daace39c46ea4b9a4d1c247ce7c972830aa84

This option is not perfect but should suit a lot of boundary cases. Does it improve your case?

valette avatar May 10 '16 09:05 valette

My interest is in material boundaries vs. mesh boundaries. If I have a sphere with one material in the top half and another material in the bottom half, I would like the result to be that no triangle spans both halves. This is important for simplifying meshes with multiple materials.

RogersDoug avatar May 10 '16 16:05 RogersDoug