Skip to content

Instantly share code, notes, and snippets.

@crobi
Last active December 31, 2015 03:19
Show Gist options
  • Save crobi/7ec0f7b5b01cdd5914af to your computer and use it in GitHub Desktop.
Save crobi/7ec0f7b5b01cdd5914af to your computer and use it in GitHub Desktop.
Webgl game asset format.One asset consists of: 1-N materials, 1-N meshes (defining removable model parts), 0-1 skeletons (optional), 0-K animations (optional). The asset is loaded from two separate files: a JSON file (see below) and a binary buffer (Uint8Array) containing all data.
{
"materials": [
{
"diffuse": "model_D.jpg",
"specular": "model_S.jpg",
"normal": "model_N.jpg"
}
],
"meshes": {
"body": {
"vertex_count": 100,
"triangle_count": 60,
"material_index": 0,
"indices": {"type": "uint32", "byte_offset": 0, "stride": 3, "count": 60},
"position": {"type": "float", "byte_offset": 200, "stride": 3, "count": 100},
"normal": {"type": "float", "byte_offset": 400, "stride": 3, "count": 100},
"texcoord": {"type": "float", "byte_offset": 600, "stride": 2, "count": 100},
"boneweight": {"type": "float", "byte_offset": 800, "stride": 4, "count": 100},
"boneindex": {"type": "uint8", "byte_offset": 1200, "stride": 4, "count": 100},
}
},
"bones": [
{
"name": "root",
"parent": -1,
"skinned": false,
"invBindMat": [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1],
"pos": [0,0,0],
"rot": [0,0,0,1],
"scl": [1,1,1]
}
],
"animations": [
{
"name": "run_forward",
"fps": 30,
"frames": 20,
"tracks": [
{
"pos": {"type": "float", "byte_offset": 1400, "stride": 3, "count": 300},
"rot": {"type": "float", "byte_offset": 1600, "stride": 4, "count": 300},
"scl": {"type": "float", "byte_offset": 1800, "stride": 3, "count": 300},
}
]
}
]
}
@antont
Copy link

antont commented Jul 7, 2014

are you aware of gltf? seems similar with a quick look.

at least it has the similar structure of json + binary etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment