Formats/Image

From Unvanquished
Jump to: navigation, search

The terms lossy and lossless are used multiple times in this page. Lossy means that images compressed using that format will lose some of their image quality to save space. Lossless means that the compression will not sacrifice image quality, no matter how much you compress the image with that format.

See also Material, Particle and Trail.

Tools

See Tools/Image.

Licensing

The following licenses are suitable for images:

Information 48x48.png

Note

The following licenses are suitable for media files (images, models, sound files…):

The default contribution license is CC BY-SA 4.0, unless you specify another license, by contributing to Unvanquished you are placing your work under CC BY-SA 4.0 license. You must have right to.

Older licenses like CC BY-SA 3.0, CC BY-SA 2.5, and CC BY-SA 3.0, CC BY-SA 2.5 are fairly acceptable for importing existing media. Many of our older media use such licenses, but please not use those older licenses for brand new content when you have full power to use latest version of those licenses. If you can get permission from original author to get a newer or more permissive license, please get it. For Creative Commons licenses older than 3.0, please ask us before merging.

See the page Licenses/Media for details.

Supported formats

The engine supports the following formats:

  • CRN — A compressed lossy texture format similar to DDS (see below) but more efficient.
    ✅️ Recommended to store lossy assets (except skyboxes for some technical reasons).
  • WebP — A relatively new format created by Google that provides excellent lossy compression (generally 39% smaller filesize than an equivalent JPEG) and lossless compression (better than PNG).
    ✅️ Recommended as lossless variant to store lossless assets (lightmaps, deluxemaps).
    ✅️ Recommended as lossy variant to store skyboxes.
  • DDS (DirectDraw Surface) — A container format by Microsoft to store S3TC compressed textures, which is natively supported by video cards without needing any prior decompression, ensuring short loading times.
    ➡️ Prefer CRN for Unvanquished.
  • KTX (Khronos Texture) — another GPU-compressed format.
    ➡️ Prefer CRN for Unvanquished.
  • PNG (Portable Network Graphics) — Provides lossless compression of images, but with the penalty of high filesize.
    ⚠️ Discouraged, ➡️ prefer lossless WebP instead.
  • TGA — Lossless format usually used uncompressed (some TGA format variant support compression but not all tools may support them). Usually found uncompressed in legacy Tremulous assets.
    ⚠️ Discouraged, ➡️ prefer lossless WebP instead.
  • JPEG — Provides lossy compression and very small filesizes, but image quality can suffer at higher compression values. Usually found in legacy Tremulous assets.
    ⚠️ Discouraged, ➡️ prefer CRN instead.

Recommended formats in repositories

Information 48x48.png

Note

Unvanquished project made the choice to use PNG as image format in repositories at a time WebP wasn't well supported, using PNG optimizers to get the smaller PNG file possible. If you're going to create a new project using the Dæmon engine, you may want to chose lossless WebP as image format in repositories, since there is now a wide support in image viewers, featureful image editors like GIMP, etc. and is a better format: compresses faster and produces smaller files for far less computing cost, without requiring optimizers. If you chose WebP as a default format for your repositories, read “convert to PNG” as “convert to lossless WebP” in next sentences.

It's recommended to store data files in well-known lossless formats in data repositories.

Convert TGA or lossless Webp to PNG to store them in repositories. It's better to compress to specific formats (CRN, WebP) while you distribute your work for use in game, but please keep them lossless and in widely-used formats in repositories!

If your original file is already in JPEG format or lossy WebP, store it as is without recompressing it to something else.

Because CRN, KTX or DDS may not be easy to edit, you may want to convert them back to lossless PNG anyway to make to make them easy to edit. You may otherwise prefer to just store them as is to prevent further lossy recompression. Official Unvanquished data repositories will not accept CRN, KTX or DDS files.

It is good to store GIMP's .xcf source in repositories. Because Git is not for big large heavy weighty files, please tick the compression option when saving from GIMP (if you don't have this option, your version of GIMP is old, please update!), then save as .xcf.xz to get even more compression (or compress the .xcf file with xz before committing).

Recommended formats

Those are recommended image formats to be used in source repositories and in game to be delivered to players, and related tools.

Purpose Kind Format Tool
Source Bitmap PNG GIMP
Source Vector SVG Inkscape
Purpose Kind Format Tool
Release Generic image CRN Crunch (with -noNormalDetection)
Release Normal map Normalized CRN Crunch (with -rtopmip option)
Release Skybox lossy WebP cwebp
Release Lightmap, deluxemap lossless WebP cwebp

Targeting the OpenGL3 renderer

Creating textures for use with the modern OpenGL3 renderer of the Dæmon engine is slightly different than texture creation for the renderer of the old Quake 3 engine you may know. This is not due to changes in formats or the like, but because of how additional rendering technologies change what information is to be encoded in which textures. Each successive rendering technology removes further information from your base texture, until only albedo (diffuse) remains:

Technology Texture Base texture
Diffuse mapping
🚧️ TODO: Image.
🚧️ TODO: Image.
Height mapping
🚧️ TODO: Image.
🚧️ TODO: Image.
Normal mapping
🚧️ TODO: Image.
🚧️ TODO: Image.
Specular mapping
🚧️ TODO: Image.
🚧️ TODO: Image.
Physical mapping
🚧️ TODO: Image.
🚧️ TODO: Image.
Glow mapping
🚧️ TODO: Image.
🚧️ TODO: Image.

Note: specular maps and physical maps are mutually exclusives, they are different techniques to fit the same need. Physical maps are meant to be more realistic than specular ones.

Packing conventions

DaemonEngineTexturePacking.png

See this document: https://dl.unvanquished.net/docs/20210506-001.daemon-engine-texture-packing.pdf

Naming conventions

Technology File suffix Material keyword Material stage keyword Notes
Diffuse _d N/A diffuseMap Red, Green, Blue colors. Opacity in alpha channel (white is fully opaque).
Height _h N/A heightMap Greyscale, white is floor level, black is down.
Normal _n N/A normalMap Red means X, Green means -Y, Blue means Z (see below).
Normal with Height _nh N/A normalHeightMap Normal map in RGB channel, height map in alpha channel, ➡️ prefer doing separate files.
Specular _s N/A specularMap Black means no reflection, white means a lot of reflection.
Physical (Occlusion, Roughness, Metalness) _orm N/A physicalMap Occlusion in Red, Roughness in Green, Metalness in Blue, ⚠️ this is unused yet, there may be bugs.
Glow (Addition) _a N/A glowMap Red, Green, Blue, black means no addition.
Preview _p qer_editorImage N/A For usage in editor as preview, will also be used by map compiler to color bouncing lights.

Material creation

See Material.

Resources