{"action":"closed","issue":{"url":"https://api.github.com/repos/KhronosGroup/glTF/issues/230","labels_url":"https://api.github.com/repos/KhronosGroup/glTF/issues/230/labels{/name}","comments_url":"https://api.github.com/repos/KhronosGroup/glTF/issues/230/comments","events_url":"https://api.github.com/repos/KhronosGroup/glTF/issues/230/events","html_url":"https://github.com/KhronosGroup/glTF/issues/230","id":27757194,"number":230,"title":"proposal: specifying compression extensions","user":{"login":"fabrobinet","id":1211226,"avatar_url":"https://avatars.githubusercontent.com/u/1211226?v=3","gravatar_id":"","url":"https://api.github.com/users/fabrobinet","html_url":"https://github.com/fabrobinet","followers_url":"https://api.github.com/users/fabrobinet/followers","following_url":"https://api.github.com/users/fabrobinet/following{/other_user}","gists_url":"https://api.github.com/users/fabrobinet/gists{/gist_id}","starred_url":"https://api.github.com/users/fabrobinet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabrobinet/subscriptions","organizations_url":"https://api.github.com/users/fabrobinet/orgs","repos_url":"https://api.github.com/users/fabrobinet/repos","events_url":"https://api.github.com/users/fabrobinet/events{/privacy}","received_events_url":"https://api.github.com/users/fabrobinet/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/KhronosGroup/glTF/labels/dev-9","name":"dev-9","color":"bfd4f2"},{"url":"https://api.github.com/repos/KhronosGroup/glTF/labels/specification","name":"specification","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/KhronosGroup/glTF/milestones/1","html_url":"https://github.com/KhronosGroup/glTF/milestones/Spec%201.0","labels_url":"https://api.github.com/repos/KhronosGroup/glTF/milestones/1/labels","id":290800,"number":1,"title":"Spec 1.0","description":"","creator":{"login":"pjcozzi","id":782098,"avatar_url":"https://avatars.githubusercontent.com/u/782098?v=3","gravatar_id":"","url":"https://api.github.com/users/pjcozzi","html_url":"https://github.com/pjcozzi","followers_url":"https://api.github.com/users/pjcozzi/followers","following_url":"https://api.github.com/users/pjcozzi/following{/other_user}","gists_url":"https://api.github.com/users/pjcozzi/gists{/gist_id}","starred_url":"https://api.github.com/users/pjcozzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjcozzi/subscriptions","organizations_url":"https://api.github.com/users/pjcozzi/orgs","repos_url":"https://api.github.com/users/pjcozzi/repos","events_url":"https://api.github.com/users/pjcozzi/events{/privacy}","received_events_url":"https://api.github.com/users/pjcozzi/received_events","type":"User","site_admin":false},"open_issues":35,"closed_issues":43,"state":"open","created_at":"2013-03-18T15:44:59Z","updated_at":"2015-07-16T16:12:49Z","due_on":null,"closed_at":null},"comments":12,"created_at":"2014-02-17T23:44:40Z","updated_at":"2015-07-16T16:12:49Z","closed_at":"2015-07-16T16:12:49Z","body":"As a high-level guidance this proposal reuses some concepts learned from GL APIs and extend them to mesh compression:  \r\n- have a common API (here properties) for compression (with GL, that's for textures).\r\n- let different implementations be specified via extensions.  \r\n\r\n\r\nNotes:\r\n- as a concrete example of implementation we will use Open3DGC, this said, the proposal should be flexible for other kinds as well…\r\n- currently, the JSON generated in the converter is NOT synced up with this proposal - yet. Ideally we'll get feedback before implementing.\r\n\r\nFor mesh compression the entities we want to compress - wether they are vertices or indices - are streams of float, int…. can be interdependent/connected and thus all needed at the same time to be able to decompress, but for more flexibility they will appear as separate streams, each represented as an `accessor`. Depending on cases, it is the extension itself that should specify the info that is required (for instance if indices are required when decompressing vertices to get connectivity info).\r\n> Given that, consistency checks should be made depending on each extension requirements\r\n\r\nThis proposal covers the compression of:\r\n- animations\r\n- meshes\r\nnote: morphing will come later, and should be heavily based on same principles.  \r\n\r\nIn animations accessors contains all the datas and all streams can be compressed separately without dependency. (not connectivity info needed)\r\n\r\nThe compressed accessor is just declared like any other accessor...\r\n\r\n```\r\n\"accessors\": {\r\n    \"accessor_0\": {\r\n        \"bufferView\": \"bufferView_707\",\r\n        \"byteOffset\": 843648,\r\n        \"byteStride\" : 12102\r\n        \"count\": 501,\r\n        \"type\": 5126\r\n    }\r\n...\r\n```\r\n\r\nIt is just when accessing the bufferView that we figure that we have to decompress it:\r\n\r\n```\r\n\"bufferView_708\": {\r\n    \"compression\" : {\r\n        \"type\": \"Open3DGC\",\r\n        \"extras\" : {\r\n            \"mode\" : \"ascii\"\r\n        }\r\n    }\r\n    \"buffer\": \"compressedBuffer\",\r\n    \"byteLength\": 1000,\r\n    \"byteOffset\": 0\r\n}\r\n```\r\n\r\nWe have introduced the `compression` property. It hold:\r\n- `type` of compression\r\n- extras: specific datas to this `type` of compression\r\n\r\nThe `bufferView` indicates the `byteOffset` and `byteLength` to be read from compressedBuffer to decompress the datas.\r\n\r\nAs mentioned earlier meshes need connectivity info, so one potential issue with the above definition would be to attempt to uncompress a datas \"too soon\", e.g when reading the glTF asset if one attempts to decompress bufferViews regardless of the context.\r\nSo to prevent this, we either can:\r\n- specify that `bufferView` with `compression` should never be decompressed without context (if not access via a `mesh` or `animation`).\r\n- or just add say a `autonomous`(or whatever better name...)  property in the `compression`property, so that we know if bufferView can be uncompressed right away.\r\n\r\nThat's for the general idea. Based on feedback, implementation will start and iterations are likely to happen after a first pass...\r\n"}}