User:SirYodaJedi/Image formats: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with "{| class="wikitable" |- ! ! colspan=4 | Supported in !! !! |- ! Format !! {{gldsrc|4}} !! {{src|4}} !! {{p2ce|4}} !! {{source2|4}} !! Compressed? !! Recommended usage |- | ''...")
 
mNo edit summary
 
(35 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{for|a Russian translation primarily by [[user:NOUG4AT|NOUG4AT]]|[[User:SirYodaJedi/Image formats/ru]]}}
{{essay}}
The following is a list of standard image formats, along with which engines support them, whether they are compressed, and when [[User:SirYodaJedi|I]] recommend using them.
{{modernImportant|These are subjective recomendations; do not move the page out of userspace! Instead, consider copying the objective segments to a new page.}}
{{warning|I have not personally tested the any formats in {{strata}} or {{Source2}}, as I don't have either available to test. I also have not tested IA88, A8, or BGRA16F. The information stated on this page regarding those is based upon conceptual knowledge of the formats and preexisting documentation regarding strata's VTF v7.6 and Source 2's VTEX formats.}}
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 4: Line 9:
! colspan=4 | Supported in !! !!  
! colspan=4 | Supported in !! !!  
|-
|-
! Format !! {{gldsrc|4}} !! {{src|4}} !! {{p2ce|4}} !! {{source2|4}} !! Compressed? !! Recommended usage
! Format !! {{gldsrc}}<br>{{gldsrc|3}} !! {{src}}<br>{{src|3}} |!! {{strata}}<br>{{strata|3|nt=0}} !! {{source2}}<br>{{source2|3}} !! Compressed? !! Recommended usage
|-
|-
| '''P8''' (256-color)
| '''P8''' (256-color)
Line 15: Line 20:
|-
|-
| '''BGR888''', '''RGB888''' (24-bit true color)
| '''BGR888''', '''RGB888''' (24-bit true color)
| Limited; only for skyboxes, detail textures, main menu backgrounds, and VGUI2 elements
| Limited; only for skyboxes, detail textures, main menu backgrounds, and VGUI elements
| Yes
| Yes
| Yes
| Yes
| Yes
| Yes
| No (except in {{gldsrc}}, see notes)
| No (except in {{gldsrc}}, see notes)
| {{gldsrc}}: Skyboxes, detail textures, main menu backgrounds, and VGUI2 elements
| {{gldsrc}}: Skyboxes, detail textures, main menu backgrounds, and VGUI elements
{{src}}, {{p2ce}}, and {{source2}}: Not recommended
{{src}}: Skyboxes, low-res normal maps without an alpha channel, and colored textures wherein a significant portion is dark grey.<br>
{{strata}} and {{source2}}: Not recommended; use BC7 instead
|-
|-
| '''BGRA8888''', '''RGBA8888''' (32-bit true color with translucency)
| '''BGRA8888''', '''RGBA8888''' (32-bit true color with translucency)
| No
| Limited; only for VGUI elements
| Yes
| Yes
| Yes
| Yes
Line 30: Line 36:
| No
| No
| {{src}}: Densely detailed textures with alpha channels
| {{src}}: Densely detailed textures with alpha channels
{{src}} + {{p2ce}}: Densely detailed low-res normal maps with specular mask via alpha channel ([[$normalmapalphaenvmapmask]]).<br>
{{src}}: Densely detailed low-res normal maps with specular mask via alpha channel ([[$normalmapalphaenvmapmask]]).<br>
{{source2}}: Not recommended; use BC7 instead
{{strata}} + {{source2}}: Not recommended; use BC7 instead
|-
|-
| '''BGRA8888''', '''RGBA8888''' (Source 1 Compressed HDR)
| '''BGRA8888''', '''RGBA8888''' (Source 1 Compressed HDR, aka "RGBM"; [[sky (shader)|sky shaders only]])
| No
| No
| Yes
| Yes
| Yes
| Yes
| No (use BC6H)
| Yes
| Yes (see [[Valve_Texture_Format#HDR_compression]])
| Yes; alpha channel used as a multiplicand rather than for translucency (see [[Valve Texture Format#HDR compression]])<br>Can also be combined used with DXT5, but doing so is not recommended.
| {{src}}: HDR skyboxes
| {{src}}: HDR skyboxes
{{p2ce}}: Not recommended; use BC6H instead
{{strata}} and {{src2}}: Not recommended; use BC6H instead
|-
| '''BGRA16161616F''', '''RGBA16161616F''' (16 bpc Floating Point HDR with translucency)
| No
| Yes
| Yes
| Yes
| No
| {{src}}, {{strata}}, {{source2}}: HDR textures with an alpha channel
|-
|-
| '''BGR565''' (16-bit color)
| '''BGR565''' (16-bit color)
Line 49: Line 63:
| No
| No
| {{src}}: Low-res normal maps without specular mask;
| {{src}}: Low-res normal maps without specular mask;
{{src}}: Densely detailed textures without alpha channels<br>
{{src}}: Densely detailed low-res textures without alpha channels<br>
{{p2ce}}: Not recommended; use BC7 instead
{{strata}}: Not recommended; use BC7 instead
|-
|-
| '''BGRA4444''' (16-bit color with translucency)
| '''BGRA4444''' (16-bit color with translucency)
Line 58: Line 72:
| No (use BC7)
| No (use BC7)
| No
| No
| {{src}}: Moderately detailed low-res normal maps with specular mask via alpha channel ([[$normalmapalphaenvmapmask]]).<br>
| {{src}}: Not recommended; causes noticable color shift rendering it unable to convincingly portray a flat normal map.<br>
{{p2ce}}: Not recommended; use BC7 instead
{{strata}}: Not recommended; use BC7 instead.
|-
|-
| '''I8''' (8-bit greyscale with translucency)
| '''I8''' (8-bit greyscale)
| No
| Technically (using P8)
| Yes
| Yes
| Yes
| Yes
| Yes
| Yes
| No
| No
| {{src}}: [[$envmapmask|Specular masks]] for materials without a normal map.
| {{src}}: [[$envmapmask|Specular masks]] for materials without a normal map (avoids DXTn green tint; same file size as DTX5).
{{src}}: Decals using [[Decals#DecalModulate|DecalModulate]]<br>
{{src}}: Decals using [[Decals#DecalModulate|DecalModulate]] (avoids DXTn green tint)<br>
{{p2ce}}+{{source2}}: Not recommended; use ATI1N instead
{{strata}}+{{source2}}: Not recommended; use ATI1N instead
|-
|-
| '''IA88''' (8-bit greyscale with translucency)
| '''IA88''' (8-bit greyscale with translucency)
Line 78: Line 92:
| No
| No
| {{src}}: Greyscale decals with an alpha channel
| {{src}}: Greyscale decals with an alpha channel
{{p2ce}}+{{source2}}: Not recommended; use BC7 instead
{{strata}}+{{source2}}: Not recommended; use BC7 instead
|-
| '''A8''' (Translucency only)
| Technically, only for sprites (using IndexAlpha) and decals
| Yes
| Yes
| Yes
| No
| {{src}}, {{strata}}, & {{source2}}: Single-color textures with an alpha channel (use [[$color|material coloring]] to assign non-white colors)
|-
|-
| '''DXT1''' (AKA BC1)
| '''DXT1''' (AKA BC1)
| No (except in {{csXbox|4}})
| {{csXbox|only}}
| Yes
| Yes
| Yes
| Yes
| Yes
| Yes
| Yes; two explicit BGR565 colors and two interpolated colors per 4x4 block
| Yes; two explicit BGR565 colors and two interpolated colors per 4x4 block
| {{src}}, {{p2ce}}, & {{source2}}: Moderately detailed high-res textures with no alpha channel
| {{src}}, {{strata}}, & {{source2}}: Moderately detailed high-res textures with no alpha channel
|-
|-
| '''DXT3''' (AKA BC2)
| '''DXT3''' (AKA BC2)
Line 92: Line 114:
| Yes
| Yes
| Yes
| Yes
| No
| No (use DXT5)
| RGB only; RGB handled like DXT1, with uncompressed 4-bit alpha
| RGB only; RGB handled like DXT1, with uncompressed 4-bit alpha
| {{src}}, {{p2ce}}: Not recommended, use DXT5 instead
| {{src}}, {{strata}}: Not recommended, use DXT5 instead
|-
|-
| '''DXT5''' (AKA BC3)
| '''DXT5''' (AKA BC3)
Line 102: Line 124:
| Yes
| Yes
| Yes; RGB handled like DXT1, with alpha handled like ATI1N
| Yes; RGB handled like DXT1, with alpha handled like ATI1N
| {{src}}, {{p2ce}}, & {{source2}}: Moderately detailed high-res textures with an alpha channel
| {{src}}, {{strata}}, & {{source2}}: Moderately detailed high-res textures with an alpha channel
|-
|-
| '''ATI1N''' (AKA BC4)
| '''ATI1N''' (AKA BC4)
| No
| No
| No
| No (use I8)
| Yes
| Yes
| Yes
| Yes
| Yes; four explicit I8 values and four interpolated values per 4x4 block
| Yes; four explicit I8 values and four interpolated values per 4x4 block
| {{p2ce}}: [[$envmapmask|Specular masks]] for materials without a normal map.
| {{strata}}: [[$envmapmask|Specular masks]] for materials without a normal map.
{{source2}}: All [[$envmapmask|Specular masks]]
{{source2}}: All [[$envmapmask|Specular masks]]
|-
|-
| '''ATI2N''' (AKA BC5)
| '''ATI2N''' (AKA BC5)
| No
| No
| No
| No (use BGR565 if really necessary)
| Yes
| Yes
| Yes
| Yes
| Yes; two independent ATI1N-style channels (red and green)
| Yes; two independent ATI1N-style channels (red and green)
| {{p2ce}}: [[$blendmodulatetexture]], perhaps
| {{strata}}: [[$blendmodulatetexture]], perhaps
{{source2}}: ???
{{source2}}: ???
|-
|-
| '''BC6H''' (AKA BC6)
| '''BC6H''' (AKA BC6)
| No
| No
| No
| No (use compressed BGRA8888)
| Yes
| Yes
| Yes
| Yes
| Yes; four explicit RGB161616 or RGB16f16f16f colors and four interpolated colors per 4x4 block
| Yes; four explicit RGB161616 or RGB161616F colors and four interpolated colors per 4x4 block
| {{p2ce}} & {{source2}}: HDR skyboxes
| {{strata}} & {{source2}}: HDR skyboxes
|-
|-
| '''BC7''' (AKA BC6)
| '''BC7'''
| No
| No
| No
| No (use BGR565 or BGRA8888)
| Yes
| Yes
| Yes
| Yes
| Yes; four explicit RGB888 or RGBA8888 colors and four interpolated colors per 4x4 block
| Yes; four explicit RGB888 or RGBA8888 colors and four interpolated colors per 4x4 block
| {{p2ce}} & {{source2}}: Whenever DXT1 or DXT5 is too blocky and/or [[Fixing DXT Green Tint Compression|DXT green tint]] needs to be avoided.
| {{strata}} & {{source2}}: Whenever DXT1 or DXT5 is too blocky and/or [[Fixing DXT Green Tint Compression|DXT green tint]] needs to be avoided.
|-
|-
|}
|}


{{note|The Steam versions of {{gldsrc}} support RLE-compressed TGA files for certain use cases, such as skyboxes and detail textures. Other use cases, such as taskbar icons, do '''''not''''' support RLE compression.<br/>Not all programs can export compressed TGAs; GIMP does this when exporting to TGA by default. Make sure that the origin is set to "bottom-left".}}
{{note|The Steam versions of {{gldsrc}} support RLE-compressed [[TGA]] files for certain use cases, such as skyboxes and detail textures. Other use cases, such as taskbar icons or transparent VGUI sprites, do '''''not''''' support RLE compression.<br/>Not all programs can export compressed TGAs; [[GIMP]] does this when exporting to TGA by default. Make sure that the origin is set to "bottom-left".}}
{{note|All formats supported by {{p2ce}} can be compressed with PNG-style deflate compression, using its custom v7.6 [[VTF]] format. This is used in conjunction with whatever inherent GPU-supported compression format is being used; as such, it is not mentioned in this table.}}
{{note|All formats supported by {{strata}} can be compressed with [[PNG|PNG-style]] deflate compression, using its custom v7.6 [[VTF]] format. This is used in conjunction with whatever inherent GPU-supported compression format is being used; as such, it is not mentioned in this table.}}
{{note|Although the [[VTF]] format used by {{src}} supports encoding color channels in multiple orders (RGB, BGR, RGBA, BGRA, ARGB, ABGR), only BGR and BGRA are guaranteed to work correctly. By comparison, {{source2}} prefers RGB and RGBA, using its [[VTEX (Source 2)|VTEX]] format.
{{note|Additionally, formats with a 1-bit alpha channel, such as BGRA5551 or BGR888_BLUESCREEN are not as reliable as those with a 4-bit or 8-bit alpha channel, and will often treat the entire image as opaque, with the transparent pixels appearing as black.<br>
Formats with 1-bit alpha should be avoided anyway (except in {{gldsrc}}), even when using [[$alphatest]], as it will result in inaccurate transparency on mipmaps.}}
}}
{{note|{{src}}, {{strata}}, and {{source2}} all support non-floating point [[HDR]] textures, however floating point is preferred, as it allows for better precision over the texture's brightness. [[Vtex (Source 1)|VTEX]] defaults to floating point when using {{code|nocompress}} with {{code|pfm}} (see [[HDR Skybox Creation#Creating the Materials]]).}}

Latest revision as of 15:17, 22 September 2024

For a Russian translation primarily by NOUG4AT, see User:SirYodaJedi/Image formats/ru.
Icon-essay.png
This is an essay.
It contains the advice or opinions of one or more of the Valve Developer Community's contributors.
This page is not an encyclopedia article, nor is it one of the Valve Developer Community's policies or guidelines, as it has not been thoroughly vetted by the community.
Some essays represent widespread norms; others only represent minority viewpoints.

The following is a list of standard image formats, along with which engines support them, whether they are compressed, and when I recommend using them.

Icon-Important.pngImportant:These are subjective recomendations; do not move the page out of userspace! Instead, consider copying the objective segments to a new page.
Warning.pngWarning:I have not personally tested the any formats in Strata Source or Source 2, as I don't have either available to test. I also have not tested IA88, A8, or BGRA16F. The information stated on this page regarding those is based upon conceptual knowledge of the formats and preexisting documentation regarding strata's VTF v7.6 and Source 2's VTEX formats.
Supported in
Format GoldSrc
GoldSrc
Source
Source
Strata Source
Strata
Source 2
Source 2
Compressed? Recommended usage
P8 (256-color) Yes, except for main menu backgrounds and detail textures No (use BGR565 or BGRA8888) No (use BC7) No (use BC7) Yes, 1 palette for entire image with 256 colors GoldSrc: Most textures (world, models, sprites, overviews, etc.)
BGR888, RGB888 (24-bit true color) Limited; only for skyboxes, detail textures, main menu backgrounds, and VGUI elements Yes Yes Yes No (except in GoldSrc, see notes) GoldSrc: Skyboxes, detail textures, main menu backgrounds, and VGUI elements

Source: Skyboxes, low-res normal maps without an alpha channel, and colored textures wherein a significant portion is dark grey.
Strata Source and Source 2: Not recommended; use BC7 instead

BGRA8888, RGBA8888 (32-bit true color with translucency) Limited; only for VGUI elements Yes Yes Yes No Source: Densely detailed textures with alpha channels

Source: Densely detailed low-res normal maps with specular mask via alpha channel ($normalmapalphaenvmapmask).
Strata Source + Source 2: Not recommended; use BC7 instead

BGRA8888, RGBA8888 (Source 1 Compressed HDR, aka "RGBM"; sky shaders only) No Yes Yes Yes Yes; alpha channel used as a multiplicand rather than for translucency (see Valve Texture Format#HDR compression)
Can also be combined used with DXT5, but doing so is not recommended.
Source: HDR skyboxes

Strata Source and Source 2: Not recommended; use BC6H instead

BGRA16161616F, RGBA16161616F (16 bpc Floating Point HDR with translucency) No Yes Yes Yes No Source, Strata Source, Source 2: HDR textures with an alpha channel
BGR565 (16-bit color) No Yes Yes No (use BC7) No Source: Low-res normal maps without specular mask;

Source: Densely detailed low-res textures without alpha channels
Strata Source: Not recommended; use BC7 instead

BGRA4444 (16-bit color with translucency) No Yes Yes No (use BC7) No Source: Not recommended; causes noticable color shift rendering it unable to convincingly portray a flat normal map.

Strata Source: Not recommended; use BC7 instead.

I8 (8-bit greyscale) Technically (using P8) Yes Yes Yes No Source: Specular masks for materials without a normal map (avoids DXTn green tint; same file size as DTX5).

Source: Decals using DecalModulate (avoids DXTn green tint)
Strata Source+Source 2: Not recommended; use ATI1N instead

IA88 (8-bit greyscale with translucency) No Yes Yes Yes No Source: Greyscale decals with an alpha channel

Strata Source+Source 2: Not recommended; use BC7 instead

A8 (Translucency only) Technically, only for sprites (using IndexAlpha) and decals Yes Yes Yes No Source, Strata Source, & Source 2: Single-color textures with an alpha channel (use material coloring to assign non-white colors)
DXT1 (AKA BC1) (only in Counter-Strike (Xbox)) Yes Yes Yes Yes; two explicit BGR565 colors and two interpolated colors per 4x4 block Source, Strata Source, & Source 2: Moderately detailed high-res textures with no alpha channel
DXT3 (AKA BC2) No Yes Yes No (use DXT5) RGB only; RGB handled like DXT1, with uncompressed 4-bit alpha Source, Strata Source: Not recommended, use DXT5 instead
DXT5 (AKA BC3) No Yes Yes Yes Yes; RGB handled like DXT1, with alpha handled like ATI1N Source, Strata Source, & Source 2: Moderately detailed high-res textures with an alpha channel
ATI1N (AKA BC4) No No (use I8) Yes Yes Yes; four explicit I8 values and four interpolated values per 4x4 block Strata Source: Specular masks for materials without a normal map.

Source 2: All Specular masks

ATI2N (AKA BC5) No No (use BGR565 if really necessary) Yes Yes Yes; two independent ATI1N-style channels (red and green) Strata Source: $blendmodulatetexture, perhaps

Source 2: ???

BC6H (AKA BC6) No No (use compressed BGRA8888) Yes Yes Yes; four explicit RGB161616 or RGB161616F colors and four interpolated colors per 4x4 block Strata Source & Source 2: HDR skyboxes
BC7 No No (use BGR565 or BGRA8888) Yes Yes Yes; four explicit RGB888 or RGBA8888 colors and four interpolated colors per 4x4 block Strata Source & Source 2: Whenever DXT1 or DXT5 is too blocky and/or DXT green tint needs to be avoided.
Note.pngNote:The Steam versions of GoldSrc support RLE-compressed TGA files for certain use cases, such as skyboxes and detail textures. Other use cases, such as taskbar icons or transparent VGUI sprites, do not support RLE compression.
Not all programs can export compressed TGAs; GIMP does this when exporting to TGA by default. Make sure that the origin is set to "bottom-left".
Note.pngNote:All formats supported by Strata Source can be compressed with PNG-style deflate compression, using its custom v7.6 VTF format. This is used in conjunction with whatever inherent GPU-supported compression format is being used; as such, it is not mentioned in this table.
Note.pngNote:Although the VTF format used by Source supports encoding color channels in multiple orders (RGB, BGR, RGBA, BGRA, ARGB, ABGR), only BGR and BGRA are guaranteed to work correctly. By comparison, Source 2 prefers RGB and RGBA, using its VTEX format.
Note.pngNote:Additionally, formats with a 1-bit alpha channel, such as BGRA5551 or BGR888_BLUESCREEN are not as reliable as those with a 4-bit or 8-bit alpha channel, and will often treat the entire image as opaque, with the transparent pixels appearing as black.
Formats with 1-bit alpha should be avoided anyway (except in GoldSrc), even when using $alphatest, as it will result in inaccurate transparency on mipmaps.
Note.pngNote:Source, Strata Source, and Source 2 all support non-floating point HDR textures, however floating point is preferred, as it allows for better precision over the texture's brightness. VTEX defaults to floating point when using nocompress with pfm (see HDR Skybox Creation#Creating the Materials).