{"action":"created","issue":{"url":"https://api.github.com/repos/immersive-web/webxr/issues/447","repository_url":"https://api.github.com/repos/immersive-web/webxr","labels_url":"https://api.github.com/repos/immersive-web/webxr/issues/447/labels{/name}","comments_url":"https://api.github.com/repos/immersive-web/webxr/issues/447/comments","events_url":"https://api.github.com/repos/immersive-web/webxr/issues/447/events","html_url":"https://github.com/immersive-web/webxr/issues/447","id":391280356,"node_id":"MDU6SXNzdWUzOTEyODAzNTY=","number":447,"title":"Should we just remove `viewMatrix` and rename `transform` to `viewTransform`?","user":{"login":"thetuvix","id":1209982,"node_id":"MDQ6VXNlcjEyMDk5ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/1209982?v=4","gravatar_id":"","url":"https://api.github.com/users/thetuvix","html_url":"https://github.com/thetuvix","followers_url":"https://api.github.com/users/thetuvix/followers","following_url":"https://api.github.com/users/thetuvix/following{/other_user}","gists_url":"https://api.github.com/users/thetuvix/gists{/gist_id}","starred_url":"https://api.github.com/users/thetuvix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetuvix/subscriptions","organizations_url":"https://api.github.com/users/thetuvix/orgs","repos_url":"https://api.github.com/users/thetuvix/repos","events_url":"https://api.github.com/users/thetuvix/events{/privacy}","received_events_url":"https://api.github.com/users/thetuvix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-12-14T21:11:54Z","updated_at":"2018-12-18T17:59:55Z","closed_at":null,"author_association":"NONE","body":"In looking through !440, I wonder if any non-trivial engine with an actual scene graph will ever make use of `viewMatrix`, or if `transform` is _actually_ all they will evaluate each frame for all purposes, including positioning the camera in the scene relative to the app's chosen reference space origin.\r\n\r\nAs a case study, in the Windows MR native APIs, we exposed a similar member to `viewMatrix`: [`HolographicCameraPose.TryGetViewTransform()`](https://docs.microsoft.com/en-us/uwp/api/windows.graphics.holographic.holographiccamerapose.trygetviewtransform), returning you a `Left` and `Right` view matrix, each as a `Matrix4x4`.  However, when engines like Unity get a hold of this each frame, they immediately decompose it into a position and orientation for the view, which they then apply as the world transform for their `Camera`'s `GameObject` in their scene graph.  At the end of the frame, the engine then just calculates its own view matrix from the `Camera`'s final position and orientation, identically to how it would for a non-XR game where all camera movement is app-driven.\r\n\r\nMy own mental model here is that WebXR is not so much the first 10% of an opinionated XR render engine (e.g. dealing directly with view matrices, etc.), as it is **a source of low-policy poses for tracked objects**, such as viewers, input sources, planes, meshes and more.  UAs can consistently deliver those poses (including viewer poses) as positions and orientations within app-created reference spaces, with engines then picking up from there to position their scene cameras appropriately, with the engine then calculating view matrices relative to their scene origin precisely as they've done for many years.\r\n\r\nIn that model, do we see a clear use case for engines to use `viewMatrix` without just decomposing it into `transform` and manually recomposing it before rendering anyway?  If not, perhaps we should just remove the `viewMatrix` attribute and rename `transform` to `viewTransform`, defining it simply as you have here.\r\n\r\n_Originally posted by @thetuvix in https://github.com/immersive-web/webxr/pull/440_"},"comment":{"url":"https://api.github.com/repos/immersive-web/webxr/issues/comments/448312567","html_url":"https://github.com/immersive-web/webxr/issues/447#issuecomment-448312567","issue_url":"https://api.github.com/repos/immersive-web/webxr/issues/447","id":448312567,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODMxMjU2Nw==","user":{"login":"toji","id":805273,"node_id":"MDQ6VXNlcjgwNTI3Mw==","avatar_url":"https://avatars2.githubusercontent.com/u/805273?v=4","gravatar_id":"","url":"https://api.github.com/users/toji","html_url":"https://github.com/toji","followers_url":"https://api.github.com/users/toji/followers","following_url":"https://api.github.com/users/toji/following{/other_user}","gists_url":"https://api.github.com/users/toji/gists{/gist_id}","starred_url":"https://api.github.com/users/toji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toji/subscriptions","organizations_url":"https://api.github.com/users/toji/orgs","repos_url":"https://api.github.com/users/toji/repos","events_url":"https://api.github.com/users/toji/events{/privacy}","received_events_url":"https://api.github.com/users/toji/received_events","type":"User","site_admin":false},"created_at":"2018-12-18T17:59:55Z","updated_at":"2018-12-18T17:59:55Z","author_association":"MEMBER","body":"Even if we do drop the `viewMatrix` I don't know that I feel renaming `transform` to `viewTransform` is necessary, since it should be contextually clear what it's transforming. Looking at your code above, I don't find this any more confusing to read, and the repetition of the word \"view\" is eliminated:\r\n\r\n```\r\nscene.camera.setTransform(view.transform.position, view.transform.orientation);\r\nscene.camera.projectionMatrix = view.projectionMatrix;\r\n```\r\n\r\nIt would be more important IMO if we had another transform on the view, but I can't really see that happening?\r\n\r\nIt does feel a little weird to me that we have a matrix for projection and a decomposed transform for the view, but that's a relatively minor quibble. Maybe we should add an 'inverseMatrix` to `XRRigidTransform` (lazily evaluated, of course) to accommodate any cases where the app actually does want a matrix instead, while still representing the view's transform as a single object?"}}
{"actor":{"display_login":"toji"}}