{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/11746","repository_url":"https://api.github.com/repos/mrdoob/three.js","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/11746/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/11746/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/11746/events","html_url":"https://github.com/mrdoob/three.js/issues/11746","id":242028413,"node_id":"MDU6SXNzdWUyNDIwMjg0MTM=","number":11746,"title":"Non-blocking assets loaders","user":{"login":"fernandojsg","id":782511,"node_id":"MDQ6VXNlcjc4MjUxMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/782511?v=4","gravatar_id":"","url":"https://api.github.com/users/fernandojsg","html_url":"https://github.com/fernandojsg","followers_url":"https://api.github.com/users/fernandojsg/followers","following_url":"https://api.github.com/users/fernandojsg/following{/other_user}","gists_url":"https://api.github.com/users/fernandojsg/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandojsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandojsg/subscriptions","organizations_url":"https://api.github.com/users/fernandojsg/orgs","repos_url":"https://api.github.com/users/fernandojsg/repos","events_url":"https://api.github.com/users/fernandojsg/events{/privacy}","received_events_url":"https://api.github.com/users/fernandojsg/received_events","type":"User","site_admin":false},"labels":[{"id":175827,"node_id":"MDU6TGFiZWwxNzU4Mjc=","url":"https://api.github.com/repos/mrdoob/three.js/labels/Suggestion","name":"Suggestion","color":"ffffcf","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":39,"created_at":"2017-07-11T12:23:01Z","updated_at":"2018-08-21T22:44:18Z","closed_at":null,"author_association":"COLLABORATOR","body":"As discussed in https://github.com/mrdoob/three.js/issues/11301 one of the main problems that we have in WebVR, although is annoying in non-VR experiences too, is blocking the main thread while loading assets. \r\n\r\nWith the recent implementation on [link traversal](https://blog.mozvr.com/link-traversal/) in the browser non-blocking loading is a must to ensure a satisfying user experience. If you jump from one page to another and the target page start to load assets blocking the mainthread, it will block the render function so no frames will be submitted to the headset and after a small period of grace the browser will kick us out from VR and it will require the user to take out the headset, click enter VR again (user gesture required to do so) and go back to the experience.\r\n\r\nCurrently we can see two implementations of non-blocking loading of OBJ files:\r\n- (1) Using webworkers to parse the obj file and then return the data back to the main thread [WWOBJLoader](https://threejs.org/docs/index.html#examples/loaders/WWOBJLoader2):\r\nHere the parsing is done concurrently and you could have several workers at the same time. The main drawback is that once you've loaded the data you need to send the payload back to the mainthread to reconstruct the THREE objects instances and that part could block the main thread:\r\nhttps://github.com/kaisalmen/WWOBJLoader/blob/master/src/loaders/WWOBJLoader2.js#L312-L423\r\n\r\n- (2) Mainthread promise with deferred parsing using setTimeOut:[Oculus ReactVR](https://github.com/facebook/react-vr/tree/master/ReactVR/js/Loaders/WavefrontOBJ): This loader keeps reading lines using small time slots to prevent blocking the main thread by calling setTimeout: https://github.com/facebook/react-vr/blob/master/ReactVR/js/Loaders/WavefrontOBJ/OBJParser.js#L281-L298\r\nWith this approach the loading will be slower as we're just parsing some lines on each time slot, but the advantage is that once the parsing is completed, we'll have the THREE objects ready to use without any additional overhead.\r\n\r\nBoth has their pros and cons and I'm honestly not an expert of webworkers to evalute that implementation but It's an interesting discussion that ideally would lead to a generic module that could be used to port the loaders to a non-blocking version.\r\n\r\nAny suggestions?\r\n\r\n/cc @mikearmstrong001 @kaisalmen @delapuente @spite "},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/414845303","html_url":"https://github.com/mrdoob/three.js/issues/11746#issuecomment-414845303","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/11746","id":414845303,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDg0NTMwMw==","user":{"login":"fernandojsg","id":782511,"node_id":"MDQ6VXNlcjc4MjUxMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/782511?v=4","gravatar_id":"","url":"https://api.github.com/users/fernandojsg","html_url":"https://github.com/fernandojsg","followers_url":"https://api.github.com/users/fernandojsg/followers","following_url":"https://api.github.com/users/fernandojsg/following{/other_user}","gists_url":"https://api.github.com/users/fernandojsg/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandojsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandojsg/subscriptions","organizations_url":"https://api.github.com/users/fernandojsg/orgs","repos_url":"https://api.github.com/users/fernandojsg/repos","events_url":"https://api.github.com/users/fernandojsg/events{/privacy}","received_events_url":"https://api.github.com/users/fernandojsg/received_events","type":"User","site_admin":false},"created_at":"2018-08-21T22:44:18Z","updated_at":"2018-08-21T22:44:18Z","author_association":"COLLABORATOR","body":"> The bugs on bugzilla (https://bugzilla.mozilla.org/show_bug.cgi?id=1367251, https://bugzilla.mozilla.org/show_bug.cgi?id=1335594) have been there untouched for ... two years now? I didn't think it would take them this bloody long to fix it.\r\n\r\nYep sorry for that I really didn't follow up with it for a while -_-\r\n\r\n> So the problem is that \"technically\" the feature is supported on FF, but in practice is useless. In order to use it, we could have a path for Chrome that uses it, and another for the other browsers that doesn't. Problem is, since Firefox does have the feature, we'd have to do UA sniffing, which sucks.\r\n\r\n> The practical solution is performing feature detection: build a 2x2 image using cIB with the flip flag, and then read back and make sure the values are correct.\r\n\r\nYep I agree that both solutions really suck and we should try to avoid them so before digging into any of these lets see if we could unblock it on our side"}}
{"actor":{"display_login":"fernandojsg"}}