Both sides previous revisionPrevious revisionNext revision | Previous revision |
trs:miscellany [2020/05/19 12:03] – [Object Texture Vertex Structure] zdimension | trs:miscellany [2020/12/11 18:26] (current) – [Object Textures] typo stohrendorf |
---|
===== Palette ===== | ===== Palette ===== |
| |
This consists of 256 [[trs:fundamentals#tr_colour|[tr_colour]]] structs, one for each palette entry. However, the individual colour values range from 0 to 63; they must be multiplied by 4 (or bitshifted by 2 to the left) to get the correct values. | This consists of 256 [[trs:fundamentals#tr_colour|[tr_colour]]] structs, one for each palette entry. However, the individual colour values range from 0 to 63; they must be multiplied by 4 (or bitshifted by 2 to the left) to get the correct values. Palette is used for all 8-bit colour, such as 8-bit textures. |
| |
This used for all 8-bit colour, such as 8-bit textures. | {{:icons:tr1.png?nolink|TR1 only}} First entry in palette is treated as //transparent colour// used for textures with alpha testing. In later games, transparent colour was replaced by so-called "magenta transparency", meaning that any pixel with red and blue values at maximum and green value at zero, is treated as completely transparent. |
| |
===== Object Textures ===== | ===== Object Textures ===== |
| |
An object texture (or //texture details// in TRLE terms) keeps detailed information about each texture independently used in the game. While it’s not a texture image itself (these are kept inside //texture atlases//), it’s rather a reference to a particular texture in an atlas atlas, kept with all other necessary information to display this texture. | An object texture (or //texture details// in TRLE terms) keeps detailed information about each texture independently used in the game. While it’s not a texture image itself (these are kept inside //texture atlases//), it’s rather a reference to a particular texture in an atlas, kept with all other necessary information to display this texture. |
| |
==== Object Texture Vertex Structure ==== | ==== Object Texture Vertex Structure ==== |
| |
* //Bits 0..14// specify the //texture atlas// to use. On PC, the value should be between 0 and 63 (inclusive). | * //Bits 0..14// specify the //texture atlas// to use. On PC, the value should be between 0 and 63 (inclusive). |
* //Bit 15//: {{:icons:tr3.png?nolink|TR3 only}}{{:icons:tr4.png?nolink|TR4 only}}{{:icons:tr5.png?nolink|TR5 only}} if set, it indicates that the texture is used on a triangle face. | * //Bit 15//: {{:icons:tr4.png?nolink|TR4 only}}{{:icons:tr5.png?nolink|TR5 only}} if set, it indicates that the texture is used on a triangle face. |
| |
''%%Attribute%%'' specifies transparency mode (i.e. //blending mode//) used for face with this texture applied. There are several ones available: | ''%%Attribute%%'' specifies transparency mode (i.e. //blending mode//) used for face with this texture applied. There are several ones available: |
''%%NewFlags%%'' is a bit field with flags: | ''%%NewFlags%%'' is a bit field with flags: |
| |
* **Bits 0..2** — Mapping correction. It seems that these bits change the way the texture is applied. | * **Bits 0..2** — Mapping correction. This value is used by internal ''AdjustUV'' function which crops the texture in specific way to prevent //border bleeding issue// happening because of texture atlas packing. Value meaning depends on texture face type (triangle or quad). For quads, only types ''0'' and ''1'' are actually used (''0'' being normal and ''1'' being mirrored quad texture), while other types (2-7) produce same result as 0. For triangles, all possible values (0-7) are used for each possible right triangle type (including mirrored coordinates): |
* **Bits 11..12** — Specifies bump mapping level (see above), so can be either ''%%00 = 0%%'' (no bump mapping), ''%%01 = 1%%'' (level 1) or ''%%10 = 2%%'' (level 2). | |
| |{{:illustrations:mapping-correction.png?nolink|illustrations/mapping-correction.png}}| |
| |//Triangle mapping correction types. Orange shapes indicate normal (non-mirrored) texture coordinates, while blue shapes indicate mirrored ones. Mirrored coordinates mean that they are placed in counterclockwise order.//| |
| |
| * **Bits 9..10** — Specifies bump mapping level (see above), so can be either ''%%00 = 0%%'' (no bump mapping), ''%%01 = 1%%'' (level 1) or ''%%10 = 2%%'' (level 2). |
* **Bit 15** — If set, the texture is for a triangle/quad from a room geometry. If not set, the texture is for a static mesh or model. | * **Bit 15** — If set, the texture is for a triangle/quad from a room geometry. If not set, the texture is for a static mesh or model. |
| |
* ''%%EXPLOSION_FX%%'' — Plays //global// explosion sound (ID #105) and produce full-screen flash graphical FX (TR3-5) or camera shake effect (TR1-2). | * ''%%EXPLOSION_FX%%'' — Plays //global// explosion sound (ID #105) and produce full-screen flash graphical FX (TR3-5) or camera shake effect (TR1-2). |
* ''%%FLOOD_FX%%'' — Plays //global// flooding sound (TR1 — ID #81, TR2 — ID #79, TR3 — ID #163, TR4 — ID #238). Implementation differs from version to version — in TR1 and TR2 looped waterfall sound is used (which is then stopped by an engine after 1 second), while in TR3 and TR4 one-shot sound is engaged. | * ''%%FLOOD_FX%%'' — Plays //global// flooding sound (TR1 — ID #81, TR2 — ID #79, TR3 — ID #163, TR4 — ID #238). Implementation differs from version to version — in TR1 and TR2 looped waterfall sound is used (which is then stopped by an engine after 1 second), while in TR3 and TR4 one-shot sound is engaged. |
| * ''%%FOOTPRINT_FX%%'' — Plays random footprint sound effect, taking current block's **material index** into consideration. On PlayStation, also applies footprint sprite under left or right Lara foot (target foot is selected based on packed flag which is stored in animcommand argument — [[trs:mesh_construction_animation#animcommand-structure|look here]] for details). |
| |
| |