diff --git a/docs/zengin/textures/32bit_texture.md b/docs/zengin/textures/32bit_texture.md new file mode 100644 index 0000000000..e9e69759df --- /dev/null +++ b/docs/zengin/textures/32bit_texture.md @@ -0,0 +1,57 @@ +# 32 Bit texture support + +By default ZenGin supports only compresed `DXT1` and `DXT3` textures. [zSurface32 patch](https://worldofplayers.ru/threads/43009/page-3#post-1180504), created by Gratt improves texture quality by adding proper `RGBA8888`, `BGRA8888`, `ARGB8888` and `ABGR8888` format readout and DirectX 32 Bit surface support in ZenGin[^1]. + +To use the patch you must have [Union](../union/index.md) installed. Download the `.patch` file [here](https://worldofplayers.ru/attachments/114570/), and put it into `/system` directory. + +!!! Warning + It is advised to use `BGRA8888` due to performance reasons, as other colorspaces require additional conversion at runtime. + +## Compilation + +ZenGin doesn’t natively support the compilation of such textures. This can only be achieved using external programs. The simplest method to create a texture is by utilizing [zTEXiPy](https://gitlab.com/Shoun2137/ztexipy). + +1. Open your texture in zTEXiPy[^2]: +![zTEXiPy's splash dialog](../../assets/images/STEP_1.WEBP) +2. Choose `Save TEX as...` +3. In this window: +![zTEXiPy's saving dialog](../../assets/images/STEP_3.WEBP) + - Uncheck `Generate Mipmaps` if your texture is meant to be used as UI. + - Set the `Colorspace` to `BGRA8888 (zEnum:3)` or other supported format. +4. Press `Save` and check your texture in-game: +![Ingame Example](../../assets/images/EXAMPLE_INGAME.WEBP) + +## But why? + +This type of texture is compatible with any asset, whether it’s armour or a sword. However, the primary application for such high-quality textures is in user interface elements, which make extensive use of gradients and the alpha channel: + +=== "BGRA8888 vs DXT3" + + ![Comparison between BGRA8888 vs DXT3 (Alpha)](../../assets/images/EXAMPLE_1.WEBP) + + This example shows comparison between raw BGRA8888 colorspace and DXT3 (BC2)[^3] compression. + DXT3 shows noticible banding throughout entire texture wherever there's alpha channel, while BGRA8888 has smooth gradient transition. + +=== "BGRA8888 vs DXT1" + + ![Comparison between BGRA8888 vs DXT1](../../assets/images/EXAMPLE_2.WEBP) + + This example shows comparison between raw BGRA8888 colorspace and DXT1 (BC1)[^3] compression. + DXT1 shows lossy quantization artifacts, while BGRA8888 has none. + +[Source comparison files are available here.](../../assets/EXAMPLE_SOURCE.7z) + +The drawback of using these textures is their large size, as they contain uncompressed color data. However, this is a small price to pay for the improved quality of the final product. + +!!! Note + This article was originally written by [Shoun](https://gitlab.com/Shoun2137) and published on [G2O Docs](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/client-manual/32bit-texture-support/). + + +[^1]: + To learn more about [ZenGin Textures reference click here](https://zk.gothickit.dev/engine/formats/texture/). + +[^2]: + zTEXiPy supports TGA, DDS, PNG and WEBP by default, so make sure it's one of those formats. + +[^3]: + To learn more about [DXTn Algorithm click here](https://www.buckarooshangar.com/flightgear/tut_dds.html). diff --git a/docs/zengin/textures.md b/docs/zengin/textures/index.md similarity index 91% rename from docs/zengin/textures.md rename to docs/zengin/textures/index.md index ed276a5af3..b71da7f03e 100644 --- a/docs/zengin/textures.md +++ b/docs/zengin/textures/index.md @@ -17,7 +17,7 @@ Here are some tips for working with Gothic textures: When working with textures in ZenGin, it is recommended to use the default texture format if you are unsure about other options. Many of the other formats are either unsupported or buggy in gothic. For transparency, `DXT3` format should be used. For pure RGB colors, `DXT1` format is recommended. !!! Tip - Formats like `rgba8888`, `bgra8888`, `argb8888` and `abgr8888` are properly supported with the zSurface32 patch. It is advised to use `bgra8888` due to performance reasons, as other colorspaces require additional conversion at runtime. + Formats like `RGBA8888`, `BGRA8888`, `ARGB8888` and `ABGR8888` are properly supported with the zSurface32 patch. Learn more about it in the [32 Bit texture support](./32bit_texture.md) article. By default, `.tga` files with a proper resolution are converted to `.TEX` files by the engine, when they appear in the game or a game is started with `-convertall` parameter. Also, you can convert textures to `.TEX` manually using one of the [available tools](#tools). diff --git a/overrides/assets/EXAMPLE_SOURCE.7z b/overrides/assets/EXAMPLE_SOURCE.7z new file mode 100644 index 0000000000..e226ae6b8c Binary files /dev/null and b/overrides/assets/EXAMPLE_SOURCE.7z differ diff --git a/overrides/assets/images/EXAMPLE_1.WEBP b/overrides/assets/images/EXAMPLE_1.WEBP new file mode 100644 index 0000000000..451508856e Binary files /dev/null and b/overrides/assets/images/EXAMPLE_1.WEBP differ diff --git a/overrides/assets/images/EXAMPLE_2.WEBP b/overrides/assets/images/EXAMPLE_2.WEBP new file mode 100644 index 0000000000..5bce43b0bf Binary files /dev/null and b/overrides/assets/images/EXAMPLE_2.WEBP differ diff --git a/overrides/assets/images/EXAMPLE_INGAME.WEBP b/overrides/assets/images/EXAMPLE_INGAME.WEBP new file mode 100644 index 0000000000..c0fbd1973d Binary files /dev/null and b/overrides/assets/images/EXAMPLE_INGAME.WEBP differ diff --git a/overrides/assets/images/STEP_1.WEBP b/overrides/assets/images/STEP_1.WEBP new file mode 100644 index 0000000000..7db8f46d18 Binary files /dev/null and b/overrides/assets/images/STEP_1.WEBP differ diff --git a/overrides/assets/images/STEP_3.WEBP b/overrides/assets/images/STEP_3.WEBP new file mode 100644 index 0000000000..c8379c8a72 Binary files /dev/null and b/overrides/assets/images/STEP_3.WEBP differ