{"action":"closed","issue":{"url":"https://api.github.com/repos/STORM-IRIT/Radium-Engine/issues/349","repository_url":"https://api.github.com/repos/STORM-IRIT/Radium-Engine","labels_url":"https://api.github.com/repos/STORM-IRIT/Radium-Engine/issues/349/labels{/name}","comments_url":"https://api.github.com/repos/STORM-IRIT/Radium-Engine/issues/349/comments","events_url":"https://api.github.com/repos/STORM-IRIT/Radium-Engine/issues/349/events","html_url":"https://github.com/STORM-IRIT/Radium-Engine/issues/349","id":339764399,"node_id":"MDU6SXNzdWUzMzk3NjQzOTk=","number":349,"title":"`TopologicalMesh::toTriangleMesh()` is very slow","user":{"login":"hoshiryu","id":460844,"node_id":"MDQ6VXNlcjQ2MDg0NA==","avatar_url":"https://avatars2.githubusercontent.com/u/460844?v=4","gravatar_id":"","url":"https://api.github.com/users/hoshiryu","html_url":"https://github.com/hoshiryu","followers_url":"https://api.github.com/users/hoshiryu/followers","following_url":"https://api.github.com/users/hoshiryu/following{/other_user}","gists_url":"https://api.github.com/users/hoshiryu/gists{/gist_id}","starred_url":"https://api.github.com/users/hoshiryu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hoshiryu/subscriptions","organizations_url":"https://api.github.com/users/hoshiryu/orgs","repos_url":"https://api.github.com/users/hoshiryu/repos","events_url":"https://api.github.com/users/hoshiryu/events{/privacy}","received_events_url":"https://api.github.com/users/hoshiryu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-10T09:32:54Z","updated_at":"2018-07-11T08:23:39Z","closed_at":"2018-07-11T08:23:39Z","author_association":"CONTRIBUTOR","body":"While implementing attributes-aware subdivision, I found that converting a `TopologicalMesh` into a `TriangleMesh` is very slow (see figures below). This might be due to the unordered_map lookup.\r\nRegarding 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:\r\n - build the `TopologicalMesh`, subdivide it and convert it into a specific `TriangleMesh` at load time to store the subdivided topology;\r\n - also register the map from the `TopologicalMesh` vertices to the `TriangleMesh` ones (and save it to a file so that it can be reloaded with the mesh without recomputing it);\r\n - at the end of the frame, rebuild and resubdivide the `TopologicalMesh` from the coarse `TriangleMesh` and use the map to transfer the vertices positions and normals.\r\n\r\nTimes for the subdivision are given with the following steps:\r\n - convert from coarse `TriangleMesh` to `TopologicalMesh`\r\n - run n subdivision passes (CatmullClark)\r\n - convert back from subdivided `TopologicalMesh` to `TriangleMesh`\r\n - convert again from subdivided `TriangleMesh` to `TopologicalMesh` (just to mesure time, not needed in practice)\r\n\r\n```\r\n                         #####   Dana (1 subdiv)   #####\r\n- 09:56:52 AM INFO: Try subdiv\r\n- 09:56:52 AM INFO: Topo done\r\n- 09:56:52 AM INFO: Subdiv done\r\n- 09:56:52 AM INFO: Starting back to core\r\n- 09:56:52 AM INFO: \t add attributes done\r\n- 09:56:52 AM INFO: \t recompute normals done\r\n- 09:56:55 AM INFO: \t transferred 9% of faces (55510 vertices in the map)\r\n- 09:57:01 AM INFO: \t transferred 19% of faces (105845 vertices in the map)\r\n- 09:57:11 AM INFO: \t transferred 29% of faces (148265 vertices in the map)\r\n- 09:57:22 AM INFO: \t transferred 39% of faces (190816 vertices in the map)\r\n- 09:57:35 AM INFO: \t transferred 49% of faces (232853 vertices in the map)\r\n- 09:57:49 AM INFO: \t transferred 59% of faces (261208 vertices in the map)\r\n- 09:58:03 AM INFO: \t transferred 69% of faces (287485 vertices in the map)\r\n- 09:58:19 AM INFO: \t transferred 79% of faces (309608 vertices in the map)\r\n- 09:58:38 AM INFO: \t transferred 89% of faces (331849 vertices in the map)\r\n- 09:58:56 AM INFO: \t transferred 99% of faces (353716 vertices in the map)\r\n- 09:58:56 AM INFO: Back to core done\r\n- 09:58:56 AM INFO: Mesh ready\r\n- 09:59:18 AM INFO: Just tried re-topo\r\n\r\n                         #####   Dana (2 subdiv)   #####\r\n- 10:25:26 AM INFO: Try subdiv\r\n- 10:25:27 AM INFO: Topo done\r\n- 10:25:28 AM INFO: Subdiv done\r\n- 10:25:28 AM INFO: Starting back to core\r\n- 10:25:28 AM INFO: \t add attributes done\r\n- 10:25:28 AM INFO: \t recompute normals done\r\n- 10:26:09 AM INFO: \t transferred 9% of faces (234359 vertices in the map)\r\n- 10:28:16 AM INFO: \t transferred 19% of faces (432404 vertices in the map)\r\n- 10:32:32 AM INFO: \t transferred 29% of faces (609393 vertices in the map)\r\n- 10:38:30 AM INFO: \t transferred 39% of faces (774731 vertices in the map)\r\n- 10:45:35 AM INFO: \t transferred 49% of faces (939906 vertices in the map)\r\n- 10:53:13 AM INFO: \t transferred 59% of faces (1051070 vertices in the map)\r\n- 11:00:24 AM INFO: \t transferred 69% of faces (1153138 vertices in the map)\r\n- 11:08:33 AM INFO: \t transferred 79% of faces (1246521 vertices in the map)\r\n- 11:18:25 AM INFO: \t transferred 89% of faces (1334130 vertices in the map)\r\n- 11:27:59 AM INFO: \t transferred 99% of faces (1421966 vertices in the map)\r\n- 11:27:59 AM INFO: Back to core done\r\n- 11:27:59 AM INFO: Mesh ready\r\n- 11:33:27 AM INFO: Just tried re-topo\r\n\r\n                         #####   Hand (2 subdiv)   #####\r\n- 10:27:39 AM INFO: Try subdiv\r\n- 10:27:39 AM INFO: Topo done\r\n- 10:27:40 AM INFO: Subdiv done\r\n- 10:27:40 AM INFO: Starting back to core\r\n- 10:27:40 AM INFO: \t add attributes done\r\n- 10:27:40 AM INFO: \t recompute normals done\r\n- 10:27:44 AM INFO: \t transferred 10% of faces (107004 vertices in the map)\r\n- 10:27:54 AM INFO: \t transferred 20% of faces (197609 vertices in the map)\r\n- 10:28:07 AM INFO: \t transferred 30% of faces (279491 vertices in the map)\r\n- 10:28:24 AM INFO: \t transferred 40% of faces (355326 vertices in the map)\r\n- 10:28:46 AM INFO: \t transferred 50% of faces (430435 vertices in the map)\r\n- 10:29:13 AM INFO: \t transferred 60% of faces (481361 vertices in the map)\r\n- 10:29:39 AM INFO: \t transferred 70% of faces (528169 vertices in the map)\r\n- 10:30:06 AM INFO: \t transferred 80% of faces (571228 vertices in the map)\r\n- 10:30:38 AM INFO: \t transferred 90% of faces (612079 vertices in the map)\r\n- 10:31:13 AM INFO: \t transferred 100% of faces (652298 vertices in the map)\r\n- 10:31:13 AM INFO: Back to core done\r\n- 10:31:13 AM INFO: Mesh ready\r\n- 10:31:45 AM INFO: Just tried re-topo\r\n```"}}
{"actor":{"display_login":"hoshiryu"}}