Often the result obj files produced by City3D are valid but not closed and showing face orientation issues.
In details
Me and @LelouchLiBritania are currently testing City3D to try and produce 3D buildings using @IGNF new LIDAR datasets. Our work in progress is available here https://github.com/ignfab/City3D/.
We were successful in producing 3D models with City3D save a small number of cases where reconstruction fails.
However we noted that a large of number City3D results were showing face orientations issues. Trying to fix this classic issue with CGAL , we also noted than a large number of these models were also not closed and therefore could not be fixed with PMP::orient_to_bound_a_volume() directly.
How to reproduce and more explanations
I created a minimal repository at https://github.com/esgn/city3d-result-check containing 23_result.obja result from the default City3D dataset produced by CLI_Example_2 with Gurobi, a Python script to fix this result and a CGAL executable to perform the final cleanup and fix faces orientations.
Here is a screenshot of 23_result.obj before fixing or cleanup showing all the faces but the floor incorrectly oriented :
Trying to fix 23_result.obj directly with CGAL make the following issues apparent :
The model could not be closed
The model showed self intersecting faces
Here is an example of what CGAL detects as self intersecting faces :
Inspecting these self intersecting faces it appears most of them are caused by a vertex of a wall face missing from an edge of the floor face. To say it in a different way, it is as if the floor face was added at the end of the reconstruction process without adding the necessary vertices lying at the bottom of the wall faces. Note that these self intersecting faces can sometimes occur between wall faces or between wall face and roof face but these cases are less prevalent.
Adding the missing vertices is exactly what the Python script provided in the repository does. Having added the missing vertices, the CGAL executable works without error and produces a clean 3D model with faces correctly oriented as shown below
My question : Would it be possible to improve City3D so that the produced models are directly closed and correctly oriented so that we could skip this post processing phase ?
Note that we are also trying an alternative approach using CGAL alpha wrapper and edge collapse to fix this same issue and to also merge co-planar faces while we are it.
@yidahuang I think this can be easily solved by taking advantage of the known orientation of walls, thereby automatically stitching the faces to form closed models. How is this going?
Bug description
In short
Often the result obj files produced by City3D are valid but not closed and showing face orientation issues.
In details
Me and @LelouchLiBritania are currently testing City3D to try and produce 3D buildings using @IGNF new LIDAR datasets. Our work in progress is available here https://github.com/ignfab/City3D/.
We were successful in producing 3D models with City3D save a small number of cases where reconstruction fails. However we noted that a large of number City3D results were showing face orientations issues. Trying to fix this classic issue with CGAL , we also noted than a large number of these models were also not closed and therefore could not be fixed with
PMP::orient_to_bound_a_volume()
directly.How to reproduce and more explanations
I created a minimal repository at https://github.com/esgn/city3d-result-check containing
23_result.obj
a result from the default City3D dataset produced byCLI_Example_2
with Gurobi, a Python script to fix this result and a CGAL executable to perform the final cleanup and fix faces orientations.Here is a screenshot of
23_result.obj
before fixing or cleanup showing all the faces but the floor incorrectly oriented :Trying to fix
23_result.obj
directly with CGAL make the following issues apparent :Here is an example of what CGAL detects as self intersecting faces :
Inspecting these self intersecting faces it appears most of them are caused by a vertex of a wall face missing from an edge of the floor face. To say it in a different way, it is as if the floor face was added at the end of the reconstruction process without adding the necessary vertices lying at the bottom of the wall faces. Note that these self intersecting faces can sometimes occur between wall faces or between wall face and roof face but these cases are less prevalent.
Adding the missing vertices is exactly what the Python script provided in the repository does. Having added the missing vertices, the CGAL executable works without error and produces a clean 3D model with faces correctly oriented as shown below
My question : Would it be possible to improve City3D so that the produced models are directly closed and correctly oriented so that we could skip this post processing phase ?
Note that we are also trying an alternative approach using CGAL alpha wrapper and edge collapse to fix this same issue and to also merge co-planar faces while we are it.
Development/Running environment:
Thanks in advance,