Editing PVR

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
[[Category:Software]]<noinclude>[[Category:Main]]</noinclude>
[[Category:Software]]<noinclude>[[Category:Main]]</noinclude>
<div style="float:right">[[File:Texture-Icon-AA.JPG|100px|thumb|left|Standard model image widely used]]</div>


<div style="color: #ffffff; background-color: #505652; border: 1px solid #808000; padding: 5px; {{box-shadow|4px|4px|8px|#b0b090}}">
<div style="color: #ffffff; background-color: #505652; border: 1px solid #808000; padding: 5px; {{box-shadow|4px|4px|8px|#b0b090}}">
Line 10: Line 8:


== Features ==
== Features ==
<div style="float:right">[[File:03_PVRTC_ATITC_ETC1_BC1_comparison.png|200px|left]]</div>


*PVRTC supports both opaque (RGB) and translucent (RGBA) textures (unlike other formats such as S3TC that require a dedicated, larger form to support full alpha channels).
*PVRTC supports both opaque (RGB) and translucent (RGBA) textures (unlike other formats such as S3TC that require a dedicated, larger form to support full alpha channels).
Line 17: Line 13:


== File format ==
== File format ==
 
The PVR (.pvr) format (Sony uses a custom header) consists of:
The PVR (.pvr) format (specification version 3.0.0) consists of:
 
{| class="wikitable" style="text-align: center;"
|-
| style="background-color:#505652; color:#FFFFFF;" |'''Header'''<br />52 bytes (0x34)
| style="background-color:#505652; color:#FFFFFF;" |'''Meta Data (optional)'''<br />variable
| style="background-color:#505652; color:#FFFFFF;" |'''Texture Data'''<br />variable
|-
|}


=== Header ===
=== Header ===
Line 54: Line 41:
| 0x14 || 0x04 || 00 00 00 00 || 0 || '''Channel Type:'''
| 0x14 || 0x04 || 00 00 00 00 || 0 || '''Channel Type:'''
|-
|-
| 0x18 || 0x04 || 00 01 00 00 || 256 || '''Height:''' width of the texture stored in the texture data, in pixels.
| 0x18 || 0x08 || 00 01 00 00 || 256 || '''Height:'''
|-
|-
| 0x1C || 0x04 || 00 01 00 00 || 256 || '''Width:''' width of the texture stored in the texture data, in pixels.
| 0x1C || 0x04 || 00 01 00 00 || 256 || '''Width:'''
|-
|-
| 0x20 || 0x04 || 01 00 00 00 || 1 || '''Depth:''' depth of the texture stored in the texture data, in pixels.
| 0x20 || 0x04 || 01 00 00 00 || 1 || '''Depth:'''
|-
|-
| 0x24 || 0x04 || 01 00 00 00 || 1 || '''Num. Surfaces:''' number of surfaces within the texture array.
| 0x24 || 0x04 || 01 00 00 00 || 1 || '''Num. Surfaces:'''
|-
|-
| 0x28 || 0x04 || 01 00 00 00 || 1 || '''Num. Faces:''' number of faces in a cube map.
| 0x28 || 0x04 || 01 00 00 00 || 1 || '''Num. Faces:'''
|-
|-
| 0x2C || 0x04 || 01 00 00 00 || 1 || '''MIP-Map Count:''' number of MIP-Map levels present including the top level.
| 0x2C || 0x04 || 00 00 00 00 || 0 || '''Meta Data Size:'''
<small>
A value of one, therefore, means that only the top level texture exists.
</small>
|-
| 0x30 || 0x04 || 00 00 00 00 || 0 || '''Meta Data Size:''' allows for the creator of a PVR to store custom information within the PVR file relating to the storage.
|-
|-
|}
|}


==== Pixel Format ====
==== Pixel Format ====
Line 235: Line 218:
|}
|}


=== Meta Data Format ===
==== Meta Data Format ====


{| class="wikitable" style="text-align: center;"
...
|-
| style="background-color:#505652; color:#FFFFFF;" |'''FourCC'''<br />4 bytes
| style="background-color:#505652; color:#FFFFFF;" |'''Key'''<br />4 bytes
| style="background-color:#505652; color:#FFFFFF;" |'''Data Size'''<br />4 bytes
| style="background-color:#505652; color:#FFFFFF;" |'''Data'''<br />variable
| style="background-color:#505652; color:#FFFFFF;" |'''Padding'''<br />variable
|-
|}
 
==== FourCC ====
 
is a four byte identifier (consisting of single byte characters or integers) whose value, combined with the value of ‘Key’, is used to determine how ‘Data’ should be handled.<br />
The values {‘P’, ‘V’, ‘R’, 0} to {‘P’, ‘V’, ‘R’, 255} (and their numerical equivalents) are reserved and must not be used except as described in Pre-defined Medata Data section.<br />


==== Pre-defined Medata Data ====
=== Texture compression ===
 
{| class="wikitable" style="text-align: center;"
|-
| style="background-color:#505652; color:#FFFFFF;" |'''FourCC'''
| style="background-color:#505652; color:#FFFFFF;" |'''Key'''
| style="background-color:#505652; color:#FFFFFF;" |'''Data Size'''
| style="background-color:#505652; color:#FFFFFF;" |'''Data Description'''
|-
|colspan="5" style="text-align:center; background-color:lightblue;" | <span style="color:black;">Pre-defined metadata</span>
|-
| ‘P’, ‘V’, ‘R’, 3 || 0 || Variable ||  An array of integers describing the position and sizes of each texture within a texture atlas.<br /> <small>Each sequence of four integers represents the information for a single texture within the atlas and appear in the order:</small> 
*1. X Position
*2. Y Position
*3. Width
*4. Height
|-
| ‘P’, ‘V’, ‘R’, 3 || 1 || 8 || Specifies that the file contains normal map information.<br />
<small>
The 8 bytes are in the form of a 32bit float representing the scale of the normal map, followed by a four character array describing the order of the channels,<br /> for example {‘x’, ‘y’, ‘z’, ‘h’}. Use of ‘h’ as the representation for a given channel denotes that the channel in question contains the original height map.
<small>
|-
| ‘P’, ‘V’, ‘R’, 3 || 2 || 6 || Specifies that the file contains a cube map and the order of the faces within that cube map.<br /> 
<small>
The 6 bytes represent a six character string. This string shows the order the cube map faces are stored in the texture data, for example ‘XxYyZz’.<br />
Uppercase letters refer to a positive axis position while lowercase refer to a negative axis position. Not all axes must be present.
<small>
|-
| ‘P’, ‘V’, ‘R’, 3 || 3 || 3 || Specifies the logical orientation of the texture within the texture data.<br />
<small>
This does not affect the mapping from pixels to texture coordinates. Each byte is a Boolean value representing the orientation for a single axis in the order X, Y, Z.<br />
The values are as follows:
<small>
*X Axis Non-zero value = values increase to the left , Zero value = X values increase to the right
*Y Axis Non-zero value = Y values increase upwards , Zero value = Y values increase downwards
*Z Axis Non-zero value = Z values increase outwards , Zero value = Z values increase inwards
|-
| ‘P’, ‘V’, ‘R’, 3 || 4 || 12 || Specifies whether the texture has a border.<br />
<small>
The 12 bytes are broken down into three unsigned 32bit integers. The three integers represent the size of the border of the image, in pixels, on the X, Y and Z axes, respectively.<br /> These values are used to offset texture reads by the size of the border in order to obtain the actual texture data.
<br />It should be noted that only three border sizes are given, this means that the border size for X is applied to both the left and right of the image, Y to the top and bottom and Z to the front and back.
</small>
|-
| ‘P’, ‘V’, ‘R’, 3 || 5 || variable || Specifies that this block contains padding data.<br />
<small>
The size of data varies in order to align the texture data with a convenient block boundary.<br />
The contents of data are left undefined. This block should be skipped during parsing.<br />
</small>
|-
|}
 
==== Key ====
 
is an unsigned 32bit integer, which, when coupled with ‘FourCC’ determines how ‘Data’ should be handled.
 
==== Data Size ====
 
is an unsigned 32bit integer representing the size of ‘Data’ in bytes.
 
==== Data ====
 
is an array of user defined information of size determined from ‘Data Size’ of a data type and purpose determined from the value of ‘FourCC’ and ‘Key’.
 
==== Padding ====
 
8 bytes or more, if defined.
 
=== Texture Data ===


*http://web.onetel.net.uk/~simonnihal/assorted3d/fenney03texcomp.pdf PVRTC algorithm: Texture Compression using Low-Frequency Signal Modulation
*http://web.onetel.net.uk/~simonnihal/assorted3d/fenney03texcomp.pdf PVRTC algorithm: Texture Compression using Low-Frequency Signal Modulation
*http://blog.imgtec.com/powervr/understanding-powervr-series5xt-pvrtc-pvrtc2-and-texture-compression-part-6 overview
*http://blog.imgtec.com/powervr/understanding-powervr-series5xt-pvrtc-pvrtc2-and-texture-compression-part-6 overview
== Tools ==
*http://community.imgtec.com/developers/powervr/tools/ suite of utilities and docs
== Related Articles ==
*[[GXT|.gxt]] Graphic texture files
Please note that all contributions to Vita Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see Vita Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)

Template used on this page: