279
edits
(a few notes on the theoretical limits; and the obligatory "smaller boxes" joke) |
m (...) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 9: | Line 9: | ||
{{OBDtr| 0x00 | res_id |FF0000| 01 45 02 00 | 581 | 00581-.OTLF }} | {{OBDtr| 0x00 | res_id |FF0000| 01 45 02 00 | 581 | 00581-.OTLF }} | ||
{{OBDtr| 0x04 | lev_id |FFFF00| 01 00 00 06 | 3 | level 3 }} | {{OBDtr| 0x04 | lev_id |FFFF00| 01 00 00 06 | 3 | level 3 }} | ||
{{OBDtr| 0x08 | char[20] |00FF00| AD DE | dead | | {{OBDtr| 0x08 | char[20] |00FF00| AD DE | dead | padding }} | ||
{{OBDtr| 0x1C | | {{OBDtr| 0x1C | uint32 |00FFFF| 03 49 00 00 | 18691 | array size }} | ||
{{OBDtrBK}} | {{OBDtrBK}} | ||
{{OBDtr| 0x00 | | {{OBDtr| 0x00 | uint12-20 |FFC8C8| 00 00 00 00 | 0, 0 | bits 0-11 (12 bits) contain the number of gunk quads that intersect this leaf, bits 12-31 (20 bits) contain the index of the gunk quad list; see details below }} | ||
{{OBDtr| 0x04 | | {{OBDtr| 0x04 | uint32hb |FFFFC8| FF FF FF FF | -1 | negative x neighbour }} | ||
{{OBDtr| 0x08 | | {{OBDtr| 0x08 | uint32hb |C8FFC8| 01 00 00 80 | 1, high bit | positive x neighbour }} | ||
{{OBDtr| 0x0C | | {{OBDtr| 0x0C | uint32hb |C8FFFF| FF FF FF FF | -1 | negative y neighbour }} | ||
{{OBDtr| 0x10 | | {{OBDtr| 0x10 | uint32hb |FFC8FF| 02 00 00 80 | 2, high bit | positive y neighbour }} | ||
{{OBDtr| 0x14 | | {{OBDtr| 0x14 | uint32hb |FFC800| FF FF FF FF | -1 | negative z neighbour }} | ||
{{OBDtr| 0x18 | | {{OBDtr| 0x18 | uint32hb |C800C8| 04 00 00 80 | 4, high bit | positive z neighbour }} | ||
{{OBDtr| 0x1C | | {{OBDtr| 0x1C |uint9-9-9-5|C87C64| 7F FE FC 39 | 127, 127, 127, 7 | bits 0-8 (9 bits) contain the index of max x, bits 9-17 (9 bits) contain the index of max y, bits 18-26 (9 bits) contain the index of max z and bits 27-31 (5 bits) contain the index of the size of this leaf; see details below }} | ||
{{OBDtr| 0x20 | | {{OBDtr| 0x20 | uint8-24 |B0C3D4| 00 00 00 00 | 0, 0 | bits 0-7 (8 bits) intersected BNV count, bits 8-31 (24 bits) BNV list index; see details below }} | ||
|} | |} | ||
[[Image:Penny_Arcade_-_EvilCorp_Too.png|thumb|300px]] | [[Image:Penny_Arcade_-_EvilCorp_Too.png|thumb|300px]] | ||
;Intersected gunk quads | ;Intersected gunk quads | ||
:An octtree leaf (OTLF) stores its size and position and the gunk quads that intersect it. The first field contains an index/count pair that is used to access the first [[OBD:IDXA|IDXA]] field that is stored in the [[OBD:AKOT|AKOT]] that owns this leaf. This [[OBD:IDXA|IDXA]] contains the gunk quad numbers that intersect the leaf. In theory there can be at most | :An octtree leaf (OTLF) stores its size and position and the gunk quads that intersect it. The first field contains an index/count pair that is used to access the first [[OBD:IDXA|IDXA]] field that is stored in the [[OBD:AKOT|AKOT]] that owns this leaf. This [[OBD:IDXA|IDXA]] contains the gunk quad numbers that intersect the leaf. In theory there can be at most 4095 gunk quads that intersect a leaf but in practice this number is much lower (max is 462). In addition the threshold limit used to build the octree seems to be 19 gunk quads per leaf. I.e., in Oni's levels, only the smallest leaves (with size 16x16x16) have more than 19 quads; larger leaves containing 20 and more quads are subdivided into "other, smaller boxes". | ||
;Intersected BNVs | ;Intersected BNVs | ||
:An octtree leaf can intersect some BNVs (see [[OBD:AKVA|AKVA]]). The last field contains the index and count of this list in the second [[OBD:IDXA|IDXA]] field of [[OBD:AKOT|AKOT]]. | :An octtree leaf can intersect some BNVs (see [[OBD:AKVA|AKVA]]). The last field contains the index and count of this list in the second [[OBD:IDXA|IDXA]] field of [[OBD:AKOT|AKOT]]. | ||
Line 41: | Line 41: | ||
:The above leaf does not intersect any quads, has its maximum corner at (-2048.0, -2048.0, -2048.0), a size of 2048.0, no neighbours for all negative faces (it's right in the negative corner of the environment) and positive faces have leaves as neighbours (no quadtree nodes here). | :The above leaf does not intersect any quads, has its maximum corner at (-2048.0, -2048.0, -2048.0), a size of 2048.0, no neighbours for all negative faces (it's right in the negative corner of the environment) and positive faces have leaves as neighbours (no quadtree nodes here). | ||
;Theoretical limits | ;Theoretical limits | ||
:If the 8192x8192x8192 | :If the environment (size 8192x8192x8192) is subdivided into minimal cubes (size 16x16x16) in all three directions, the total number of leaves is 512x512x512 = 134,217,728, and with a maximum of 4095 quads per leaf one could expect a theoretical maximum of 549,621,596,160 distinct quads per level. (Half a trillion quads, or a trillion triangles. That's ''crazy'' much.) | ||
:However, the maximum size of the AKOT's first IDXA that can be referenced through a leaf's 0x00 field is actually 1,052,670 (a combination of the 20-bit index to the start of a leaf's quad list and the 12-bit length of that list). Thus the maximum number of distinct quads in a level (properly referenced by oct-tree leaves) can not exceed 1,052,670, which is much more comfortable sanity-wise (two million triangles is fairly common for game environments nowadays). | |||
:In practice, though, the engine imposes even more modest limitations: | |||
:*only up to 8192 environment triangles are expected to be ''visible'' (rendered) at any given time (they can be packed as 4096 quads, or as 8192 actual triangles, or any combination of tris and quads). | |||
:*:If you attempt to view more than 8192 triangles at once, Oni will ''not'' crash, but: | |||
:*:*it will complain with the dev-console message "Exceeded max visible GQs #", where # is the number of ''triangles'' in excess of 8192; | |||
:*:*it will start dropping random triangles from the rendering pipeline; | |||
:*:*collision will start to fail on the "dropped" triangles. | |||
:*:The amount of other visible geometry (characters, particles etc) does not affect this limit. | |||
:*only up to 262140 triangles (e.g., as 131070 quads) are allowed in a level's environment. Attempting to load a level with 262141 environment triangles (as any combination of triangles and quads) will cause Oni to [[Blam]]. | |||
:*:(N.B. This has been identified as a bug that will be fixed in future versions, so that the theoretical maximum of 1,052,670 quads (2,105,340 triangles) can be reached: if you cut a level into "sections" ("rooms" or "scenes") where you can view no more than 8192 triangles at once, then basically you are allowed to have 256 such "sections" in a level. If you add an extra set of environment polygons for cel-shading and/or lightmapping, then the limit will be cut in 2 or 3.) | |||
edits