EvilEngine/PIPT: Difference between revisions
Battlepedia>Igorseabra4 No edit summary |
EnergyDrink (talk | contribs) (new movie format) |
||
(11 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
<onlyinclude> |
|||
{{AssetInfobox |
|||
{{#vardefine:typeid|PIPT}}<nowiki/> |
|||
|subtitle=Pipe Info Table |
|||
{{#vardefine:name|Pipe Info Table}}<nowiki/> |
|||
|type=[[Binary]] |
|||
{{#vardefine:type|[[Binary]]}}<nowiki/> |
|||
|games=Battle for Bikini Bottom<br>The SpongeBob SquarePants Movie<br>The Incredibles<br>Rise of the Underminer}} |
|||
{{#vardefine:basetype|}}<nowiki/> |
|||
{{#vardefine:games|BFBB TSSM Incredibles ROTU RatProto}}<nowiki/> |
|||
{{#vardefine:sourcecode|[https://github.com/bfbbdecomp/bfbb/blob/master/src/Core/x/xModel.h xModel.h]}}<nowiki/> |
|||
{{#vardefine:image|}}<nowiki/> |
|||
</onlyinclude> |
|||
{{AutoAssetInfobox}} |
|||
The pipeline information table contains additional material information for level objects. The asset consists of an array of entries, each with rendering information for an entire [[MODL]] asset or a single mesh within it. |
|||
==Format== |
==Format== |
||
The file starts with an int which defines the amount of entries, then each entry has the following layout, being 0x0C bytes long in BFBB and 0x10 in Movie: |
|||
'''Battle for Bikini Bottom''' |
|||
<source lang=cpp> |
|||
struct xModelPipeInfo |
|||
{ |
|||
unsigned int ModelHashID; |
|||
unsigned int SubObjectBits; |
|||
unsigned int PipeFlags; |
|||
}; |
|||
</source> |
|||
'''The SpongeBob SquarePants Movie - Ratatouille Prototype''' |
|||
<source lang=cpp> |
|||
struct xModelPipeTable |
|||
{ |
|||
unsigned int ModelHashID; |
|||
unsigned int SubObjectBits; |
|||
xModelPipe Pipe; |
|||
}; |
|||
struct xModelPipe |
|||
{ |
|||
unsigned int Flags; |
|||
unsigned char Layer; |
|||
unsigned char AlphaDiscard; |
|||
unsigned short PipePad; |
|||
}; |
|||
</source> |
|||
{| class="wikitable" |
{| class="wikitable" |
||
! Offset !! Type !! |
! Offset !! Type !! Variable !! Description |
||
|- |
|- |
||
| 0x00 || |
| 0x00 || uint32 || '''ModelHashID''' || [[MODL]] ID |
||
|- |
|- |
||
| 0x04 || uint32 || '''SubObjectBits''' || Specifies which RW atomics in the model to apply this pipe info entry to. Each bit is an on/off state for an atomic, starting with the last atomic as the least significant bit (0x1) and ending with the first atomic as the most significant bit. |
|||
| 0x04 || int || unknown || Usually -1; might be mesh index in the model? |
|||
For example, if a model has 4 atomics: |
|||
* 0x1 is the on/off state for the 4th atomic |
|||
* 0x2 is the on/off state for the 3rd atomic |
|||
* 0x4 is the on/off state for the 2nd atomic |
|||
* 0x8 is the on/off state for the 1st atomic |
|||
When a pipe entry should be applied to all atomics, this is usually set to 0xFFFFFFFF. |
|||
|- |
|- |
||
| 0x08 || uint32 || '''PipeFlags [Flags]''' || Bitfield of various rendering flags. The layout is the following (left side is most significant, right side is least significant): |
|||
| 0x08 || byte || Related to visibility? || |
|||
<pre> |
|||
AAAA AAAA BBBB CCCD EEEE FFFF GGHH IIJJ |
|||
</pre> |
|||
* A - Alpha compare value (0-255). Atomics with transparent textures use this value to filter out pixels below a certain alpha threshold. Only pixels with an alpha > this value will be rendered. Set this to 0 if you want all pixels to be rendered. |
|||
* B - Unknown (0-15) |
|||
* C - Unknown (0-7) |
|||
* D - Ignore Fog (0-1). If set, atomics will not be rendered with fog. |
|||
* E - Destination Blend (0-15). Destination [[#RwBlendFunction|RwBlendFunction]] for atomics. |
|||
* F - Source Blend (0-15). Source [[#RwBlendFunction|RwBlendFunction]] for atomics. |
|||
* G - Lighting Mode (0-3). |
|||
** 0 - LightKit only |
|||
** 1 - Prelight only |
|||
** 2 - LightKit and Prelight |
|||
** 3 - Unknown |
|||
* H - Cull Mode (0-3). |
|||
** 0 - Unknown |
|||
** 1 - None. Atomics will be rendered with no front or back face culling. |
|||
** 2 - Back. Atomics will be rendered with back face culling. |
|||
** 3 - Dual. Atomics will be rendered once with front face culling, then once with back face culling. |
|||
* I - Z-Write Mode (0-3). |
|||
** 0 - Enabled. Atomics will be rendered with z-write enabled. |
|||
** 1 - Disabled. Atomics will be rendered with z-write disabled. |
|||
** 2 - Dual. Atomics will be rendered once with z-write disabled, then once with z-write enabled. |
|||
** 3 - Unknown |
|||
* J - Unknown |
|||
|- |
|- |
||
| 0x0C || uint8 || '''Layer''' || [[#LayerType|LayerType list]]. Specifies when to draw a transparent object |
|||
| 0x09 || byte || Culling || |
|||
|- |
|- |
||
| 0x0D || uint8 || '''AlphaDiscard''' || |
|||
| 0x0A || byte || Destination/Source Blend || When one of the digits is set to 0, their default factors will be used instead. |
|||
|- |
|- |
||
| |
| 0x0E || uint16 || '''PipePad''' || |
||
|- |
|||
| 0x0C || byte || unknown || Only present in Movie. |
|||
|- |
|||
| 0x0D || byte || unknown || Only present in Movie. |
|||
|- |
|||
| 0x0E || byte || unknown || Only present in Movie. |
|||
|- |
|||
| 0x0F || byte || unknown || Only present in Movie. |
|||
|} |
|} |
||
===RwBlendFunction=== |
|||
Note: this applies to big endian (GameCube) only. The 4 bytes are reversed in little endian. |
|||
* 0 - N/A |
|||
* 1 - Zero |
|||
* 2 - One |
|||
* 3 - Source Color |
|||
* 4 - Inverse Source Color |
|||
* 5 - Source Alpha |
|||
* 6 - Inverse Source Alpha |
|||
* 7 - Destination Alpha |
|||
* 8 - Inverse Destination Alpha |
|||
* 9 - Destination Color |
|||
* 10 - Inverse Destination Color |
|||
* 11 - Source Alpha Saturated |
|||
=== |
===LayerType=== |
||
<pre> |
|||
* 0x00 - Source Alpha/Inverse Source Alpha |
|||
00 - FIRST Draw first |
|||
* 0x01 - Zero |
|||
01 - PREPICKUP Draw before pickups |
|||
* 0x02 - One |
|||
02 - POSTPICKUP Draw just after pickups |
|||
* 0x03 - Source Color |
|||
03 - PREOOB Draw before the OOB object |
|||
* 0x04 - Inverse Source Color |
|||
04 - POSTOOB Draw just after the OOB object |
|||
* 0x05 - Source Alpha |
|||
05 - PRECUTSCENE Draw before cutscene objects |
|||
* 0x06 - Inverse Source Alpha |
|||
06 - POSTCUTSCENE Draw just after cutscene objects |
|||
* 0x07 - Destination Alpha |
|||
07 - PRENPC Draw before NPC objects |
|||
* 0x08 - Inverse Destination Alpha |
|||
08 - POSTNPC Draw just after NPC objects |
|||
* 0x09 - Destination Color |
|||
09 - PRESHADOW Draw before shadows |
|||
* 0x0A - Inverse Destination Color |
|||
10 - POSTSHADOW Draw just after shadows |
|||
* 0x0B - Source Alpha Saturated |
|||
11 - PREFX Draw before lightning, glares, etc. |
|||
12 - POSTFX Draw after glares, etc. |
|||
13 - PREPARTICLES Draw before particles |
|||
14 - POSTPARTICLES Draw after particles |
|||
15 - PRENORMAL4 Draw before normal transparencies (4 stages) |
|||
16 - PRENORMAL3 Draw before normal transparencies (3 stages) |
|||
17 - PRENORMAL2 Draw before normal transparencies (2 stages) |
|||
18 - PRENORMAL Draw before normal transparencies |
|||
19 - NORMAL Draw in the normal position |
|||
20 - POSTNORMAL Draw directly after transparencies |
|||
21 - POSTNORMAL2 Draw directly after transparencies (2 stages) |
|||
22 - POSTNORMAL3 Draw directly after transparencies (3 stages) |
|||
23 - POSTNORMAL4 Draw directly after transparencies (4 stages) |
|||
24 - PREPTANK Draw before ptank effects |
|||
25 - POSTPTANK Draw after ptank effects |
|||
26 - PREDECAL Draw before decals |
|||
27 - POSTDECAL Draw after decals |
|||
28 - PRELASTFX Draw before lasers, etc. |
|||
29 - POSTLASTFX Draw directly after lasers, etc. |
|||
30 - PRELAST Draw before last |
|||
31 - LAST Draw last |
|||
</pre> |
|||
===Movie Model Asset ID=== |
===Movie Model Asset ID=== |
||
Line 53: | Line 147: | ||
It's unknown why this was done this way and whether having the entry reference a hash with .dff at the end will work or not. |
It's unknown why this was done this way and whether having the entry reference a hash with .dff at the end will work or not. |
||
{{Assets}} |
|||
{{AutoGameNavs}} |
|||
[[Category:Asset]] |
[[Category:Asset]] |
Latest revision as of 18:56, 1 November 2022
PIPT | |
---|---|
Pipe Info Table | |
Type | Binary |
Games used | Battle for Bikini Bottom The SpongeBob SquarePants Movie |
Source code | xModel.h |
The pipeline information table contains additional material information for level objects. The asset consists of an array of entries, each with rendering information for an entire MODL asset or a single mesh within it.
Format
The file starts with an int which defines the amount of entries, then each entry has the following layout, being 0x0C bytes long in BFBB and 0x10 in Movie:
Battle for Bikini Bottom
struct xModelPipeInfo
{
unsigned int ModelHashID;
unsigned int SubObjectBits;
unsigned int PipeFlags;
};
The SpongeBob SquarePants Movie - Ratatouille Prototype
struct xModelPipeTable
{
unsigned int ModelHashID;
unsigned int SubObjectBits;
xModelPipe Pipe;
};
struct xModelPipe
{
unsigned int Flags;
unsigned char Layer;
unsigned char AlphaDiscard;
unsigned short PipePad;
};
Offset | Type | Variable | Description |
---|---|---|---|
0x00 | uint32 | ModelHashID | MODL ID |
0x04 | uint32 | SubObjectBits | Specifies which RW atomics in the model to apply this pipe info entry to. Each bit is an on/off state for an atomic, starting with the last atomic as the least significant bit (0x1) and ending with the first atomic as the most significant bit.
For example, if a model has 4 atomics:
When a pipe entry should be applied to all atomics, this is usually set to 0xFFFFFFFF. |
0x08 | uint32 | PipeFlags [Flags] | Bitfield of various rendering flags. The layout is the following (left side is most significant, right side is least significant):
AAAA AAAA BBBB CCCD EEEE FFFF GGHH IIJJ
|
0x0C | uint8 | Layer | LayerType list. Specifies when to draw a transparent object |
0x0D | uint8 | AlphaDiscard | |
0x0E | uint16 | PipePad |
RwBlendFunction
- 0 - N/A
- 1 - Zero
- 2 - One
- 3 - Source Color
- 4 - Inverse Source Color
- 5 - Source Alpha
- 6 - Inverse Source Alpha
- 7 - Destination Alpha
- 8 - Inverse Destination Alpha
- 9 - Destination Color
- 10 - Inverse Destination Color
- 11 - Source Alpha Saturated
LayerType
00 - FIRST Draw first 01 - PREPICKUP Draw before pickups 02 - POSTPICKUP Draw just after pickups 03 - PREOOB Draw before the OOB object 04 - POSTOOB Draw just after the OOB object 05 - PRECUTSCENE Draw before cutscene objects 06 - POSTCUTSCENE Draw just after cutscene objects 07 - PRENPC Draw before NPC objects 08 - POSTNPC Draw just after NPC objects 09 - PRESHADOW Draw before shadows 10 - POSTSHADOW Draw just after shadows 11 - PREFX Draw before lightning, glares, etc. 12 - POSTFX Draw after glares, etc. 13 - PREPARTICLES Draw before particles 14 - POSTPARTICLES Draw after particles 15 - PRENORMAL4 Draw before normal transparencies (4 stages) 16 - PRENORMAL3 Draw before normal transparencies (3 stages) 17 - PRENORMAL2 Draw before normal transparencies (2 stages) 18 - PRENORMAL Draw before normal transparencies 19 - NORMAL Draw in the normal position 20 - POSTNORMAL Draw directly after transparencies 21 - POSTNORMAL2 Draw directly after transparencies (2 stages) 22 - POSTNORMAL3 Draw directly after transparencies (3 stages) 23 - POSTNORMAL4 Draw directly after transparencies (4 stages) 24 - PREPTANK Draw before ptank effects 25 - POSTPTANK Draw after ptank effects 26 - PREDECAL Draw before decals 27 - POSTDECAL Draw after decals 28 - PRELASTFX Draw before lasers, etc. 29 - POSTLASTFX Draw directly after lasers, etc. 30 - PRELAST Draw before last 31 - LAST Draw last
Movie Model Asset ID
One important detail in the PIPT asset in Movie Game is that, in some of the entries, the model Asset ID will be a hash of the model's name without the .dff extension at the end, being different from if it were hashed from the name with .dff. This can be noted in Industrial Park's PIPT editor in which some of the PIPT entries refer to the model's name without .dff at the end:
It's unknown why this was done this way and whether having the entry reference a hash with .dff at the end will work or not.