Actions

SCHG

Difference between revisions of "Sonic Jam/Models"

From Sonic Retro

(Created page with "Models start at $3F908 in MUSEUM.MUS. ==Model Format== Models generally consist of the following parts, though there are some exceptions. ===Vertices=== The first part are...")
 
Line 3: Line 3:
 
==Model Format==
 
==Model Format==
  
Models generally consist of the following parts, though there are some exceptions.
+
Models generally consist of the following parts. There are some exceptions, but the general order stays the same.
  
 
===Vertices===
 
===Vertices===
Line 19: Line 19:
 
===Draw Settings===
 
===Draw Settings===
  
The last for any model is the draw settings. There's one list of settings for each quad. Each list is 16 bytes long. Here's its format:
+
After the above is the draw settings. There's one list of settings for each quad. Each list is 16 bytes long. Here's its format:
  
 
{|class="prettytable" style="width:auto;"
 
{|class="prettytable" style="width:auto;"
Line 41: Line 41:
 
|-
 
|-
 
| Unknown.||Word
 
| Unknown.||Word
 +
|}
 +
 +
===Footer===
 +
 +
This can vary from model to model, depending on which parts are present. For Sonic, this consists of the following:
 +
 +
<ul><li>Pointer to start of vertices (long), number of vertices (long)</li>
 +
 +
<li>Pointer to start of indexing table (long), number of quads (long)</li>
 +
 +
<li>Pointer to draw command (long)</li>
 +
 +
<li>Pointer to vertex normals (long)</li></ul>
 +
 +
===Model Groups===
 +
 +
Some models, such as Sonic and Tails, consist of multiple models in a group. After the last model in the group, there's a footer.
 +
 +
The first part of the footer is a list of addresses pointing to each model's footer.
 +
 +
The second part is a list of 3D Vectors, relative positions for each model. They correspond to the addresses given in the previous section.
 +
 +
Certain model groups have some seemingly unused data that appears before the footer. This data seems to correlate with how the model group parenting hierarchy is set up.
 +
 +
==Model List==
 +
 +
Here's the list of models in the game that I know of. Addresses given are pointers to footers, for both model groups and individual models.
 +
 +
{|class="prettytable" style="width:auto;"
 +
!Sonic||$42620
 +
|-
 +
| Body||$3FD98
 
|}
 
|}

Revision as of 10:00, 18 February 2021

Models start at $3F908 in MUSEUM.MUS.

Model Format

Models generally consist of the following parts. There are some exceptions, but the general order stays the same.

Vertices

The first part are vertices, stored as a 3D vector.

Indexing Table

The second part is the indexing table for quads, using the vertices given. Indices are words, and jump by $08. The first vertex would be $0000; the second would be $0008. There's one for each quad.

Vertex Normals

The third, for objects that use Dynamic Gouraud Shading, are the vertex normals. These are normalized 3D vectors. As you'd expect, there's one for each vertex.

Draw Settings

After the above is the draw settings. There's one list of settings for each quad. Each list is 16 bytes long. Here's its format:

Description Length
Unknown. Highest bit seems to turn off backface culling. Byte
Unknown. Bits $1 and $2 affect depth testing in certain instances. Byte
Texture index. $0-$1DB. Word
CMDPMOD command for VDP1. Bit flags. Word
Unknown. Word
Static/Dynamic Gouraud Shading Table Index. Word
CMDCTRL command for VDP1. Bit flags. Word
Unknown. Word
Unknown. Word

Footer

This can vary from model to model, depending on which parts are present. For Sonic, this consists of the following:

  • Pointer to start of vertices (long), number of vertices (long)
  • Pointer to start of indexing table (long), number of quads (long)
  • Pointer to draw command (long)
  • Pointer to vertex normals (long)

Model Groups

Some models, such as Sonic and Tails, consist of multiple models in a group. After the last model in the group, there's a footer.

The first part of the footer is a list of addresses pointing to each model's footer.

The second part is a list of 3D Vectors, relative positions for each model. They correspond to the addresses given in the previous section.

Certain model groups have some seemingly unused data that appears before the footer. This data seems to correlate with how the model group parenting hierarchy is set up.

Model List

Here's the list of models in the game that I know of. Addresses given are pointers to footers, for both model groups and individual models.

Sonic $42620
Body $3FD98