HGHT: Difference between revisions

From ZeldaMods (Breath of the Wild)
Jump to navigation Jump to search
imported>Zephenryus
(Added file specification for hght files)
 
m (Added a more detailed height map)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<onlyinclude>
<onlyinclude>
[[File:5200000000.hght.png|alt=Height map of Hyrule Main Field|thumb|Height map of Hyrule Main Field]]
<code>hght</code> files describe the heightmap of the main field and add-on content field.
<code>hght</code> files describe the heightmap of the main field and add-on content field.
</onlyinclude>
</onlyinclude>
== HGHT File Specification ==
== HGHT File Specification ==


Line 10: Line 12:
<code>hght</code> files only contain a table of height data. There are 65,536 (256×256) unsigned short entries in the table.
<code>hght</code> files only contain a table of height data. There are 65,536 (256×256) unsigned short entries in the table.


Each file describes a 256×256 mesh tile. Each tile has placement data found in <code>MainField.tscb</code>.
Each file describes a 256×256 mesh tile. Each tile has placement data found in <code>[[TSCB|MainField.tscb]]</code>.


=== Height Map Data ===
=== Height Map Data ===
Line 30: Line 32:
<code>x</code> and <code>z</code><ref>`z` is expected to be an integer quotient. The `floor` function can be used if integer division is not supported.</ref> can be calculated, while iterating through the data table:
<code>x</code> and <code>z</code><ref>`z` is expected to be an integer quotient. The `floor` function can be used if integer division is not supported.</ref> can be calculated, while iterating through the data table:


<syntaxhighlight lang="c" line='line'>
<syntaxhighlight lang="c" line="line">
for (int index = 0; index < 256 * 256; index++) {
for (int index = 0; index < 256 * 256; index++) {
     uint x = index % 256;
     uint x = index % 256;
Line 40: Line 42:


[[Category:File formats]]
[[Category:File formats]]
[[Category:File extensions]]
[[Category:File extensions (STERA)]]

Latest revision as of 17:36, 30 January 2023

Height map of Hyrule Main Field
Height map of Hyrule Main Field

hght files describe the heightmap of the main field and add-on content field.


HGHT File Specification

hght files contain no header or signature.

hght File Layout

hght files only contain a table of height data. There are 65,536 (256×256) unsigned short entries in the table.

Each file describes a 256×256 mesh tile. Each tile has placement data found in MainField.tscb.

Height Map Data

Each entry in the table maps to an x, y and z component. The height or y component of each vertex is the value read the from the file.

Offset (h) Size Data Type Description
0x00 2 Unsigned Short Vertex y component

x and z[1] can be calculated, while iterating through the data table:

for (int index = 0; index < 256 * 256; index++) {
    uint x = index % 256;
    uint z = index / 256;
}
  1. `z` is expected to be an integer quotient. The `floor` function can be used if integer division is not supported.