What does redux mean in the game?

(*-*)浩
Release: 2019-05-14 14:32:44
Original
10135 people have browsed it

The game middleware I have encountered---Redux, about Redux:

Recommended courses: C# tutorial.

What does redux mean in the game?

Substance Redux is a texture processing software plus middleware specifically used for texture generation and compression. According to its user guide, it can optimize texture sets and improve the performance of existing compression algorithms by 50% or more. The compression method can be lossless compression or lossless compression. The compression ratio and image quality can be customized by the user during compression.

Redux can compress and package batch texture files. The operation process is to create a new Project project, import several texture files for the project, and set the compression parameters of each texture. Finally export the compressed file. Redux can compress image files in a variety of formats. If the length and width of the input image are not 2 to the N power, Redux will automatically stretch it to 2 to the N power. The Demo provided by ReduxSDK has the function of decompressing compressed files into DDS format.

The biggest selling point of Redux is its image generation function. It can use several simple graphics elements to generate complex images through algorithms. The graphics elements only need to occupy a small amount of disk space, and the generation method is also saved. It doesn’t take much disk space. According to their official statement, the biggest part of the game that takes up disk space is the texture. Using Redux can reduce the disk space occupied by the texture to the minimum, thus reducing the size of the game’s release package to half at most. 1.

2. Redux compression method

Redux provides 3 texture compression methods:

Redux Mode 1 (Redux Mode 1) is a lossless compression algorithm with the smallest compression ratio in most cases. However, it usually renders the fastest.

Redux mode 2 (Redux mode 2) is a fast compression algorithm that provides high-quality images, but the size reduction rate is about 40%.

Redux mode 3 achieves a rough balance between image quality and size reduction. Image quality is lower than Mode 2, but higher compression ratios are achieved with this mode. The size reduction rate is about 60%.

In actual operation, I compressed 300 DDS files and found that the file sizes generated by Redux mode 2 and Redux mode 3 were the same. I didn't care about the specific compression format of these DDS files at the time. I guess most of them were DXT5.

3. Redux compressed files

Redux mainly compresses batch texture files. The compressed files are divided into two categories. A "header" file that contains the directory of the main data files and provides the location of each texture to the decompression code. This file has a .RDXH extension and stores details about each texture, such as texture name, folder, and path. One or more "data" files that contain the actual compressed textures and have the extension .RDXC. The second type of files will be in "blocks". It is possible to store all textures in one large file so that only one "chunk" of data needs to be processed. For exported compressed "chunk" files, you can have the following three settings:

1. No Chunks (no chunks) - that is, a large data file containing each individual texture in the project;

2. Chunks split according to a size limit - for example, a new chunk is created every 4 MB of data;

3. Chunks split according to content Split blocks) - i.e. create a new block for each texture. At this time, a header file and several chunk files will be generated.

After generating the compressed file, if there are any changes to the original texture file, the compressed file must be regenerated. This kind of compression doesn't quite fit my idea. What I want is to find a compressed file by a texture name, load the file, decompress it and generate the texture. If you use Redux, the engine needs to first load a .RDXH header file and generate a ReduxHandle object defined by Redux. Then find the texture subscript index according to the texture name, and then use the interface provided by Redux to obtain the texture data through the index value. Create a Redux project that contains only one texture file, so that the generated compressed file contains one texture. This is very troublesome and requires a lot of work.

Four. Redux decompression

The Demo provided by ReduxSDK decompresses the compressed file into data that conforms to the DDS format. I have tested its performance: first, use 300 DDS files for testing. The original file size is 59.6M, and if compressed using RAR, the size is 25.9M. The compression format of DDS was not recorded at the time, and it is estimated that most of it was DXT5.

Compression method
File size
Loading file time
Synchronized texture creation time 1
Synchronous texture creation time 2
No compression
59.6M
2355ms
6172 ms
6133 ms

Redux Mode1

Lossless Compression

19.5M
743ms
25016 ms
24985 ms

Redux Mode2

40% reduction

17.3M
702ms
25862 ms
25860 ms

Redux Mode3

50% reduction

17.3M
674ms
25878 ms
25911ms

Redux Mode1

Lossless compression

Texture per chunk

20.6M

813ms

(This is the time when ReduxHandle is created)

29027ms
29089ms

Load local with engine It takes about 8 seconds to create these 300 textures from the file. It takes more than 30 seconds to create 300 textures by decompressing the Redux file, which is 4 times longer than loading locally.

For files of different sizes, the time used to create textures is as shown in the following table:

##256*25665K11 ms228 ms82 ms82 ms512*512257K49 ms206 ms140 ms137 ms##1024*10242048*2048

five. The image generation function

uses several simple graphics elements to generate complex images through algorithms. The biggest problem here is that art cannot adapt to this way of drawing. Under normal circumstances, art drawing tablets are used in PS To make pictures, Redux requires artists to use an analytical method to first imagine how many graphic elements a picture consists of, and then design the combination of graphic elements. How to make the graphic elements generate images is too subversive for ordinary people. It is difficult to efficiently use the software it provides to draw pictures. For this reason, this middleware was not used in the end.

6. Software issues

(1) When setting the project properties, set the compressed files generated by Mode2 and Mode3 to be the same.

(2) The Redux Mode3 in the compression setting for a single texture is different from the Mode3 in the project properties.

There is no difference between setting Redux Mode2 and Redux Mode3.

(3) For some texture files, the compressed data size is larger than the unprocessed data size.

The original DDS file size is 6.475KB, and after compression it is 6.682KB

The original DDS file size is 57.6KB, and after compression it is 140.9KB

(4) Use lossy Compression will produce obvious mottled textures for some textures.

(5) The version I was using at the time would cause the software to crash if the number of textures was too large.

(6) Redux thread is not safe, so multiple textures cannot be decompressed at the same time.

seven. Redux Postscript

My personal feeling about Redux is: this middleware is very strange. With the current development, hard disk size is not a problem, and memory consumption is not a problem. The biggest problem is to improve efficiency. In order to improve efficiency, we often Use some algorithms that exchange space for time. Redux does the opposite. All it does is exchange time for space. The above materials were compiled by me two or three years ago. The performance test data in the article are only for For reference, I don’t know how Redux is developing now, and I don’t know how many games on the market use it. I searched on Google, and there aren’t many web pages about it. Maybe Redux will develop in mobile games, after all, mobile games are now The disk space of the client is much smaller than that of the PC client.

Texture size
File Size
Engine loading creation time
Redux Mode1 creation time
Redux Mode2 creation time
Redux Mode3 creation time
128*128
11K
1ms
105 ms
#31 ms
30 ms













1025K

176 ms

297 ms

418 ms

415 ms


5462K

242 ms

2263 ms

2265 ms

2294 ms

The above is the detailed content of What does redux mean in the game?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template