Jump to content

Texture Editor: Difference between revisions

From SA Docs
No edit summary
mNo edit summary
Line 1: Line 1:
Texture Editor is a tool that can view and edit texture archives used in Sonic Adventure games. It can also be used to view individual texture files.
Texture Editor is a tool that can view and edit texture archives used in Sonic Adventure games. It can also be used to view individual texture files.


== Supported formats ==
== Supported Formats ==
Archives: PVM, GVM, XVM, PRS (texture archives only), PAK, PVMX, PB
Archives: PVM, GVM, XVM, PRS (texture archives only), PAK, PVMX, PB


Textures: PVR, GVR, XVR, DDS, PNG/BMP/JPG/GIF
Textures: PVR, GVR, XVR, DDS, PNG/BMP/JPG/GIF
== Using Texture Editor ==
== Using Texture Editor ==
[[File:294652610-de260eee-a182-46ec-94cd-70844a0ee4cb.png|600x600px]]
[[File:Texture Editor 1768154231020.png|left|thumb|Texture Editor user interface]]


=== Opening files ===
=== Opening Files ===
For ease of use, you can associate the supported file extensions with the program, which will make it open files on double click. Alternatively you can open texture files in SA Tools Hub, which will launch Texture Editor and make it open the selected file.
For ease of use, you can associate the supported file extensions with the program, which will make it open files on double click. Alternatively you can open texture files in SA Tools Hub, which will launch Texture Editor and make it open the selected file.


If you open an individual PVR, GVR or XVR file, the program will try to load all other textures in the same folder and display them as a list (as if they were all added to an archive).
If you open an individual PVR, GVR or XVR file, the program will try to load all other textures in the same folder and display them as a list (as if they were all added to an archive).


=== Editing archives ===
=== Editing Texture Archives ===
Use the control on the left to navigate the texture list. The buttons at the bottom left are used to add, remove and sort textures in the archive. The panel on the right contains editable parameters applicable to the current texture format and a preview image.
Use the list box on the left to navigate the texture list. The buttons at the bottom left are used to add, remove and sort textures in the archive. The panel on the right contains editable parameters applicable to the current texture format and a preview image.


==== '''Texture parameters''' ====
==== '''Texture Parameters''' ====
<code>Index</code> is the texture ID on the list. It indicates the order in which textures appear in the archive. You can change the index by sorting textures using the "Up" and "Down" buttons at the bottom of the texture list.
<code>Index</code> is the texture ID on the list. It indicates the order in which textures appear in the archive. You can change the index by sorting textures using the "Up" and "Down" buttons at the bottom of the texture list.


<code>Name</code> is a texture's individual name. Texture names are usually ignored in SADX.
<code>Name</code> is a texture's individual name. Texture names are only stored in the archive and ignored in the games.


<code>Global Index</code> is a unique texture ID used in the games' texture caching system. The game checks the global index when it loads a new texture, and if a texture with the same global index is already loaded, the new texture is discarded and the previously loaded texture is reused.
<code>Global Index</code> is a unique texture ID used in the games' texture caching system. The game checks the global index when it loads a new texture, and if a texture with the same global index is already loaded, the new texture is discarded and the previously loaded texture is reused.


<code>Mipmap</code> is a flag that indicates that the texture includes smaller copies of itself to be displayed from a distance. This makes distant textures look smoother. Usually mipmaps should be enabled for level textures and disabled for UI textures. Depending on the texture format, Texture Editor can generate or remove the texture's built-in mipmaps when this flag is toggled.
The <code>Mipmap</code> checkbox controls a flag that indicates that the texture includes smaller copies of itself to be displayed from a distance. This makes distant textures look smoother. Usually mipmaps should be enabled for level textures and disabled for UI textures. Depending on the texture format, Texture Editor can generate or remove the texture's built-in mipmaps when this flag is toggled. Note that PVR and GVR textures must be square to make it possible to add mipmaps to them.


<code>No Alpha Test</code> is a flag used by textures in SA2's PAK archives. This flag disables Alpha Test and Z Write, which can make transparent textures blend better or worse depending on how the model using the texture is rendered.
The <code>No Alpha Test</code> checkbox controls a flag used by textures in SA2's PAK archives. This flag disables Alpha Test and Z Write, which can make transparent textures blend better or worse depending on how the model using the texture is rendered.


<code>Size</code> is used to view texture width and height. For textures in PVMX archives, you can override texture dimensions. This is commonly used to store the original dimensions of a non-HD UI texture when making an HD version of it to avoid stretching issues ingame. <code>Actual Size</code> will display the texture's current (HD) dimensions.
<code>Size</code> is used to view texture width and height. For textures in PVMX archives, you can override texture dimensions. This is commonly used to store the original dimensions of a non-HD UI texture when making an HD version of it to avoid stretching issues ingame. <code>Actual Size</code> will display the texture's current (HD) dimensions.


<code>Data Format</code> is the way the texture is represented in binary. It depends on the texture format, whether the texture is square or rectangular, and whether it is compressed or not.
<code>Data Format</code> is the way the texture is represented in binary. It depends on the texture format, whether the texture is square or rectangular, and whether it is compressed or not. See Data Formats for more information.


<code>Pixel Format</code> is the way and order in which the colors are stored the texture's binary data. Available pixel formats depend on the texture format.
<code>Pixel Format</code> is the way and order in which the colors are stored the texture's binary data. Available pixel formats depend on the texture format. See Pixel Formats for more information.


<code>Surface Flags</code> (SA2 PC only) are additional flags picked up by the game's renderer.
<code>Surface Flags</code> (SA2 PC only) are additional flags picked up by the game's renderer.


==== '''Texture preview''' ====
==== '''Texture Preview''' ====
Use the slider to adjust the size of the preview. You can also enable or disable bilinear filtering in the program's Edit menu. Note: When enabled, the filtering is only applied to the preview, not the texture itself.
Use the Zoom slider to adjust the size of the preview, and the Mipmap slider to select the mipmap level if applicable.


==== '''Import and export''' ====
You can also enable or disable bicubic filtering for the texture preview in the program's <code>View</code> menu. Note: The filtering is only applied to the preview, not the texture itself.
The <code>Import...</code> button under the texture preview is used to replace the contents of the currently selected texture without adding a new texture. The <code>Export...</code> button is to save the selected texture as a PNG file. The <code>Save...</code> button is for saving individual textures in their original format (PVR, GVR, DDS etc.).


You can also import and export texture archives as folder texture packs using the File menu. Folder texture packs can be loaded by the [[SADX Mod Loader]] if they are placed in the mod's <code>textures</code> folder.
You can click the texture preview to copy it to the clipboard, or drag it outside the window to export it as a PNG file.


==== '''Working with paletted textures''' ====
==== '''Import and Export''' ====
To be continued
The <code>Import Texture...</code> button under the texture preview is used to load an image and encode it as the currently selected texture without adding a new texture. The texture's pixel and data formats will be changed depending on the imported image data.


{{SAToolsNavbox}}
The <code>Import Image...</code> button under the texture preview is used to replace the contents of the currently selected texture without adding a new texture. The texture's pixel and data formats will not be changed.
 
The <code>Export Image...</code> button is to save the selected texture as a PNG file.
 
The <code>Save Texture...</code> button is for saving individual textures in their original format (PVR, GVR, DDS etc.).
 
You can also export all textures at once in the specified format using the <code>Export All Textures As</code> menu item in the <code>File</code> menu.
 
===== Texture Packs =====
You can also import and export texture archives as folder texture packs using the <code>File</code> menu. Folder texture packs can be loaded by the [[SADX Mod Loader]] if they are placed in the mod's <code>textures</code> folder. Texture packs can contain PNG or DDS textures.
 
==== The Edit Menu ====
The program's Edit menu contains various settings used in texture management and conversion.
 
* <code>High Quality GVMs</code> controls whether GVR textures can be encoded in the ARGB8888 format. This format is only supported in the Gamecube version of SA2B.
* <code>SADX/SA2 Compatible GVPs</code> controls whether Texture Editor will use ARGB1555 instead of Intensity8A8 and ARGB4444 instead of RGB5A3 for Gamecube palettes. This option must be enabled when working with SADX and SA2 Gamecube paletted textures, and disabled when working with paletted textures from other Gamecube games, such as PSO and Billy Hatcher.
* <code>Texture Conversion Settings/Prefer High Quality</code> makes the program try to avoid quality loss when converting between texture formats. For example, if a texture is ARGB4444 but the target texture file format doesn't allow ARGB4444, it will be converted to a higher quality format such as ARGB8888.
* <code>Texture Conversion Settings/Allow Compressed Formats</code> makes the program consider compressed texture formats (such as DXT or VQ) when converting between texture formats.
* <code>DDS/PNG Settings</code> control whether newly imported textures in PVMX, PAK or folder texture packs should be in the DDS or PNG format. See Texture File Formats for more information.
 
==== The Tools menu ====
The program's Tools menu has various tools to automate some common tasks.
 
* <code>Generate New GBIX</code> randomizes Global Indices for all textures.
* The <code>Mipmaps</code> menu let you add or remove mipmaps to all textures at once, or export a texture's mipmaps as PNG files.
* The <code>PAK Alpha Flags</code> menu let you add or remove the "No Alpha Test" flag to all PAK textures at once.
 
==== '''Working with Paletted (Indexed) Textures''' ====
Paletted (Indexed) textures are textures whose pixel data is represented by color indices rather than actual colors. The color indices are used to pick colors from a preset list of colors (palette) that can be built into the texture itself or loaded from an external file (PVP files for PVR textures, GVP files for GVR textures). In the Sonic Adventure games, the only case where paletted textures are used is the archive named <code>AL_BODY</code>, which stores Chao body textures.
 
There are two main formats of Indexed textures supported in Dreamcast and Gamecube games:
 
* Index4 is a 4-bit format (2 pixels per byte) that can have up to 16 unique colors in the texture.
* Index8 is an 8-bit format (1 pixel per byte) that can have up to 256 unique colors in the texture.
 
The Sonic Adventure games only support Index4 textures natively, although you might be able to load Index8 textures in the future with the Mod Loader. Other games, such as Skies of Arcadia, PSO or Billy Hatcher, make use of both Index4 and Index8 textures.
 
When you select an Indexed texture in Texture Editor, an additional set of controls will appear under the texture preview.
[[File:Texture Editor 1768156900673.png|left|thumb|Palette information and preview]]
On the bottom left there will be a palette preview that will display a grid containing all colors in the palette. You can click inside the preview to display information about a specific color.
 
On the bottom right there will be palette information: its color format, the number of colors and whether the palette is embedded into the texture (internal) or loaded from a file (external).
 
If no palette is currently loaded, a default palette will be created. The default palette consists of a simple gradient whose brightness corresponds to the color indices.
 
You can use the buttons to import and export a palette as a PVP/GVP/PNG file, or unload a palette and replace it with the default one.
 
Palettes can contain multiple color banks. For example, palettes for Chao textures have 48 colors (three 16-color banks), and the game selects the bank depending on the texture. The <code>Palette Bank</code> combo box lets you select the current palette bank to apply to the texture.
 
===== Palette Start Bank and Start Color =====
In the original Dreamcast [[Katana SDK|Ninja]] implementation, palettes can have a starting bank and a start (offset) color. When a starting bank value is defined, the palette's initial bank ID is set to that value instead of 0. When an offset color ID is specified, the colors in the palette start from that ID. For example, the first color in the bank would be 49 rather than 0 if the offset color value is 49.
 
Although documented in the official SDKs, Palette Start Bank and Start Color are not used in the Sonic Adventure games, and their usage in other games remains to be confirmed. In Texture Editor, changing these fields only edits them in the palette file, and their actual usage is ignored.
 
===== Importing and Exporting Indexed Images =====
You can export an Index4 PVR or GVR texture as a 16-color (4-bit) PNG, and an Index8 PVR or GVR texture as a 256-color (8-bit) PNG using the <code>Export Image...</code> button below the texture preview image. The exported PNG's internal palette will match the PVR or GVR Indexed texture's currently loaded palette.
 
To import a 16-color or 256-color PNG as an Indexed texture, use the <code>Import Image...</code> button under the texture preview image. Doing so will cause the following dialog to appear:
[[File:Texture Editor 1768161302990.png|left|thumb|Indexed Image Import Options dialog]]
In the <code>Indexed Image Import Options</code> dialog you can specify the target Indexed texture format and the palette format. For GVR textures, there is also an option to embed the palette into the texture. Pressing the <code>Auto</code> button will analyze the image to be imported, and find the closest matching palette formats.
 
Note that some palette formats are only available for PVR, and some only for GVR. For example, <code>Intensity8A8</code> and <code>RGB5A3</code> can only be used in GVP palettes and GVR textures. <code>ARGB1555</code> and <code>ARGB4444</code> can be used in both PVR and GVR textures, but GVRs with such palettes will only work in Sonic Adventure games. <code>RGB5A3</code> and <code>Intensity8A8</code> cannot be used in Sonic Adventure games.
 
For palettes that aren't embedded into the texture, be sure to save them as PVP or GVP files after conversion has completed.
 
If you select <code>Non-indexed</code> as the target texture format, all palette information will be discarded, and the texture will be imported as if it was a regular non-indexed texture.
 
== Information for Reference ==
 
=== Texture Archive Formats ===
To be continued...
 
=== Texture File Formats ===
To be continued...
 
=== Texture Data Formats ===
To be continued...
 
==== PVR Data Formats ====
To be continued...
 
=== Texture Pixel Formats ===
To be continued...
 
=== Palette Pixel Formats ===
To be continued...{{SAToolsNavbox}}

Revision as of 19:56, 11 January 2026

Texture Editor is a tool that can view and edit texture archives used in Sonic Adventure games. It can also be used to view individual texture files.

Supported Formats

Archives: PVM, GVM, XVM, PRS (texture archives only), PAK, PVMX, PB

Textures: PVR, GVR, XVR, DDS, PNG/BMP/JPG/GIF

Using Texture Editor

Texture Editor user interface

Opening Files

For ease of use, you can associate the supported file extensions with the program, which will make it open files on double click. Alternatively you can open texture files in SA Tools Hub, which will launch Texture Editor and make it open the selected file.

If you open an individual PVR, GVR or XVR file, the program will try to load all other textures in the same folder and display them as a list (as if they were all added to an archive).

Editing Texture Archives

Use the list box on the left to navigate the texture list. The buttons at the bottom left are used to add, remove and sort textures in the archive. The panel on the right contains editable parameters applicable to the current texture format and a preview image.

Texture Parameters

Index is the texture ID on the list. It indicates the order in which textures appear in the archive. You can change the index by sorting textures using the "Up" and "Down" buttons at the bottom of the texture list.

Name is a texture's individual name. Texture names are only stored in the archive and ignored in the games.

Global Index is a unique texture ID used in the games' texture caching system. The game checks the global index when it loads a new texture, and if a texture with the same global index is already loaded, the new texture is discarded and the previously loaded texture is reused.

The Mipmap checkbox controls a flag that indicates that the texture includes smaller copies of itself to be displayed from a distance. This makes distant textures look smoother. Usually mipmaps should be enabled for level textures and disabled for UI textures. Depending on the texture format, Texture Editor can generate or remove the texture's built-in mipmaps when this flag is toggled. Note that PVR and GVR textures must be square to make it possible to add mipmaps to them.

The No Alpha Test checkbox controls a flag used by textures in SA2's PAK archives. This flag disables Alpha Test and Z Write, which can make transparent textures blend better or worse depending on how the model using the texture is rendered.

Size is used to view texture width and height. For textures in PVMX archives, you can override texture dimensions. This is commonly used to store the original dimensions of a non-HD UI texture when making an HD version of it to avoid stretching issues ingame. Actual Size will display the texture's current (HD) dimensions.

Data Format is the way the texture is represented in binary. It depends on the texture format, whether the texture is square or rectangular, and whether it is compressed or not. See Data Formats for more information.

Pixel Format is the way and order in which the colors are stored the texture's binary data. Available pixel formats depend on the texture format. See Pixel Formats for more information.

Surface Flags (SA2 PC only) are additional flags picked up by the game's renderer.

Texture Preview

Use the Zoom slider to adjust the size of the preview, and the Mipmap slider to select the mipmap level if applicable.

You can also enable or disable bicubic filtering for the texture preview in the program's View menu. Note: The filtering is only applied to the preview, not the texture itself.

You can click the texture preview to copy it to the clipboard, or drag it outside the window to export it as a PNG file.

Import and Export

The Import Texture... button under the texture preview is used to load an image and encode it as the currently selected texture without adding a new texture. The texture's pixel and data formats will be changed depending on the imported image data.

The Import Image... button under the texture preview is used to replace the contents of the currently selected texture without adding a new texture. The texture's pixel and data formats will not be changed.

The Export Image... button is to save the selected texture as a PNG file.

The Save Texture... button is for saving individual textures in their original format (PVR, GVR, DDS etc.).

You can also export all textures at once in the specified format using the Export All Textures As menu item in the File menu.

Texture Packs

You can also import and export texture archives as folder texture packs using the File menu. Folder texture packs can be loaded by the SADX Mod Loader if they are placed in the mod's textures folder. Texture packs can contain PNG or DDS textures.

The Edit Menu

The program's Edit menu contains various settings used in texture management and conversion.

  • High Quality GVMs controls whether GVR textures can be encoded in the ARGB8888 format. This format is only supported in the Gamecube version of SA2B.
  • SADX/SA2 Compatible GVPs controls whether Texture Editor will use ARGB1555 instead of Intensity8A8 and ARGB4444 instead of RGB5A3 for Gamecube palettes. This option must be enabled when working with SADX and SA2 Gamecube paletted textures, and disabled when working with paletted textures from other Gamecube games, such as PSO and Billy Hatcher.
  • Texture Conversion Settings/Prefer High Quality makes the program try to avoid quality loss when converting between texture formats. For example, if a texture is ARGB4444 but the target texture file format doesn't allow ARGB4444, it will be converted to a higher quality format such as ARGB8888.
  • Texture Conversion Settings/Allow Compressed Formats makes the program consider compressed texture formats (such as DXT or VQ) when converting between texture formats.
  • DDS/PNG Settings control whether newly imported textures in PVMX, PAK or folder texture packs should be in the DDS or PNG format. See Texture File Formats for more information.

The Tools menu

The program's Tools menu has various tools to automate some common tasks.

  • Generate New GBIX randomizes Global Indices for all textures.
  • The Mipmaps menu let you add or remove mipmaps to all textures at once, or export a texture's mipmaps as PNG files.
  • The PAK Alpha Flags menu let you add or remove the "No Alpha Test" flag to all PAK textures at once.

Working with Paletted (Indexed) Textures

Paletted (Indexed) textures are textures whose pixel data is represented by color indices rather than actual colors. The color indices are used to pick colors from a preset list of colors (palette) that can be built into the texture itself or loaded from an external file (PVP files for PVR textures, GVP files for GVR textures). In the Sonic Adventure games, the only case where paletted textures are used is the archive named AL_BODY, which stores Chao body textures.

There are two main formats of Indexed textures supported in Dreamcast and Gamecube games:

  • Index4 is a 4-bit format (2 pixels per byte) that can have up to 16 unique colors in the texture.
  • Index8 is an 8-bit format (1 pixel per byte) that can have up to 256 unique colors in the texture.

The Sonic Adventure games only support Index4 textures natively, although you might be able to load Index8 textures in the future with the Mod Loader. Other games, such as Skies of Arcadia, PSO or Billy Hatcher, make use of both Index4 and Index8 textures.

When you select an Indexed texture in Texture Editor, an additional set of controls will appear under the texture preview.

Palette information and preview

On the bottom left there will be a palette preview that will display a grid containing all colors in the palette. You can click inside the preview to display information about a specific color.

On the bottom right there will be palette information: its color format, the number of colors and whether the palette is embedded into the texture (internal) or loaded from a file (external).

If no palette is currently loaded, a default palette will be created. The default palette consists of a simple gradient whose brightness corresponds to the color indices.

You can use the buttons to import and export a palette as a PVP/GVP/PNG file, or unload a palette and replace it with the default one.

Palettes can contain multiple color banks. For example, palettes for Chao textures have 48 colors (three 16-color banks), and the game selects the bank depending on the texture. The Palette Bank combo box lets you select the current palette bank to apply to the texture.

Palette Start Bank and Start Color

In the original Dreamcast Ninja implementation, palettes can have a starting bank and a start (offset) color. When a starting bank value is defined, the palette's initial bank ID is set to that value instead of 0. When an offset color ID is specified, the colors in the palette start from that ID. For example, the first color in the bank would be 49 rather than 0 if the offset color value is 49.

Although documented in the official SDKs, Palette Start Bank and Start Color are not used in the Sonic Adventure games, and their usage in other games remains to be confirmed. In Texture Editor, changing these fields only edits them in the palette file, and their actual usage is ignored.

Importing and Exporting Indexed Images

You can export an Index4 PVR or GVR texture as a 16-color (4-bit) PNG, and an Index8 PVR or GVR texture as a 256-color (8-bit) PNG using the Export Image... button below the texture preview image. The exported PNG's internal palette will match the PVR or GVR Indexed texture's currently loaded palette.

To import a 16-color or 256-color PNG as an Indexed texture, use the Import Image... button under the texture preview image. Doing so will cause the following dialog to appear:

Indexed Image Import Options dialog

In the Indexed Image Import Options dialog you can specify the target Indexed texture format and the palette format. For GVR textures, there is also an option to embed the palette into the texture. Pressing the Auto button will analyze the image to be imported, and find the closest matching palette formats.

Note that some palette formats are only available for PVR, and some only for GVR. For example, Intensity8A8 and RGB5A3 can only be used in GVP palettes and GVR textures. ARGB1555 and ARGB4444 can be used in both PVR and GVR textures, but GVRs with such palettes will only work in Sonic Adventure games. RGB5A3 and Intensity8A8 cannot be used in Sonic Adventure games.

For palettes that aren't embedded into the texture, be sure to save them as PVP or GVP files after conversion has completed.

If you select Non-indexed as the target texture format, all palette information will be discarded, and the texture will be imported as if it was a regular non-indexed texture.

Information for Reference

Texture Archive Formats

To be continued...

Texture File Formats

To be continued...

Texture Data Formats

To be continued...

PVR Data Formats

To be continued...

Texture Pixel Formats

To be continued...

Palette Pixel Formats

To be continued...

SA Tools Information
General Tools SALVLSAMDLSAFontEditTexture EditorData ToolboxSA Tools Hub
Sonic Adventure (DX) Tools SADXTweaker2SADXSndSharpSASavePL ToolVMS Editor
Sonic Adventure 2 (Battle) Tools SA2 Event ViewerSA2 Cutscene Text EditorSA2 Message File EditorSA2 Stage Select EditorSA2 Cutscene Effect EditorSA2 Light/Fog Editor
Other Command Line ToolsWorking with Binary Files