Texture: Difference between revisions

6,399 bytes removed ,  7 months ago
m
Fix link
m (Table normalization)
m (Fix link)
 
(14 intermediate revisions by the same user not shown)
Line 1:
{{ParadiseResourceTypeInfobox
| name = Texture
| othernames = RwRaster, PlaneTexture, and TexturePage
| example = [[File:Paradise Texture Example.png|frameless|200px]]<br />A texture sheet used in the Driver Details menu.
| id = 0x0
| category = Generic
| memdist = Header in Main Memory<br />Data in [[Bundle 2/Burnout Paradise#Memory types|secondary]]
| importedby = [[Apt Data]]<br />[[Flapt File]]<br />[[Font]]<br />[[Renderable]]<br />[[Satnav Tile]]<br />[[Texture State]]
| editor = Yes*<br /><sup><small>*Header may require manual editing</small></sup><br />Export using [[Modding/Burnout Paradise|Noesis]]<br />Edit with [https://getpaint.net/ Paint.NET] or similar**<br /><sup><small>**DDS requires manual header removal for reimport</small></sup>
}}
 
Textures are images used in-game, generally either displayed directly or applied to a model. In Burnout Paradise, their format differs heavily between platforms. Despite this, they generally use variations of the same codecs—DXT1, DXT5 and A8R8G8B8. Mipmaps are used systematically throughout the game as well.
 
= LayoutVariants =
As texture formats are platform-specific, this page is split into per-platform subpages.
== PlayStation 3 ==
{{subpage|PlayStation 3|text=Information on the CellGcmTexture, the format used on PlayStation 3.}}
The majority of this information is from the SCE PS3 SDK: CellGcmTexture datatype reference, though Burnout's debugging symbols were also referenced.
{{subpage|Xbox 360|text=Information on D3DBaseTexture, the format used on Xbox 360.}}
 
{{subpage|PC|text=Information on the format used on PC.}}
=== renderengine::Texture ===
{{subpage|Remastered|text=Information on the format used in all versions of Burnout Paradise Remastered.}}
{| class="wikitable"
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x1 || uint8_t || m_format || Texture format || See [[#Format | format]]
|-
| 0x1 || 0x1 || uint8_t || m_mipmap || Number of mipmap levels (1-13) || Sum of the maximum number of mipmap levels for the texture + 1
|-
| 0x2 || 0x1 || uint8_t || m_dimension || Texture dimension || See [[#Dimension | dimension]]
|-
| 0x3 || 0x1 || uint8_t || m_cubemap || Enable or disable cube mapping || See [[#CubeMapEnable | CubeMapEnable]]
|-
| 0x4 || 0x4 || uint32_t || m_remap || Method of selecting each element of the color value || See [[#Remap | remap]]
|-
| 0x8 || 0x2 || uint16_t || m_width || Width of texture (1-4096) ||
|-
| 0xA || 0x2 || uint16_t || m_height || Height of texture (1-4096) ||
|-
| 0xC || 0x2 || uint16_t || m_depth || Depth of texture (1-512) || Always 1 in Burnout as 3D textures are not used
|-
| 0xE || 0x1 || uint8_t || m_location || Location of texture data (main memory or local memory) || See [[#Location | location]]
|-
| 0xF || 0x1 || uint8_t || m_padding || ||
|-
| 0x10 || 0x4 || uint32_t || m_pitch || Pitch size of texture || See [[#Pitch | pitch]]
|-
| 0x14 || 0x4 || uint32_t || m_offset || Offset value from the base address of the texture data location ||
|-
| 0x18 || 0x4 || void * || m_buffer || || Texture
|-
| 0x1C || 0x4 || Type || m_storeType || Store type || See [[#renderengine::Texture::Type | type]]
|-
| 0x20 || 0x4 || uint32_t || m_storeFlags || Store flags || Seemingly unused
|}
 
=== Format ===
Swizzling and normalization is not used in Burnout, so these flags are unused.
 
Below is the bitwise structure for the format field.
{| class="wikitable"
|-
! Bit !! Length !! Comments
|-
| 0 || 5 || Color format. See [[#Color format | color format]]
|-
| 5 || 1 || Swizzle flag. See [[#Swizzle flag | swizzle flag]]
|-
| 6 || 1 || Normalization flag. See [[#Normalization flag | normalization flag]]
|-
| 7 || 1 || Unused, always 1
|}
 
For example, the following is the DXT5 format as found in Burnout:
{| class="wikitable"
|+ Format 0x88
|-
! 1 !! 0 !! 0 !! 0 !! 1 !! 0 !! 0 !! 0
|-
| Unused || CELL_GCM_TEXTURE_NR || CELL_GCM_TEXTURE_SZ || colspan=5 | CELL_GCM_TEXTURE_COMPRESSED_DXT45
|}
 
=== Remap ===
The remap order is only used when one of the following color formats is specified:
* CELL_GCM_TEXTURE_COMPRESSED_HILO8
* CELL_GCM_TEXTURE_COMPRESSED_HILO_S8
* CELL_GCM_TEXTURE_X16
* CELL_GCM_TEXTURE_Y16_X16
* CELL_GCM_TEXTURE_Y16_X16_FLOAT
 
These are not used in Burnout, so the remap field is unused.
 
Below is the bitwise structure for the remap field.
{| class="wikitable"
|-
! Bit !! Length !! Comments
|-
| 0 || 16 || Remap order
|-
| 16 || 2 || Output blue element
|-
| 18 || 2 || Output green element
|-
| 20 || 2 || Output red element
|-
| 22 || 2 || Output alpha element
|-
| 24 || 2 || Input blue element
|-
| 26 || 2 || Input green element
|-
| 28 || 2 || Input red element
|-
| 30 || 2 || Input alpha element
|}
 
=== Pitch ===
Pitch is the texture width multiplied by the bytes per texel. It must be specified when using linear texture formats or DXT compression. If the texture is swizzled or the DXT texture width is a power of 2, pitch is ignored. Otherwise, it must be 16 or more.
 
Burnout only uses textures with widths at powers of 2, so pitch is unused. However, if it becomes necessary to calculate pitch, the following formula may be used for DXT textures:
 
<code>pitch = floor((width+3)/4)* block_size</code>
 
Where <code>block_size</code> is 8 for DXT1 and 16 for DXT2 through DXT5.
 
= Enumerations =
== PlayStation 3 ==
Much of this information is from the SCE PS3 SDK: GCM Method Macros Overview, section 6.4: TextureFormat. Some information is also from the CellGcmTexture datatype documentation. Various other sources are used.
 
=== Color format ===
{| class="wikitable"
! Name !! Value !! Comments
|-
| CELL_GCM_TEXTURE_B8 || 0x81 || One 8-bit unsigned integer
|-
| CELL_GCM_TEXTURE_A1R5G5B5 || 0x82 || One 1-bit value and three unsigned 5-bit integers
|-
| CELL_GCM_TEXTURE_A4R4G4B4 || 0x83 || Four unsigned 4-bit values
|-
| CELL_GCM_TEXTURE_R5G6B5 || 0x84 || 5-bit, 6-bit, and 5-bit unsigned integers
|-
| CELL_GCM_TEXTURE_A8R8G8B8 || 0x85 || Four 8-bit unsigned integers
|-
| CELL_GCM_TEXTURE_COMPRESSED_DXT1 || 0x86 || 4x4 pixels compressed to 8 bytes
|-
| CELL_GCM_TEXTURE_COMPRESSED_DXT23 || 0x87 || 4x4 pixels compressed to 16 bytes
|-
| CELL_GCM_TEXTURE_COMPRESSED_DXT45 || 0x88 || 4x4 pixels compressed to 16 bytes
|-
| CELL_GCM_TEXTURE_G8B8 || 0x8B || Two 8-bit unsigned integers
|-
| CELL_GCM_TEXTURE_R6G5B5 || 0x8F || 6-bit, 5-bit, and 5-bit unsigned integers
|-
| CELL_GCM_TEXTURE_DEPTH24_D8 || 0x90 || One 24-bit fixed, and 8-bit dummy data
|-
| CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT || 0x91 || One 24-bit float, and 8-bit dummy data
|-
| CELL_GCM_TEXTURE_DEPTH16 || 0x92 || One 16-bit fixed
|-
| CELL_GCM_TEXTURE_DEPTH16_FLOAT || 0x93 || One 16-bit float value
|-
| CELL_GCM_TEXTURE_X16 || 0x94 || One 16-bit integer
|-
| CELL_GCM_TEXTURE_Y16_X16 || 0x95 || Two 16-bit integer
|-
| CELL_GCM_TEXTURE_R5G5B5A1 || 0x97 || Three 5-bit unsigned integers, and one 1-bit value
|-
| CELL_GCM_TEXTURE_COMPRESSED_HILO8 || 0x98 || Two unsigned 16-bit values compressed to two 8-bit values
|-
| CELL_GCM_TEXTURE_COMPRESSED_HILO_S8 || 0x99 || Two signed 16-bit values compressed to two 8-bit values
|-
| CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT || 0x9A || Four 16-bit float values
|-
| CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT || 0x9B || Four 32-bit float values
|-
| CELL_GCM_TEXTURE_X32_FLOAT || 0x9C || One 32-bit float value
|-
| CELL_GCM_TEXTURE_D1R5G5B5 || 0x9D || 1-bit dummy data, and three 5-bit unsigned integers
|-
| CELL_GCM_TEXTURE_D8R8G8B8 || 0x9E || 8-bit dummy data, and three 8-bit unsigned integers
|-
| CELL_GCM_TEXTURE_Y16_X16_FLOAT || 0x9F || Two 16-bit float values
|-
| CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8 || 0xAD || Two pixels compressed in the YUV format to 32 bits
|-
| CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8 || 0xAE || Two pixels compressed in the YUV format to 32 bits
|}
 
=== Swizzle flag ===
Swizzle can only be used when the width is not a power of two. Pitch must be specified.
{| class="wikitable"
! Name !! Value !! Comments
|-
| CELL_GCM_TEXTURE_SZ || 0x0 || Use the swizzle format
|-
| CELL_GCM_TEXTURE_LN || 0x20 || Use the linear format
|}
 
=== Normalization flag ===
{| class="wikitable"
! Name !! Value !! Comments
|-
| CELL_GCM_TEXTURE_NR || 0x0 || Normalize texture coordinates
|-
| CELL_GCM_TEXTURE_UN || 0x40 || Do not normalize texture coordinates
|}
 
=== Dimension ===
Depth textures cannot be 3D.
{| class="wikitable"
! Name !! Value !! Comments
|-
| CELL_GCM_TEXTURE_DIMENSION_1 || 1 || 1D texture
|-
| CELL_GCM_TEXTURE_DIMENSION_2 || 2 || 2D texture
|-
| CELL_GCM_TEXTURE_DIMENSION_3 || 3 || 3D texture
|}
 
=== CubeMapEnable ===
{| class="wikitable"
! Name !! Value !! Comments
|-
| CELL_GCM_FALSE || 0 || Disable
|-
| CELL_GCM_TRUE || 1 || Enable
|}
 
=== Location ===
{| class="wikitable"
! Name !! Value !! Comments
|-
| CELL_GCM_LOCATION_LOCAL + 1 || 1 || Local memory
|-
| CELL_GCM_LOCATION_MAIN + 1 || 2 || Main memory
|}
 
=== renderengine::Texture::Type ===
{| class="wikitable"
|-
! Name !! Value !! Comments
|-
| TYPE_NA || -1 ||
|-
| TYPE_1D || 1 ||
|-
| TYPE_2D || 2 ||
|-
| TYPE_3D || 3 ||
|-
| TYPE_CUBE || 0x10002 ||
|-
| TYPE_FORCEENUMSIZEINT || 0x7FFFFFFF ||
|}