TSCB: Difference between revisions
imported>Leoetlino (import from http://botw-modding-database.wikia.com/wiki/TSCB) |
m (Specify what extra_info_array is for.) |
||
(26 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
<onlyinclude> | |||
'''T'''errain '''sc'''ene '''b'''inary (TSCB) files describe terrain areas layout and terrain materials. | '''T'''errain '''sc'''ene '''b'''inary (TSCB) files describe terrain areas layout and terrain materials. | ||
</onlyinclude> | |||
== TSCB File Specification == | ==TSCB File Specification== | ||
=== Header === | |||
===Header=== | |||
{| class="wikitable" | {| class="wikitable" | ||
!Offset (h) | !Offset (h) | ||
Line 9: | Line 12: | ||
!Description | !Description | ||
|- | |- | ||
|0x00 | |<code>0x00</code> | ||
|4 | |4 | ||
|String | |String | ||
|TSCB file signature (magic) | |TSCB file signature (magic) <code>54 53 43 42</code> or "TSCB" | ||
|- | |- | ||
|0x04 | |<code>0x04</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|TSCB version? | |TSCB version? <code>0A 00 00 00</code> or "10.0.0.0"<ref>U-King.elf:0x024D2F8C-0x024D300A holds two error messages: "【データロード】メジャーバージョンの不一致" ("[Data load] Major version mismatch") and "【データロード】マイナーバージョンの不一致" ("[Data Load] Minor version mismatch")</ref><ref>Game crashes on load screen if not equal to <code>0A 00 00 00</code></ref> | ||
|- | |- | ||
|0x08 | |<code>0x08</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown. | |Unknown. Always <code>00 00 00 01</code>. Game crashes on load screen if not equal to <code>00 00 00 01</code>. | ||
|- | |- | ||
|0x0c | |<code>0x0c</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|file_base table relative offset | |<code>file_base</code> table relative offset | ||
|- | |- | ||
|0x10 | |<code>0x10</code> | ||
|4 | |4 | ||
|Float | |Float | ||
| | |<code>world_scale</code> <code>500.0</code>. Scales the terrain along the x- and z-axis. | ||
|- | |- | ||
|0x14 | |<code>0x14</code> | ||
|4 | |4 | ||
|Float | |Float | ||
| | |Terrain mesh max height <code>800.0</code>. Used to calculate the actual vertex height with [[HGHT|hght]] data. | ||
|- | |- | ||
|0x18 | |<code>0x18</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|material_info_array length (number of elements in the array) | |<code>material_info_array</code> length (number of elements in the array) | ||
|- | |- | ||
|0x1c | |<code>0x1c</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|area_array length (number of elements in the array) | |<code>area_array</code> length (number of elements in the array) | ||
|- | |- | ||
|0x20 | |<code>0x20</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Probably padding | |Probably padding | ||
|- | |- | ||
|0x24 | |<code>0x24</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Probably padding | |Probably padding | ||
|- | |- | ||
|0x28 | |<code>0x28</code> | ||
|4 | |4 | ||
|Float | |Float | ||
| | |<code>tile_size</code>. Used by the area array. | ||
|- | |- | ||
|0x2c | |<code>0x2c</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown | |Unknown <code>00 00 00 08</code>. <ref>Values <code>1</code>, <code>2</code>, <code>4</code>, <code>5</code>, <code>6</code>, <code>8</code>, <code>9</code>, <code>10</code>, <code>13</code>, <code>14</code> affects textures. <code>0</code>, <code>3</code>, <code>7</code>, <code>11</code>, <code>12</code>, <code>15</code>, <code>16</code> will crash the game.</ref> | ||
|} | |} | ||
== Material Information Array == | ==Material Information Array== | ||
The material information array references texture data contained in <code>content/Model/Terrain.Tex1.sbfres</code>. | |||
=== Header === | ===Header=== | ||
The material information header is one value, the section size. This includes the index table and the value table. | The material information header is one value, the section size. This includes the index table and the value table, as well as itself. | ||
{| class="wikitable" | {| class="wikitable" | ||
!Offset (h) | !Offset (h) | ||
Line 81: | Line 84: | ||
!Description | !Description | ||
|- | |- | ||
|0x00 | |<code>0x00</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
Line 87: | Line 90: | ||
|} | |} | ||
=== Material Information Array Lookup Table === | ===Material Information Array Lookup Table=== | ||
Following the header is a table of relative offsets to each entry in <code>material_info_array</code> | Following the header is a table of relative offsets to each entry in <code>material_info_array</code> | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 95: | Line 98: | ||
!Description | !Description | ||
|- | |- | ||
|0x00 | |<code>0x00</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
| | |Offset to array entry, relative to the first byte of this offset | ||
|} | |} | ||
=== Material Information Value Table === | ===Material Information Value Table=== | ||
Each entry in the array contains an index and four attributes | Each entry in the array contains an index and four attributes | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 109: | Line 112: | ||
!Description | !Description | ||
|- | |- | ||
|0x00 | |<code>0x00</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Array index (mat_index) | |Array index (<code>mat_index</code>) of <code>material_info_array</code> | ||
|- | |- | ||
|0x04 | |<code>0x04</code> | ||
|4 | |4 | ||
|Float | |Float | ||
| | |Texture u-axis (x-axis) | ||
|- | |- | ||
|0x08 | |<code>0x08</code> | ||
|4 | |4 | ||
|Float | |Float | ||
| | |Texture v-axis (y-axis) | ||
|- | |- | ||
|0x0c | |<code>0x0c</code> | ||
|4 | |4 | ||
|Float | |Float | ||
|Unknown. values range from 0-1. | |Unknown. values range from 0-1. | ||
|- | |- | ||
|0x10 | |<code>0x10</code> | ||
|4 | |4 | ||
|Float | |Float | ||
Line 135: | Line 138: | ||
|} | |} | ||
== Area Array == | ==Area Array== | ||
=== Area Array Lookup Table === | ===Area Array Lookup Table=== | ||
Following the material information section is a table of relative offsets to each entry in area_array | Following the material information section is a table of relative offsets to each entry in area_array | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 145: | Line 148: | ||
!Description | !Description | ||
|- | |- | ||
|0x00 | |<code>0x00</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
| | |Offset to array entry, relative to the first byte of this offset | ||
|} | |} | ||
===Area Array Value Table=== | |||
Each entry contains meta data for one tile in the terrain scene. There are multiple levels of detail (lod) for the terrain. | |||
Entry size ranges from <code>0x30</code> to <code>0x58</code> depending on the size of <code>extra_info_array</code> | |||
{| class="wikitable" | {| class="wikitable" | ||
!Offset (h) | !Offset (h) | ||
Line 160: | Line 164: | ||
!Description | !Description | ||
|- | |- | ||
|0x00 | |<code>0x00</code> | ||
|4 | |4 | ||
|Float | |Float | ||
|X Position | |X Position | ||
|- | |- | ||
|0x04 | |<code>0x04</code> | ||
|4 | |4 | ||
|Float | |Float | ||
|Z Position | |Z Position | ||
|- | |- | ||
|0x08 | |<code>0x08</code> | ||
|4 | |4 | ||
|Float | |Float | ||
| | |<code>area_size</code> (length and width) | ||
|- | |- | ||
|0x0c | |<code>0x0c</code> | ||
|4 | |4 | ||
|Float | |Float | ||
| | |Minimum Terrain Height - ranges from 0 to 1 | ||
|- | |- | ||
|0x10 | |<code>0x10</code> | ||
|4 | |4 | ||
|Float | |Float | ||
| | |Maximum Terrain Height - ranges from 0 to 1 | ||
|- | |- | ||
|0x14 | |<code>0x14</code> | ||
|4 | |4 | ||
|Float | |Float | ||
| | |Minimum Water Height - ranges from 0 to 1 | ||
|- | |- | ||
|0x18 | |<code>0x18</code> | ||
|4 | |4 | ||
|Float | |Float | ||
| | |Maximum Water Height - ranges from 0 to 1 | ||
|- | |- | ||
|0x1c | |<code>0x1c</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown. Usually 0, 1 or 2 | |Unknown. Usually <code>0</code>, <code>1</code> or <code>2</code>, crashes on <code>4</code>, <code>16</code>.<ref>May be a flag for grass and water? <code>0</code> seems to indicate no water or grass.</ref> | ||
|- | |- | ||
|0x20 | |<code>0x20</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|file_base. Relative offset to file base name string | |<code>file_base</code>. Relative offset to file base name string. | ||
|- | |- | ||
|0x24 | |<code>0x24</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown. Usually 0. | |Unknown. Usually <code>0</code>. | ||
|- | |- | ||
|0x28 | |<code>0x28</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown. Usually 0. | |Unknown. Usually <code>0</code>. | ||
|- | |- | ||
|0x2c | |<code>0x2c</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|ref_extra. It seems to be a flag to indicate if there is an attached extra_info_array | |<code>ref_extra</code>. It seems to be a flag to indicate if there is an attached <code>extra_info_array</code> | ||
|} | |} | ||
=== | ====Parameters==== | ||
<code>x</code> - Area tile x coordinate (East-West) | |||
Every area includes a .hght and .mate file. | <code>z</code> - Area tile z coordinate (North-South) | ||
<code>area_size</code> - Determines the length and width of the area. It can be calculated with:<blockquote><code>(area_size / tile_size * world_scale) * 20</code></blockquote><code>tile_size</code> and <code>world_scale</code> are in the header. | |||
===Extra Information Array=== | |||
if <code>ref_extra</code> does not equal <code>0</code> there is an <code>extra_info_array</code> attached to this area. The array is 4 or 8 values long. | |||
Every area includes a [[HGHT|.hght]] and [[MATE|.mate]] file. Entries in the <code>extra_info_array</code> indicate if there is an additional [[Water.extm|.water.extm]] and / or [[Grass.extm|.grass.extm]] file to look for. | |||
===Terrain and Water Height=== | |||
0x0c through 0x18 are used to determine what height range the terrain and water should render within. This is possibly used to assist with occlusion. If the heightmap moves outside of the range defined here, there will be visual artefacts present at higher viewing angles, usually between 45 and 90 degrees. The range value is multiplied by the max height defined in the TSCB header to determine the final value in 'real' co-ordinates. | |||
====Header==== | |||
{| class="wikitable" | {| class="wikitable" | ||
!Offset (h) | !Offset (h) | ||
Line 231: | Line 246: | ||
!Description | !Description | ||
|- | |- | ||
| | |<code>0x00</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|extra_info_array length. Number of elements in array. | |extra_info_array length. Number of values (not elements) in array. | ||
|- | |- | ||
| | |<code>(0x04)</code> | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown. | |Unknown. Always 20, but only present when extra_info_array length is 8. | ||
|} | |||
====Extra Information Array Value Table==== | |||
After the Header, there are <code>extra_info_array length / 4</code> elements of this structure. | |||
Elements act as flags for presence of [[Water.extm|.water.extm]] or [[Grass.extm|.grass.extm]] files. | |||
A "water" element indicates that there is water data for the terrain section defined in a [[Water.extm|.water.extm]] file. A "grass" element similarly indicates the presence of a [[Grass.extm|.grass.extm]] file. | |||
Grass and water are referenced via the <code>extra_info_array</code> because presence water and grass data for any given terrain area is optional. | |||
{| class="wikitable" | |||
!Offset (h) | |||
!Size | |||
!Data Type | |||
!Description | |||
|- | |- | ||
| | |0x00 | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown. | |Unknown. Always 3. | ||
|- | |- | ||
| | |0x04 | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown. | |Unknown. 0 or 1. | ||
|- | |- | ||
| | |0x08 | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown. | |Unknown. Always 1. | ||
|- | |- | ||
| | |0x0c | ||
|4 | |4 | ||
|Unsigned Int | |Unsigned Int | ||
|Unknown. Always 0. | |Unknown. Always 0. | ||
|} | |} | ||
[ | [3, 0, 1, 0, 3, 1, 1, 0] = grass, water | ||
[ | [3, 1, 1, 0, 3, 0, 1, 0] = water, grass | ||
[ 3, 1, 1, 0] = water | [3, 1, 1, 0] = water | ||
[ 3, 0, 1, 0] = grass | [3, 0, 1, 0] = grass | ||
It seems that water is <code>[3, 1, 1]</code> and grass is <code>[3, 0, 1]</code> | |||
==<code>stera</code> File Positions== | |||
[[File:Stera_File_Positions.png|alt=stera File Positions|thumb|<code>stera</code> File Positions]] | |||
<code>stera</code> files referenced in the area array are positioned using a [[wikipedia:Z-order_curve|z-order curve]] or the [[wikipedia:Moser–de_Bruijn_sequence|Moser-de Bruijn sequence]]. | |||
<references /> | <references /> | ||
[[Category:File formats]] | [[Category:File formats]] | ||
[[Category:File extensions]] | [[Category:File extensions]] | ||
[[Category:File extensions (STERA)]] |
Latest revision as of 21:49, 10 January 2022
Terrain scene binary (TSCB) files describe terrain areas layout and terrain materials.
TSCB File Specification
Header
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | String | TSCB file signature (magic) 54 53 43 42 or "TSCB"
|
0x04
|
4 | Unsigned Int | TSCB version? 0A 00 00 00 or "10.0.0.0"[1][2]
|
0x08
|
4 | Unsigned Int | Unknown. Always 00 00 00 01 . Game crashes on load screen if not equal to 00 00 00 01 .
|
0x0c
|
4 | Unsigned Int | file_base table relative offset
|
0x10
|
4 | Float | world_scale 500.0 . Scales the terrain along the x- and z-axis.
|
0x14
|
4 | Float | Terrain mesh max height 800.0 . Used to calculate the actual vertex height with hght data.
|
0x18
|
4 | Unsigned Int | material_info_array length (number of elements in the array)
|
0x1c
|
4 | Unsigned Int | area_array length (number of elements in the array)
|
0x20
|
4 | Unsigned Int | Probably padding |
0x24
|
4 | Unsigned Int | Probably padding |
0x28
|
4 | Float | tile_size . Used by the area array.
|
0x2c
|
4 | Unsigned Int | Unknown 00 00 00 08 . [3]
|
Material Information Array
The material information array references texture data contained in content/Model/Terrain.Tex1.sbfres
.
Header
The material information header is one value, the section size. This includes the index table and the value table, as well as itself.
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Unsigned Int | Material info section size in bytes |
Material Information Array Lookup Table
Following the header is a table of relative offsets to each entry in material_info_array
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Unsigned Int | Offset to array entry, relative to the first byte of this offset |
Material Information Value Table
Each entry in the array contains an index and four attributes
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Unsigned Int | Array index (mat_index ) of material_info_array
|
0x04
|
4 | Float | Texture u-axis (x-axis) |
0x08
|
4 | Float | Texture v-axis (y-axis) |
0x0c
|
4 | Float | Unknown. values range from 0-1. |
0x10
|
4 | Float | Unknown. values range from 0.2-1.63 |
Area Array
Area Array Lookup Table
Following the material information section is a table of relative offsets to each entry in area_array
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Unsigned Int | Offset to array entry, relative to the first byte of this offset |
Area Array Value Table
Each entry contains meta data for one tile in the terrain scene. There are multiple levels of detail (lod) for the terrain.
Entry size ranges from 0x30
to 0x58
depending on the size of extra_info_array
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Float | X Position |
0x04
|
4 | Float | Z Position |
0x08
|
4 | Float | area_size (length and width)
|
0x0c
|
4 | Float | Minimum Terrain Height - ranges from 0 to 1 |
0x10
|
4 | Float | Maximum Terrain Height - ranges from 0 to 1 |
0x14
|
4 | Float | Minimum Water Height - ranges from 0 to 1 |
0x18
|
4 | Float | Maximum Water Height - ranges from 0 to 1 |
0x1c
|
4 | Unsigned Int | Unknown. Usually 0 , 1 or 2 , crashes on 4 , 16 .[4]
|
0x20
|
4 | Unsigned Int | file_base . Relative offset to file base name string.
|
0x24
|
4 | Unsigned Int | Unknown. Usually 0 .
|
0x28
|
4 | Unsigned Int | Unknown. Usually 0 .
|
0x2c
|
4 | Unsigned Int | ref_extra . It seems to be a flag to indicate if there is an attached extra_info_array
|
Parameters
x
- Area tile x coordinate (East-West)
z
- Area tile z coordinate (North-South)
area_size
- Determines the length and width of the area. It can be calculated with:
(area_size / tile_size * world_scale) * 20
tile_size
and world_scale
are in the header.
Extra Information Array
if ref_extra
does not equal 0
there is an extra_info_array
attached to this area. The array is 4 or 8 values long.
Every area includes a .hght and .mate file. Entries in the extra_info_array
indicate if there is an additional .water.extm and / or .grass.extm file to look for.
Terrain and Water Height
0x0c through 0x18 are used to determine what height range the terrain and water should render within. This is possibly used to assist with occlusion. If the heightmap moves outside of the range defined here, there will be visual artefacts present at higher viewing angles, usually between 45 and 90 degrees. The range value is multiplied by the max height defined in the TSCB header to determine the final value in 'real' co-ordinates.
Header
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00
|
4 | Unsigned Int | extra_info_array length. Number of values (not elements) in array. |
(0x04)
|
4 | Unsigned Int | Unknown. Always 20, but only present when extra_info_array length is 8. |
Extra Information Array Value Table
After the Header, there are extra_info_array length / 4
elements of this structure.
Elements act as flags for presence of .water.extm or .grass.extm files.
A "water" element indicates that there is water data for the terrain section defined in a .water.extm file. A "grass" element similarly indicates the presence of a .grass.extm file.
Grass and water are referenced via the extra_info_array
because presence water and grass data for any given terrain area is optional.
Offset (h) | Size | Data Type | Description |
---|---|---|---|
0x00 | 4 | Unsigned Int | Unknown. Always 3. |
0x04 | 4 | Unsigned Int | Unknown. 0 or 1. |
0x08 | 4 | Unsigned Int | Unknown. Always 1. |
0x0c | 4 | Unsigned Int | Unknown. Always 0. |
[3, 0, 1, 0, 3, 1, 1, 0] = grass, water [3, 1, 1, 0, 3, 0, 1, 0] = water, grass [3, 1, 1, 0] = water [3, 0, 1, 0] = grass
It seems that water is [3, 1, 1]
and grass is [3, 0, 1]
stera
File Positions
stera
files referenced in the area array are positioned using a z-order curve or the Moser-de Bruijn sequence.
- ↑ U-King.elf:0x024D2F8C-0x024D300A holds two error messages: "【データロード】メジャーバージョンの不一致" ("[Data load] Major version mismatch") and "【データロード】マイナーバージョンの不一致" ("[Data Load] Minor version mismatch")
- ↑ Game crashes on load screen if not equal to
0A 00 00 00
- ↑ Values
1
,2
,4
,5
,6
,8
,9
,10
,13
,14
affects textures.0
,3
,7
,11
,12
,15
,16
will crash the game. - ↑ May be a flag for grass and water?
0
seems to indicate no water or grass.