Closed hoshiryu closed 6 years ago
Here are the stats for the hashing:
Dana 1 (202 536 faces): load_factor: 0.795805 -- max_load_factor: 1 -- #buckets: 444 487 -- #collisions: 353 705
Dana 2 (810 144 faces): load_factor: 0.775946 -- max_load_factor: 1 -- #buckets: 1 832 561 -- #collisions: 1 421 948
Hand 2 (369 840 faces): load_factor: 0.722781 -- max_load_factor: 1 -- #buckets: 902 483 -- #collisions: 652 220
using the following hashing (for both conversions):
size_t hx = std::hash<Scalar>()(lvalue[0]);
size_t hy = std::hash<Scalar>()(lvalue[1]);
size_t hz = std::hash<Scalar>()(lvalue[2]);
return (hx ^ (hy << 1)) ^ hz;
I get these timings (which are way better) and stats (which are strangely the same):
##### Dana (1 subdiv) #####
- 03:03:55 PM INFO: Try subdiv
- 03:03:55 PM INFO: Topo done
- 03:03:55 PM INFO: Subdiv done
- 03:03:55 PM INFO: Starting back to core (202536faces)
- 03:03:55 PM INFO: add attributes done
- 03:03:55 PM INFO: recompute normals done
- 03:03:55 PM INFO: transferred 9% of faces (55510 vertices in the map)
- 03:03:55 PM INFO: transferred 19% of faces (105845 vertices in the map)
- 03:03:55 PM INFO: transferred 29% of faces (148265 vertices in the map)
- 03:03:55 PM INFO: transferred 39% of faces (190816 vertices in the map)
- 03:03:55 PM INFO: transferred 49% of faces (232853 vertices in the map)
- 03:03:55 PM INFO: transferred 59% of faces (261208 vertices in the map)
- 03:03:55 PM INFO: transferred 69% of faces (287485 vertices in the map)
- 03:03:55 PM INFO: transferred 79% of faces (309608 vertices in the map)
- 03:03:55 PM INFO: transferred 89% of faces (331849 vertices in the map)
- 03:03:55 PM INFO: transferred 99% of faces (353716 vertices in the map)
- 03:03:55 PM INFO: map info:0.795805 -- 1 -- 444487
- 03:03:55 PM INFO: map collisions: 252421
- 03:03:55 PM INFO: Back to core done
- 03:03:55 PM INFO: Mesh ready
- 03:03:56 PM INFO: Just tried re-topo
##### Dana (2 subdiv) #####
- 03:01:36 PM INFO: Try subdiv
- 03:01:36 PM INFO: Topo done
- 03:01:37 PM INFO: Subdiv done
- 03:01:37 PM INFO: Starting back to core (810144faces)
- 03:01:37 PM INFO: add attributes done
- 03:01:37 PM INFO: recompute normals done
- 03:01:38 PM INFO: transferred 9% of faces (234359 vertices in the map)
- 03:01:38 PM INFO: transferred 19% of faces (432404 vertices in the map)
- 03:01:38 PM INFO: transferred 29% of faces (609393 vertices in the map)
- 03:01:38 PM INFO: transferred 39% of faces (774731 vertices in the map)
- 03:01:38 PM INFO: transferred 49% of faces (939906 vertices in the map)
- 03:01:39 PM INFO: transferred 59% of faces (1051070 vertices in the map)
- 03:01:39 PM INFO: transferred 69% of faces (1153138 vertices in the map)
- 03:01:39 PM INFO: transferred 79% of faces (1246521 vertices in the map)
- 03:01:39 PM INFO: transferred 89% of faces (1334130 vertices in the map)
- 03:01:39 PM INFO: transferred 99% of faces (1421966 vertices in the map)
- 03:01:39 PM INFO: map info:0.775946 -- 1 -- 1832561
- 03:01:40 PM INFO: map collisions: 1016828
- 03:01:40 PM INFO: Back to core done
- 03:01:40 PM INFO: Mesh ready
- 03:01:41 PM INFO: Just tried re-topo
##### Hand (2 subdiv) #####
- 03:02:42 PM INFO: Try subdiv
- 03:02:42 PM INFO: Topo done
- 03:02:42 PM INFO: Subdiv done
- 03:02:42 PM INFO: Starting back to core (369840faces)
- 03:02:42 PM INFO: add attributes done
- 03:02:42 PM INFO: recompute normals done
- 03:02:42 PM INFO: transferred 10% of faces (107004 vertices in the map)
- 03:02:42 PM INFO: transferred 20% of faces (197609 vertices in the map)
- 03:02:42 PM INFO: transferred 30% of faces (279491 vertices in the map)
- 03:02:42 PM INFO: transferred 40% of faces (355326 vertices in the map)
- 03:02:43 PM INFO: transferred 50% of faces (430435 vertices in the map)
- 03:02:43 PM INFO: transferred 60% of faces (481361 vertices in the map)
- 03:02:43 PM INFO: transferred 70% of faces (528169 vertices in the map)
- 03:02:43 PM INFO: transferred 80% of faces (571228 vertices in the map)
- 03:02:43 PM INFO: transferred 90% of faces (612079 vertices in the map)
- 03:02:43 PM INFO: transferred 100% of faces (652298 vertices in the map)
- 03:02:43 PM INFO: map info:0.722781 -- 1 -- 902483
- 03:02:43 PM INFO: map collisions: 467376
- 03:02:43 PM INFO: Back to core done
- 03:02:43 PM INFO: Mesh ready
- 03:02:44 PM INFO: Just tried re-topo
While implementing attributes-aware subdivision, I found that converting a
TopologicalMesh
into aTriangleMesh
is very slow (see figures below). This might be due to the unordered_map lookup. Regarding end-of-frame subdivision, which might be usefull for animated models (i.e. working on the corse mesh, then subdividing the result), I would suggest to do it in 3 steps:TopologicalMesh
, subdivide it and convert it into a specificTriangleMesh
at load time to store the subdivided topology;TopologicalMesh
vertices to theTriangleMesh
ones (and save it to a file so that it can be reloaded with the mesh without recomputing it);TopologicalMesh
from the coarseTriangleMesh
and use the map to transfer the vertices positions and normals.Times for the subdivision are given with the following steps:
TriangleMesh
toTopologicalMesh
TopologicalMesh
toTriangleMesh
TriangleMesh
toTopologicalMesh
(just to mesure time, not needed in practice)