{"id":44,"date":"2016-09-14T02:44:59","date_gmt":"2016-09-14T02:44:59","guid":{"rendered":"http:\/\/jaytheham.com\/tink\/?p=44"},"modified":"2016-09-14T02:45:50","modified_gmt":"2016-09-14T02:45:50","slug":"the-power-of-visualization","status":"publish","type":"post","link":"https:\/\/jaytheham.com\/tink\/?p=44","title":{"rendered":"The power of visualization"},"content":{"rendered":"<p>Sometimes opening a file in a hex editor and staring at it is enough to begin working out patterns and possible meaning, other times I can see structure but the meaning is totally beyond comprehension.<\/p>\n<p>Overlaying this data onto already understood data in a visual form can sometimes make its meaning clear. For example, each track collision section has an array of &#8220;Triangle&#8221; structs which describe the collision mesh. Each Triangle is comprised of 3 indices into the vertex array, and then 4 Bytes of unknown data. The last of these four Bytes is always a low value (&lt;6), often the same value for most of the Triangles in a section, but I have no idea what-so-ever as to its meaning.<br \/>\nSo as an experiment, I render the collision mesh and use this value to select a colour for each Triangle from an array of pre-defined colours:<\/p>\n<div id=\"attachment_45\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/GroundTypeColoured.png\"><img aria-describedby=\"caption-attachment-45\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-45\" src=\"http:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/GroundTypeColoured-300x174.png\" alt=\"Black Forest with the ground type colour coded\" width=\"300\" height=\"174\" srcset=\"https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/GroundTypeColoured-300x174.png 300w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/GroundTypeColoured-768x446.png 768w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/GroundTypeColoured-1024x595.png 1024w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/GroundTypeColoured-624x363.png 624w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/GroundTypeColoured.png 1282w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-45\" class=\"wp-caption-text\">Black Forest with the ground type colour coded<\/p><\/div>\n<p>Aha! These different colours match exactly with the different parts of the track, this value must be the collision&#8217;s type, which could be road, dirt, grass etc. I still don&#8217;t know where these types are defined but this is a good start.<\/p>\n<p>Moving on, each collision vertex is defined as 3 floats for position, 4 Bytes for lighting color (R8G8B8A8), and two shorts whose purpose is unknown. The first short is sometimes 0xFFFF, and otherwise has similar values to the second short which seems to start at 0 for the first vertex and gradually increments by 1 for later vertices.<br \/>\nIf I colour the mesh differently depending on whether or not this vertex has a 0xFFFF value, this is the result:<\/p>\n<div id=\"attachment_46\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1FFFF.png\"><img aria-describedby=\"caption-attachment-46\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-46\" src=\"http:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1FFFF-300x174.png\" alt=\"Sydney with the unknown vertex properties == 0xFFFF highlighted\" width=\"300\" height=\"174\" srcset=\"https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1FFFF-300x174.png 300w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1FFFF-768x446.png 768w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1FFFF-1024x595.png 1024w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1FFFF-624x363.png 624w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1FFFF.png 1282w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-46\" class=\"wp-caption-text\">Sydney with the unknown vertex properties == 0xFFFF highlighted<\/p><\/div>\n<p>The collision sections with a 0xFFFF value are the sections where the different variations of the track diverge from each other.<br \/>\nIf I instead alter the meshes colour depending on the value of the second short I get this:<\/p>\n<div id=\"attachment_47\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown2Coloured.png\"><img aria-describedby=\"caption-attachment-47\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-47\" src=\"http:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown2Coloured-300x174.png\" alt=\"Kyoto with the collision polygons coloured by the vertex unknown2 value\" width=\"300\" height=\"174\" srcset=\"https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown2Coloured-300x174.png 300w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown2Coloured-768x446.png 768w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown2Coloured-1024x595.png 1024w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown2Coloured-624x363.png 624w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown2Coloured.png 1282w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-47\" class=\"wp-caption-text\">Kyoto with the collision polygons coloured by the vertex unknown2 value<\/p><\/div>\n<p>I&#8217;m still not sure what this data is, but now I can see the overall pattern. Perhaps the increasing values are how the game determines if you are going the wrong way around the track, or each cars placing. Doing this colouring using the first shorts values shows that excepting the 0xFFFF values, these are forming a similar &#8211; but less segmented &#8211; pattern in reverse.<\/p>\n<div id=\"attachment_48\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1Coloured.png\"><img aria-describedby=\"caption-attachment-48\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-48\" src=\"http:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1Coloured-300x174.png\" alt=\"Kyoto with the collision polygons coloured by the vertex unknown1 value\" width=\"300\" height=\"174\" srcset=\"https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1Coloured-300x174.png 300w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1Coloured-768x446.png 768w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1Coloured-1024x595.png 1024w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1Coloured-624x363.png 624w, https:\/\/jaytheham.com\/tink\/wp-content\/uploads\/2016\/09\/CollisionVertexUnknown1Coloured.png 1282w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-48\" class=\"wp-caption-text\">Kyoto with the collision polygons coloured by the vertex unknown1 value<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes opening a file in a hex editor and staring at it is enough to begin working out patterns and possible meaning, other times I can see structure but the meaning is totally beyond comprehension. Overlaying this data onto already understood data in a visual form can sometimes make its meaning clear. For example, each [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6,7],"tags":[8,2,5,9,4],"_links":{"self":[{"href":"https:\/\/jaytheham.com\/tink\/index.php?rest_route=\/wp\/v2\/posts\/44"}],"collection":[{"href":"https:\/\/jaytheham.com\/tink\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jaytheham.com\/tink\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jaytheham.com\/tink\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jaytheham.com\/tink\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=44"}],"version-history":[{"count":2,"href":"https:\/\/jaytheham.com\/tink\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions"}],"predecessor-version":[{"id":51,"href":"https:\/\/jaytheham.com\/tink\/index.php?rest_route=\/wp\/v2\/posts\/44\/revisions\/51"}],"wp:attachment":[{"href":"https:\/\/jaytheham.com\/tink\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=44"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jaytheham.com\/tink\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=44"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jaytheham.com\/tink\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=44"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}