Map processing method and device and electronic equipment
By converting a single-channel gradient map into a pixel matrix and performing a gridded scan, the gradient region is identified and divided, solving the problems of low accuracy and efficiency in gradient region recognition in existing texture processing methods, and achieving an efficient and natural gradient effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2026-01-06
- Publication Date
- 2026-05-12
AI Technical Summary
Existing texture processing methods cannot accurately identify and locate the boundaries of gradient regions when processing single-channel gradient textures, resulting in unnatural gradient transitions and high computational complexity, making it difficult to meet the performance requirements of real-time rendering applications.
The single-channel gradient map is converted into a pixel matrix. Standard units with consistent color level values are identified by grid scanning. The starting and ending color level values of the gradient region are detected. Based on the distribution ratio of these values, the gradient region is divided into multiple continuous partitions and filled to optimize the gradient effect.
It achieves efficient and high-quality processing of single-channel gradient maps, accurately identifies the boundaries and features of gradient areas, eliminates visual defects in gradient areas, and improves rendering quality.
Smart Images

Figure CN122023628A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game technology, and in particular to a texture processing method and apparatus, storage medium, and electronic device. Background Technology
[0002] In computer graphics and 3D rendering, texture processing is one of the key technologies for achieving realistic visual effects. Single-channel gradient maps, as an important texture resource, are widely used in material rendering, lighting simulation, and visual effects production. However, existing texture processing methods face significant technical challenges when handling single-channel gradient maps. On the one hand, traditional pixel-level processing methods often fail to accurately identify and locate the boundaries of gradient regions, resulting in unnatural gradient transitions and affecting the final rendering quality. On the other hand, existing methods have high computational complexity and insufficient processing efficiency when processing large-size textures, making it difficult to meet the performance requirements of real-time rendering applications. Especially when processing complex textures containing multiple independent gradient regions, existing technologies lack effective region segmentation and differentiated processing mechanisms, easily producing visual defects such as gradient breaks and color jumps. Therefore, how to improve texture processing efficiency while ensuring processing accuracy, and achieve accurate identification and optimized processing of gradient regions, has become an urgent technical problem to be solved in this field.
[0003] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0004] The purpose of this invention is to provide a texture processing method and apparatus, storage medium, and electronic device, thereby overcoming, to at least to some extent, one or more problems caused by the limitations and defects of related technologies.
[0005] According to one aspect of this disclosure, a texture processing method is provided, the method further comprising: Obtain a single-channel gradient map and convert the single-channel gradient map into a pixel matrix; The pixel matrix is scanned in a grid pattern based on a preset size to identify standard unit cells with consistent color level values. Detect the gradient region of the standard unit cell and determine the starting and ending color level values within the gradient region; Based on the distribution ratio of the starting color level value and the ending color level value within the gradient area, the gradient area is divided into multiple continuous partitions; Filling processing is performed on the pixels in the standard unit cells within the continuous partition to obtain the texture processing result.
[0006] According to another aspect of this disclosure, A texture processing apparatus, the apparatus comprising: The acquisition module is used to acquire a single-channel gradient map and convert the single-channel gradient map into a pixel matrix; The recognition module is used to perform a gridded scan of the pixel matrix based on a preset size and identify standard unit cells with consistent color level values. The determination module is used to detect the gradient region of the standard unit cell and determine the starting and ending color level values within the gradient region. The partitioning module is used to divide the gradient region into multiple continuous partitions according to the distribution ratio of the starting color level value and the ending color level value within the gradient region. The fill module is used to perform fill processing on the pixels in the standard unit cells within the continuous partition to obtain the texture processing result.
[0007] According to another aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the texture processing method described in any of the above claims.
[0008] According to another aspect of this disclosure, an electronic device is provided, comprising: Processor, display device; and Memory for storing the executable instructions of the processor; The processor is configured to execute any of the above-described texture processing methods by executing the executable instructions.
[0009] This application provides a texture processing method, characterized by comprising: acquiring a single-channel gradient texture and converting it into a pixel matrix; performing a gridded scan on the pixel matrix based on a preset size to identify standard unit cells with consistent color level values; detecting the gradient region of the standard unit cells and determining the starting and ending color level values within the gradient region; dividing the gradient region into multiple continuous partitions based on the distribution ratio of the starting and ending color level values within the gradient region; and performing filling processing on the pixels in the standard unit cells within the continuous partitions to obtain the texture processing result. The method provided by this embodiment enables accurate identification of the boundaries and features of the gradient region through gridded scanning technology, and precise region division based on the distribution ratio of the starting and ending color level values, thereby achieving high-efficiency and high-quality processing of single-channel gradient textures and effectively solving the technical problems of gradient region identification accuracy and processing efficiency in traditional texture processing methods. Attached Figure Description
[0010] The above and other features and advantages of this disclosure will become more apparent from the detailed description of exemplary embodiments thereof with reference to the accompanying drawings. Obviously, the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings: Figure 1 This is a cloud interaction system architecture diagram according to an exemplary embodiment of the present disclosure; Figure 2 This is a flowchart of a texture processing method according to an exemplary embodiment of this disclosure; Figure 3 This is a schematic diagram of a standard unit cell in an exemplary embodiment of this disclosure; Figure 4 This is a schematic diagram of a continuous partition in an exemplary embodiment of this disclosure; Figure 5 This is a schematic diagram illustrating a comparison of effects in an exemplary embodiment of this disclosure; Figure 6 This is a diagram illustrating the composition of a texture processing apparatus according to an exemplary embodiment of this disclosure; Figure 7 This is a schematic diagram of the structure of a computer-readable storage medium according to an exemplary embodiment of the present disclosure; Figure 8 This is a composition diagram of an electronic device according to an exemplary embodiment of the present disclosure. Detailed Implementation
[0011] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0012] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0013] It should be noted that the information (including but not limited to user input information, such as information entered by the user into input boxes), data (including but not limited to data used for analysis, stored data, and displayed data, such as context code, all code of the current project, the service pressure corresponding to operations performed on all code of the current project, and the code development status of the current project), and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with relevant laws, regulations, and standards. For example, the context code, operations performed on all code of the current project, the corresponding service pressure, and the code development status involved in this application were all obtained with full authorization.
[0014] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of the invention described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0015] It should also be noted that the various trigger events disclosed in this manual can be preset, and different trigger events can trigger the execution of different functions.
[0016] In one embodiment of this disclosure, a texture processing method can run on a terminal device or a server. The terminal device can be a local terminal device. When the display control method runs on a server, the method can be implemented and executed based on a cloud interaction system, which includes a server and client devices. Figure 1 The figure shows a cloud interaction system architecture diagram provided in this disclosure. As shown, the cloud interaction system may include: a client device 10 and a server 20, wherein the client device 10 can be connected to the server 20 via a network 30.
[0017] In an optional implementation, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separated. The storage and execution of texture processing methods are completed on the cloud gaming server. The client device is used for data reception, transmission, and game screen presentation. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, or PDA; however, the terminal device for information processing is the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses game screen data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.
[0018] In an alternative implementation, the terminal device can be a local terminal device. Taking a game as an example, the local terminal device stores the game program and is used to display the game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, conventionally downloading, installing, and running the game program via an electronic device. The local terminal device can provide the graphical user interface to the player in various ways, such as rendering it on the terminal's display screen, or providing it to the player through holographic projection. For example, the local terminal device can include a display screen for displaying the graphical user interface, which includes game screens, and a processor for running the game, generating the graphical user interface, and controlling the display of the graphical user interface on the display screen.
[0019] This embodiment provides a texture processing method. Figure 2 This is a flowchart of a texture processing method according to an embodiment of the present disclosure, such as... Figure 2 As shown, the process includes the following steps: Step S1: Obtain a single-channel gradient map and convert the single-channel gradient map into a pixel matrix; Step S2: Perform a gridded scan on the pixel matrix based on a preset size to identify standard unit cells with consistent color level values; Step S3: Detect the gradient region of the standard unit cell and determine the starting and ending color level values within the gradient region; Step S4: Based on the distribution ratio of the starting color level value and the ending color level value within the gradient area, divide the gradient area into multiple continuous partitions. Step S5: Perform filling processing on the pixels in the standard unit cells within the continuous partition to obtain the texture processing result.
[0020] The method provided in this embodiment enables accurate identification of the boundaries and features of gradient regions through gridded scanning technology, and precise region division based on the distribution ratio of the starting and ending color level values. This achieves high-efficiency and high-quality processing of single-channel gradient maps, effectively solving the technical problems of gradient region identification accuracy and processing efficiency in traditional mapping methods.
[0021] The steps described above are explained in detail below.
[0022] In step S1, a single-channel gradient map is obtained and converted into a pixel matrix.
[0023] Among them, single-channel gradient maps are texture data containing information of a single color channel. They are usually represented by grayscale values to show the color level changes at different locations. They are an important data format used in computer graphics to represent the gradient effect of materials.
[0024] In one optional implementation, a single-channel gradient map specifically refers to an image file containing only grayscale information, where each pixel corresponds to a grayscale value in the range of 0-255, used to represent the brightness of that location. This map specifically describes the gradual transition of a material surface, providing realistic lighting and shadow effects for the 3D model. This map features small data size and fast processing speed, significantly improving rendering efficiency compared to multi-channel color maps. For example, a terminal device reads a 1024×1024 resolution PNG format single-channel gradient map file from local storage. This map records the gradient effect of a metallic material from light to dark, with the grayscale value of each pixel smoothly changing between 128 and 220.
[0025] In one optional implementation, the pixel matrix is specifically a data structure that converts two-dimensional image data into a numerical matrix, where each element of the matrix corresponds to the numerical information of a pixel in the image. This matrix facilitates numerical calculations and algorithmic processing, supporting the efficient execution of various image processing algorithms. It also provides random access capabilities, allowing algorithms to quickly locate and modify pixel values at arbitrary positions. For example, a terminal device can convert a 1024×1024 resolution single-channel gradient map into a 1024-row, 1024-column two-dimensional numerical matrix, where each element stores the grayscale value of the corresponding pixel position, facilitating subsequent gridded scanning and numerical analysis.
[0026] In a specific application, after receiving a texture processing request from the graphics rendering engine, the terminal device first loads a single-channel gradient texture file from the specified path, and then calls the image decoding module to read the texture data row by row and column by column and store it into a two-dimensional array to form the corresponding pixel matrix, providing standardized data input for subsequent mesh analysis and processing.
[0027] In step S2, the pixel matrix is scanned in a grid pattern based on a preset size to identify standard unit cells with consistent color level values.
[0028] Among them, the preset size is a parameter configuration used to define the size of the grid cell. It is usually specified in the form of m×n pixels to indicate the coverage of each detection window during gridded scanning. It is a key technical parameter that affects the balance between processing accuracy and efficiency.
[0029] In one optional implementation, the preset size is specifically a mesh unit specification predetermined based on the texture resolution and processing requirements, with common values including 2×2, 3×3, or 4×4 pixel sizes. This size plays a role in controlling the processing granularity; a smaller size provides higher detail recognition accuracy, while a larger size improves overall processing efficiency. This size also adapts to different application scenarios and can be dynamically adjusted according to texture complexity and real-time requirements. For example, for material textures requiring high-precision processing, the terminal device uses a preset size of 2×2 pixels for mesh scanning to ensure that subtle gradient changes can be captured; for real-time rendering scenes, a 4×4 pixel size is used to improve processing speed.
[0030] In one optional implementation, gridded scanning is a process of systematically traversing the pixel matrix according to a regular step size, collecting and analyzing data by moving the scanning window to cover the entire image area. This scanning method serves to systematically collect data, ensuring that each region in the image is fully detected and analyzed. It also provides structured data organization, organizing continuous pixel data into discrete grid units, facilitating subsequent feature recognition and processing. For example, the terminal device uses a 3×3 pixel scanning window, starting from the top left corner of the pixel matrix, moving horizontally in 3-pixel steps, moving down 3 pixels after reaching the end of a row, and continuing to scan the next row until the entire 1024×1024 pixel matrix is covered.
[0031] In one optional implementation, the standard unit cell is specifically a rectangular area with completely consistent color level values identified during the meshing scan process, representing a stable region in the texture where color changes are relatively gentle. This unit cell serves to identify homogeneous regions, decomposing complex gradient textures into several well-defined processing units. This unit cell also simplifies subsequent processing by grouping pixels with the same color level together, reducing the amount of data that needs to be processed individually. Figure 3 The diagram shows a standard unit cell.
[0032] In a specific application, the terminal device uses a preset size of 2×2 pixels to perform a gridded scan on a 1024×1024 gradient map pixel matrix. It systematically detects whether the gray values of the four pixels in each 2×2 pixel area are the same, marks the areas with the same gray values as standard units and records their coordinate information. Finally, about 15,000 standard units are identified for subsequent gradient region detection.
[0033] In step S3, the gradient region of the standard unit cell is detected, and the starting and ending color level values within the gradient region are determined.
[0034] The gradient region is a spatial area where there is a clear but continuous change in color level between standard unit cells. It is usually manifested as a regular increasing or decreasing distribution pattern of color level values between adjacent unit cells, and is the key area for achieving a smooth transition effect in the texture.
[0035] In one optional implementation, the gradient region is specifically a continuous transition area identified by analyzing the variation patterns of color gradation values in adjacent standard unit cells. It typically contains multiple unit cells with different color gradation values but within a reasonable range of variation. This region serves to achieve a smooth color transition, avoiding visual discontinuity caused by abrupt color gradation jumps. It also functions to support the gradient effect, providing natural variations in brightness and texture for the material representation. For example, the terminal device, through analysis of a sliding detection window, identifies eight consecutive standard unit cells whose color gradation values gradually increase from 165 to 195, with a color gradation span of 30 and continuous variation. The area covered by these eight unit cells is marked as a gradient region.
[0036] In one optional implementation, the starting color level value is specifically the minimum value among all standard unit color level values within the gradient area, representing the starting point or darker end of the color change in the gradient area. This color level value specifically defines the starting point of the gradient, providing a reference for subsequent partitioning and filling processes. This color level value also controls the gradient range, working together with the ending color level value to determine the magnitude of color change in the area. For example, in a gradient area containing 12 standard unit colors, the terminal device compares the color level values of each unit color and determines the minimum value of 142 as the starting color level value of the gradient area, identifying the darker end of the gradient effect in that area.
[0037] In one optional implementation, the ending color level value is specifically the maximum value among all standard unit color level values within the gradient area, representing the endpoint or brighter end of the color change in that gradient area. This color level value specifically defines the endpoint of the gradient, working together with the starting color level value to determine the range and direction of color change in the gradient area. This color level value also controls the gradient intensity; the difference between the starting and ending color level values determines the contrast of the gradient effect. For example, if the terminal device identifies a maximum color level value of 188 within the same gradient area and determines it as the ending color level value, it forms a gradient span of 46 gray levels with the starting color level value of 142, providing a moderate gradient contrast effect.
[0038] In a specific application, the terminal device uses a detection window containing 10 consecutive standard unit cells to perform sliding detection on the identified standard unit cells, calculates the difference between the maximum and minimum values of the color level values within the window, and marks the window as a gradient region when the difference is between 5 and 50 and there are at least 3 different color level values within the window, and records the minimum and maximum values as the starting and ending color level values of the region respectively.
[0039] In step S4, the gradient region is divided into multiple continuous partitions according to the distribution ratio of the starting color level value and the ending color level value within the gradient region.
[0040] The distribution ratio is the relative proportion of the number of standard unit grids corresponding to the starting and ending color levels within the gradient area. It reflects the spatial distribution density of different color levels within the area and is an important basis for dividing the region.
[0041] In one optional implementation, the distribution ratio is specifically a percentage calculated by statistically analyzing the number of standard units corresponding to the starting and ending color level values within the gradient area. This percentage quantifies the occupancy of different color levels within the area. Specifically, this ratio guides the partitioning process, determining the appropriate number of partitions and their boundary positions based on the unevenness of the color level distribution. Furthermore, this ratio optimizes the processing strategy, allowing the algorithm to employ differentiated filling methods based on the actual color level distribution. For example, in a gradient area containing 20 standard units, if the terminal device statistically analyzes and finds that the starting color level value corresponds to 12 units and the ending color level value corresponds to 8 units, the calculated proportion of the starting color level value is 60% and the ending color level value is 40%, and a corresponding partitioning strategy can be formulated accordingly.
[0042] In one optional implementation, continuous partitioning specifically involves dividing the gradient region into several adjacent sub-regions according to the distribution pattern of color levels. The standard unit cells within each partition have similar color level characteristics and processing requirements. This partitioning serves to refine the processing granularity, enabling more precise filling strategies for regions with different color level characteristics. It also improves processing effectiveness by avoiding the unnatural gradient problems that can result from a "one-size-fits-all" approach. For example, the terminal device divides a gradient region with a color level span of 40 into 5 continuous partitions, each covering approximately 8 color levels, allowing subsequent filling processing to better maintain the continuity and naturalness of the gradient.
[0043] In a specific application, the terminal device performs a statistical analysis of the color level distribution of the identified gradient area and finds that the standard unit cell corresponding to the starting color level value of 150 accounts for 65% of the total, and the unit cell corresponding to the ending color level value of 180 accounts for 35%. Based on this, the area is divided into 7 consecutive partitions along the gradient direction. The first 4 partitions are dominated by the starting color level value, and the last 3 partitions are dominated by the ending color level value.
[0044] In step S5, the pixels in the standard unit cells within the continuous partition are filled to obtain the texture processing result.
[0045] The filling process involves reassigning color values to pixels in the standard unit cells within a continuous partition based on the color gradation characteristics. This process aims to optimize gradient effects and eliminate visual defects such as discontinuous color gradations.
[0046] In one optional implementation, the fill process specifically involves strategically setting color values for pixels based on the color level distribution characteristics within a partition, achieving a smooth gradient transition effect through reasonable color value allocation. This process specifically optimizes visual effects, eliminating potential color level jumps and gradient discontinuities in the original texture. It also improves texture quality, achieving a more natural and realistic gradient representation through precise pixel-level operations. For example, for a continuous partition where the initial color level value dominates, the terminal device fills 70% of the pixels in the standard unit cell of that partition with the initial color level value of 150 and 30% with the ending color level value of 180, forming a gradient effect dominated by the initial color level.
[0047] In one optional implementation, the texture processing result is specifically optimized texture data generated after a complete fill process, containing reorganized pixel color value information and improved gradient effects. This result specifically meets application requirements, providing high-quality texture data support for subsequent rendering and display. It also maintains the original characteristics, preserving the basic visual features and material expressiveness of the texture while optimizing gradient effects. For example, after the terminal device completes the fill processing of all consecutive sections, it generates an optimized texture file with a resolution of 1024×1024, which achieves a smoother and more continuous color gradation effect while maintaining the original gradient direction.
[0048] In a specific application, the terminal device uses a differentiated filling strategy to process the pixels in the standard unit cell according to the distribution ratio of the starting and ending color level values in each continuous partition, and finally generates a texture processing result with optimized gradient effect, which is then output to the graphics rendering engine for material rendering.
[0049] In a specific application of this embodiment, the terminal device receives a processing request for a gradient map of a metallic material. First, it loads a 1024×1024 resolution single-channel gradient map and converts it into a pixel matrix. Then, it performs a gridded scan using a preset size of 3×3 pixels to identify multiple standard unit grids. Through a sliding detection window, it identifies 10 gradient regions and determines the starting and ending color levels of each region. Based on the color level distribution ratio, the gradient regions are divided into multiple continuous partitions (e.g., ...). Figure 4 As shown), finally, differential fill processing is performed on the standard unit cells within each partition to generate a texture processing result with optimized gradient effects; as shown Figure 5 The image shows a comparison of the effects of the texture processing method using this approach.
[0050] In a texture processing method provided in one embodiment of this application, the pixel matrix is scanned in a grid pattern based on a preset size to identify standard unit cells with consistent color level values, including: Step S21: Perform a non-overlapping scan of the pixel matrix according to the preset size step size; Step S22: Check whether the grayscale values of all pixels in each candidate region are the same; Step S23: Mark the candidate regions with the same grayscale value as standard unit cells and record their coordinate positions.
[0051] The method provided in this embodiment enables the accurate identification of standard units with consistent grayscale characteristics through non-overlapping scanning, avoiding computational redundancy caused by region overlap during scanning, improving the running efficiency of texture processing, and ensuring the accuracy of subsequent gradient region detection and processing through precise coordinate recording.
[0052] The above plan will be explained in detail below.
[0053] In step S21, the pixel matrix is scanned without overlap according to the preset size step size.
[0054] Non-overlapping scanning is a regular matrix traversal method that moves the scanning window sequentially across the entire matrix by a fixed step size, ensuring that there are no overlapping parts between adjacent scanning areas.
[0055] In an optional implementation, non-overlapping scanning is achieved by setting the moving distance of the scanning window to a step size equal to the window size, ensuring that each scanning position corresponds to a unique candidate region. For example, when the window size is 2×2, the terminal device moves the scanning window in steps of 2 pixels in both the horizontal and vertical directions, starting from the top left corner of the pixel matrix, and sequentially scans regions such as (0,0)-(1,1), (0,2)-(1,3), (2,0)-(3,1), etc.
[0056] In one optional implementation, the setting of the scanning step size directly affects the generation density and processing accuracy of candidate regions. A smaller step size can achieve more detailed region division but increases computational complexity. For example, the terminal device dynamically adjusts the step size parameter according to the resolution of the texture and processing requirements. A larger step size is used for high-resolution textures to improve processing efficiency, while a smaller step size is used for textures that require fine processing to ensure processing quality.
[0057] In step S22, it is checked whether the grayscale values of all pixels in each candidate region are the same.
[0058] Among them, the grayscale value consistency check is a key step in judging the uniformity of pixel features within a candidate region. By comparing the grayscale values of all pixels within the region, it is determined whether the region has the basic conditions for subsequent processing.
[0059] In an optional implementation, grayscale value checking is performed by traversing each pixel within the candidate region and obtaining its grayscale value, then comparing all grayscale values one by one to achieve consistency judgment. For example, for a 2×2 candidate region, the terminal device reads the grayscale values of four pixel positions respectively. If all four values are 128, the grayscale values of the region are determined to be the same; if there are different values such as 128, 130, 128, and 128, the grayscale values are determined to be inconsistent.
[0060] In an alternative implementation, consistency checks can employ a fast comparison algorithm to optimize detection efficiency by setting a baseline value and measuring the differences. For example, the terminal device uses the grayscale value of the first pixel in the candidate region as a baseline, then calculates the differences between other pixels and the baseline value. When all differences are 0, the grayscale values are confirmed to be the same. This method can significantly reduce the number of calculations compared to pairwise comparisons.
[0061] In step S23, candidate regions with the same grayscale value are marked as standard unit cells, and their coordinate positions are recorded.
[0062] The standard unit grid marking is a process of identifying and recording the location of candidate regions that meet the consistency conditions, providing a basic data structure for subsequent gradient region detection and partitioning.
[0063] In an optional implementation, the marking process achieves ordered management by assigning a unique identifier to each standard unit cell and storing its coordinate information in a data structure. For example, the terminal device assigns the number "Unit_001" to the first detected standard unit cell, records its top-left corner coordinates (0,0) and bottom-right corner coordinates (1,1), and stores the representative grayscale value 128 for that area, forming complete unit cell description information.
[0064] In an optional implementation, the coordinate records use a multidimensional array or linked list structure to store location information, ensuring that specific standard unit cells can be quickly located and accessed in subsequent processing. For example, the terminal device establishes a coordinate index table, using the center coordinates of each standard unit cell as the index key value, and stores the detailed attribute information of that unit cell accordingly. In this way, during the gradient region detection stage, adjacent unit cells can be quickly found and their relationships can be determined by coordinates.
[0065] In a specific application, when a terminal device processes a 256×256 single-channel gradient map, it first converts it into a corresponding numerical matrix. Then, it performs a non-overlapping scan with a 2×2 scanning window and a step size of 2 pixels. It checks the consistency of grayscale values in each 4-pixel candidate region in turn. For candidate regions with completely identical grayscale values, they are marked as standard units and their coordinate information is recorded. Finally, an ordered set of 128×128 standard units is generated, providing a standardized data foundation for subsequent gradient detection and processing operations.
[0066] In a specific application of this embodiment, after receiving a gradient map processing task, the terminal device first converts the input single-channel map data into a corresponding numerical matrix form. Then, it sets a 2×2 scanning window according to predefined scanning parameters and performs a systematic scan across the entire matrix range with a step size of 2 pixels. For each candidate region obtained by scanning, a grayscale consistency check is performed one by one. When it is found that the grayscale values of four pixels in a region are exactly the same, the region is immediately marked as a standard unit cell and the corresponding position information is added to the coordinate record table. Through this precise non-overlapping scanning and marking mechanism, the terminal device can efficiently identify all basic processing units with uniform characteristics in the map, laying a solid data foundation for subsequent gradient analysis and optimization processing.
[0067] In a texture processing method provided in one embodiment of this application, detecting the gradient region of the standard unit cell and determining the starting and ending color level values within the gradient region includes: Step S31: Perform sliding detection using a preset number of continuous standard unit cells as the detection window; Step S32: Calculate the difference between the maximum and minimum values of the color level values represented by the standard unit grid within the detection window; Step S33: When the difference is greater than 0 and does not exceed a preset threshold, and there are multiple different color level values within the detection window, the detection window is marked as a gradient region, and the minimum value is determined as the starting color level value, and the maximum value is determined as the ending color level value.
[0068] The method provided in this embodiment enables the scanning and analysis of continuous standard unit cells through the sliding detection window technique, which can accurately identify the gradient transition region in the texture and accurately determine the numerical range of the transition boundary. This effectively improves the accuracy and reliability of gradient region detection. At the same time, the difference threshold judgment avoids false identification and improves the overall quality and efficiency of texture processing.
[0069] The steps described above are explained in detail below.
[0070] In step S31, a sliding detection is performed using a preset number of continuous standard unit grids as the detection window.
[0071] The detection window is an analysis area containing multiple consecutive standard unit cells, used to detect gradient features in local areas of the texture data.
[0072] In one alternative implementation, the detection window forms a continuous analysis area by setting a fixed number of standard units, which is progressively scanned along the horizontal or vertical direction of the texture. For example, the terminal device can create a detection window containing 8 consecutive standard units, starting from the top left corner of the texture and scanning in a left-to-right, top-to-bottom order, moving the distance of one standard unit each time.
[0073] In one alternative implementation, sliding detection ensures comprehensive coverage analysis of the entire texture area by controlling the orderly movement of the detection window within a grid composed of standard unit cells. For example, the terminal device calculates the coordinates of the next detection position based on the current position of the detection window, moves the detection window to the new position, and records the standard unit cell information for each detection position until the entire texture area is scanned.
[0074] In a specific application, the terminal device creates a detection window containing 10 consecutive standard unit cells. Starting from the first standard unit cell in the upper left corner of the texture, the detection window moves horizontally one by one. When it reaches the end of the row, it automatically jumps to the beginning of the next row to continue detection. This sliding method achieves full coverage scanning of the entire texture.
[0075] In step S32, the difference between the maximum and minimum values of the color level values represented by the standard unit grid within the detection window is calculated.
[0076] Among them, the representative color level value is the uniform grayscale value of all pixels within the standard unit cell, reflecting the brightness characteristics of that unit cell.
[0077] In one optional implementation, the maximum and minimum values are determined by comparing the representative color level values of all standard unit cells within the current detection window. The maximum value represents the brightest color level within the window, and the minimum value represents the darkest color level. For example, the terminal device acquires the representative color level value of each standard unit cell within the detection window and finds the maximum and minimum values through a numerical comparison algorithm. If the window contains four standard unit cells with color level values of 50, 65, 80, and 95, then the maximum value is 95, and the minimum value is 50.
[0078] In an optional implementation, the difference is calculated by subtracting the minimum value from the maximum value, and this value reflects the magnitude and intensity of the color gradation change within the detection window. For example, when the maximum color gradation value within the detection window is 200 and the minimum color gradation value is 150, the terminal device calculates a difference of 50, which indicates that there is a certain degree of brightness variation in the current detection area.
[0079] In a specific application, the terminal device obtains six units with color level values of 120, 135, 150, 165, 180, and 195 in a detection window containing six standard units. By comparison, the maximum value is determined to be 195 and the minimum value is 120, and the difference is calculated to be 75.
[0080] In step S33, when the difference is greater than 0 and does not exceed a preset threshold, and there are multiple different color level values within the detection window, the detection window is marked as a gradient region, the minimum value is determined as the starting color level value, and the maximum value is determined as the ending color level value.
[0081] The preset threshold is a standard for judging the color difference in the gradient region, used to distinguish the boundary conditions between normal gradients and excessive jumps.
[0082] In an optional implementation, the difference determination compares the calculated color gradation difference with a preset threshold to ensure that the identified gradient region has a moderate color gradation change, avoiding the identification of changes that are too small or too drastic. For example, if the terminal device sets the preset threshold to 100, when the color gradation difference within the detection window is 75, since 75 is greater than 0 and less than 100, the basic condition for a gradient region is met.
[0083] In an optional implementation, gradient region marking provides an accurate data foundation for subsequent partitioning processing by identifying and recording the boundary values of detection windows that meet the conditions. For example, the terminal device assigns a unique region number to the detection window that meets the conditions, and records the starting and ending color level values of the gradient region to establish a complete information file for the gradient region.
[0084] In a specific application, during the detection process, the terminal device found that a window contained four different standard unit cells with color level values of 60, 75, 90, and 105. The calculated difference was 45. Since 45 is greater than 0 and less than the preset threshold of 80, and there are multiple different color level values within the window, the window was marked as a gradient area, and the starting color level value was determined to be 60 and the ending color level value was determined to be 105.
[0085] In a specific application of this embodiment, when the terminal device performs detection processing on a single-channel gradient map, it creates a detection window containing 7 consecutive standard unit cells. Starting from the upper left corner of the map, it performs a sliding scan. During the scan, it finds that a certain detection window contains seven standard unit cells with color level values of 100, 115, 130, 145, 160, 175, and 190. The maximum value of 190 and the minimum value of 100 are calculated, with a difference of 90. Since this difference is greater than 0 and does not exceed the preset threshold of 120, and there are multiple different color level values within the window, the terminal device marks the detection window as a gradient area and determines the starting color level value to be 100 and the ending color level value to be 190.
[0086] In a texture processing method provided in one embodiment of this application, the preset quantity ranges from 5 to 15 standard unit grids.
[0087] The method provided in this embodiment enables the detection of gradient regions to be accurate while maintaining processing efficiency by reasonably setting the standard unit grid number range of the detection window. This avoids inaccurate detection due to an excessively small window or waste of computing resources due to an excessively large window, effectively optimizing the performance and detection quality of texture processing.
[0088] The above plan will be explained in detail below.
[0089] The preset quantity refers to the specific number of standard unit cells that make up the detection window, which directly affects the accuracy and processing efficiency of the gradient region detection.
[0090] In one alternative implementation, the optimal range for the number of standard units is determined through experimental verification and theoretical analysis. A lower limit of 5 standard units provides basic gradient detection capability, while an upper limit of 15 standard units avoids an excessively large detection window that could affect processing speed. For example, the terminal device selects an appropriate detection window size within the range of 5-15 standard units based on the complexity of the texture and processing requirements; a smaller window size is chosen for textures with rich details, while a larger window size is chosen for textures with gradual changes.
[0091] In an optional implementation, the number of standard unit cells is dynamically adjusted by considering texture characteristics and detection accuracy requirements to ensure ideal detection results in different application scenarios. For example, the terminal device analyzes the gradient distribution characteristics of the current texture, selecting a detection window of 7-10 standard unit cells when the gradient change is more subtle, and selecting a detection window of 10-13 standard unit cells when the gradient change is more gradual.
[0092] In a specific application, when processing a texture containing multi-layered gradient effects, the terminal device determines the size of the detection window to be 8 standard unit grids based on the preliminary analysis results. This number is within a reasonable range of 5-15, which can capture subtle gradient changes without causing detection delay due to an excessively large window.
[0093] In a texture processing method provided in one embodiment of this application, dividing the gradient region into multiple continuous partitions according to the distribution ratio of the starting and ending color level values within the gradient region includes: Step S51: Count the number of standard unit cells corresponding to the starting and ending color level values within the gradient area; Step S52: Based on the proportion of standard unit cells corresponding to the initial color level value, divide the gradient area into continuous partitions along the gradient direction.
[0094] The method provided in this embodiment enables precise partitioning control of the gradient region by accurately statistically analyzing the distribution of different color levels within the gradient region. This improves the accuracy of texture processing and the naturalness of gradient transitions, avoiding visual discontinuity problems that may be caused by traditional uniform segmentation methods.
[0095] The above plan will be explained in detail below.
[0096] In step S51, the number of standard unit cells corresponding to the starting and ending color level values within the gradient area is counted.
[0097] The statistical mechanism is a data processing method that identifies and counts the color level values of each standard unit cell within the gradient area. By traversing all standard units within the gradient area, the statistical mechanism identifies the representative color level value of each unit cell and categorizes it as either the starting or ending color level value, thereby establishing accurate quantitative statistics. The statistical mechanism not only accurately calculates the distribution quantity of different color level values but also provides a quantitative basis for subsequent partitioning, ensuring that the partitioning results conform to the actual gradient characteristics.
[0098] In one optional implementation, the statistical mechanism uses a traversal scanning method to detect and classify the standard units within the gradient area one by one. For example, when a gradient area of 8×4 standard units is detected, the terminal device will sequentially check the color level value of each standard unit, classifying the unit with a color level value of 50 into the starting color level value group and the unit with a color level value of 150 into the ending color level value group. Finally, the statistics show that the starting color level value corresponds to 12 standard units and the ending color level value corresponds to 20 standard units.
[0099] In an optional implementation, the statistical mechanism also includes the function of identifying and classifying intermediate transition color level values. For example, when there is an intermediate transition unit cell with a color level value of 100 in the gradient area, the terminal device will classify it into the closest color level value group according to the numerical difference between it and the starting and ending color level values, ensuring the completeness and accuracy of the statistical results.
[0100] In a specific application, when processing a game texture containing a gradient effect, the terminal device first identifies a 10×6 standard unit grid gradient region, which contains a gradient effect from dark gray to light gray. The terminal device then uses a statistical mechanism to examine each of the 60 standard units within the region, finding that the starting color level value (dark gray) corresponds to 35 standard units and the ending color level value (light gray) corresponds to 25 standard units, providing a precise data foundation for subsequent partitioning.
[0101] In step S52, based on the proportion of standard unit cells corresponding to the initial color level value, the gradient area is divided into continuous partitions along the gradient direction.
[0102] The partitioning algorithm is a calculation method that determines the boundaries and number of partitions based on the distribution ratio of color levels. By analyzing the proportion of the initial color level value within the entire gradient area, the algorithm calculates a reasonable number of partitions and the location of their boundaries, ensuring relative consistency of color level characteristics within each partition. The algorithm considers not only the proportion of colors but also the gradient direction and spatial continuity, enabling the resulting continuous partitions to better reflect the original gradient characteristics.
[0103] In an optional implementation, the partitioning algorithm uses proportional calculations to determine the relative size and positional distribution of the partitions. For example, when the initial color level value accounts for 60%, the terminal device will divide the gradient area into 5 consecutive partitions, where the first 3 partitions mainly reflect the characteristics of the initial color level value, and the last 2 partitions mainly reflect the characteristics of the ending color level value, ensuring that the partitioning result matches the actual color level distribution.
[0104] In an optional implementation, the partitioning algorithm also has an adaptive adjustment function, which can dynamically adjust the partitioning strategy according to different proportions. For example, when the proportion of the initial color level value reaches more than 80%, the terminal device will adopt an uneven partitioning strategy, allocating more partitions to the initial color level value area, while maintaining a smooth transition between partitions and avoiding abrupt partition boundaries.
[0105] In a specific application, when processing a gradient map of a building wall, the terminal device statistically determined that the initial color level (dark tone) accounted for 70% of the entire gradient area, while the ending color level (light tone) accounted for 30%. Based on this distribution ratio, the terminal device divided the area into 7 consecutive partitions along the gradient direction from bottom to top. The first 5 partitions mainly maintained the dark tone characteristics, while the last 2 partitions gradually transitioned to light tones, achieving a natural gradient effect.
[0106] In a texture processing method provided in one embodiment of this application, dividing the gradient region into continuous partitions along the gradient direction based on the proportion of standard unit cells corresponding to the initial color level value includes: When the size is 2×2 pixels, the gradient area is divided into 5 consecutive partitions; when the size is 3×3 pixels, the gradient area is divided into 10 consecutive partitions.
[0107] The method provided in this embodiment enables precise control of partition granularity by establishing a correspondence between different pixel sizes and the number of partitions. This ensures the quality of the gradient effect while optimizing processing efficiency, avoiding the computational burden caused by too many partitions or the coarse gradient effect caused by too few partitions.
[0108] The above plan will be explained in detail below.
[0109] The partition number configuration rule is a mapping relationship that determines the optimal number of partitions based on different pixel sizes. By comprehensively considering the accuracy requirements and computational complexity of pixel sizes, the partition number configuration rule presets the most suitable number of partitions for different size specifications, ensuring that the best gradient processing effect can be obtained under various size conditions. The partition number configuration rule not only simplifies the partition parameter selection process, but also guarantees the consistency and predictability of the processing results.
[0110] In one optional implementation, the partition number configuration rule uses a pixel density-based calculation method to determine the optimal number of partitions. For example, for a standard unit cell with a size of 2×2 pixels, due to its low pixel density, setting 5 consecutive partitions on the terminal device can ensure smooth gradient while avoiding excessive subdivision. However, for a standard unit cell with a size of 3×3 pixels, due to its high pixel density, setting 10 consecutive partitions on the terminal device can fully utilize the pixel precision advantage to achieve a more delicate gradient effect.
[0111] In an optional implementation, the partition number configuration rules also take into account the performance requirements of different application scenarios, providing flexible configuration options. For example, in real-time rendering scenarios, the terminal device can appropriately reduce the number of partitions according to the frame rate requirements to improve processing speed, while in high-quality static rendering scenarios, the terminal device can increase the number of partitions to obtain more refined gradient effects.
[0112] The size adaptation mechanism is an intelligent processing method that automatically adjusts the partitioning strategy based on pixel size. It can identify the pixel size specifications of the current standard unit cell and automatically match the corresponding number of partitions and partitioning algorithms, ensuring consistent processing across different sizes. Through a predefined size-partition mapping table, the size adaptation mechanism automates the configuration of partitioning parameters, reducing the complexity of manual settings.
[0113] In an optional implementation, the size adaptation mechanism uses a lookup table mapping method to quickly determine the partition parameters. For example, when the terminal device detects that the current standard unit grid is 2×2 pixels in size, it immediately retrieves the corresponding 5 partition configuration parameters from the mapping table, including information such as partition boundary positions and partition weight allocation, to ensure the efficiency and accuracy of the processing.
[0114] In an optional implementation, the size adaptation mechanism also has dynamic expansion capabilities, enabling it to support new pixel size specifications. For example, when processing a standard 4×4 pixel unit, the terminal device can automatically calculate the appropriate number of partitions (e.g., 20 partitions) based on the square relationship of the number of pixels and dynamically generate the corresponding processing parameters.
[0115] In one specific application, when processing a composite texture with multiple precision requirements, the terminal device encountered a situation where both 2×2 and 3×3 pixel standard unit grids existed simultaneously. Through a size adaptation mechanism, the terminal device automatically configured a processing strategy of 5 consecutive partitions for the 2×2 area and a processing strategy of 10 consecutive partitions for the 3×3 area, ensuring that the gradient effect of the entire texture maintained optimal quality in different precision areas.
[0116] In a texture processing method provided in one embodiment of this application, performing filling processing on pixels in standard unit cells within a continuous partition includes: For a continuous partition where the initial color level value is dominant, most pixels in the standard unit cell are filled with the initial color level value, and a small number of pixels are filled with the ending color level value. For a continuous partition where the ending color level value dominates, most pixels in the standard unit cell are filled with the ending color level value, and a small number of pixels are filled with the starting color level value. For continuous partitions where the ratio of the starting color level value to the ending color level value is similar, the pixels in the standard unit cell are filled with the starting color level value and the ending color level value respectively according to a preset pattern.
[0117] The method provided in this embodiment enables the use of a layered fill strategy to differentiate the processing based on the dominance of color level values in different zones, which can significantly improve the accuracy and visual quality of the fill processing while maintaining a natural transition of the gradient effect.
[0118] The above plan will be explained in detail below.
[0119] For a continuous partition where the starting color level value dominates, most pixels in the standard unit cell are filled with the starting color level value, and a small number of pixels are filled with the ending color level value.
[0120] The dominance determination mechanism is based on statistical analysis to determine whether the proportion of the initial color level value in the current continuous partition exceeds a preset dominance threshold. When the distribution proportion of the initial color level value in the continuous partition reaches or exceeds 70%, the initial color level value is considered to dominate in that partition, and the filling strategy will prioritize ensuring the visual continuity of the initial color level value.
[0121] In an alternative implementation, the fill ratio of most pixels is typically set between 75% and 85% of the total number of pixels in the standard unit cell to ensure that the dominant color level value can visually create a distinct color tendency. For example, when the standard unit cell is 2×2 pixels in size, 3 out of 4 pixels are filled with the starting color level value, and the remaining 1 pixel is filled with the ending color level value. This maintains both the dominant hue and a natural transition to the next zone.
[0122] In an optional implementation, a small number of pixels are distributed using a random dispersion strategy to avoid forming obvious geometric patterns within standard unit cells, thereby ensuring the naturalness of the gradient effect. For example, the terminal device can use a pseudo-random number generator to determine the specific position of the ending color level pixel within the standard unit cell, ensuring that the distribution of a small number of pixels between different unit cells has a certain degree of randomness, thus avoiding the generation of repetitive visual patterns.
[0123] For a continuous partition where the ending color level value dominates, most pixels in the standard unit cell are filled with the ending color level value, and a small number of pixels are filled with the starting color level value.
[0124] The method for confirming the dominance of the ending color level value is through reverse proportional analysis. When the proportion of the ending color level value in the current continuous partition exceeds the proportion of the starting color level value, a fill strategy dominated by the ending color level value is executed. This approach ensures the continuity and directional consistency of color transitions during the gradient process.
[0125] In one optional implementation, the dynamic adjustment mechanism for the fill ratio is fine-tuned based on the dominance of the ending color level value. When the ending color level value accounts for 70%-80%, the fill ratio for most pixels is set to 75%, and when it accounts for 80%-90%, the fill ratio is increased to 85%. For example, when processing the lower half of a sky gradient map, if the dark blue (ending color level value) accounts for 82% in a certain continuous section, then 3-4 pixels out of 4 pixels in each 2×2 standard unit cell in that section will be filled with dark blue, ensuring a natural transition to darker colors.
[0126] In an alternative implementation, the initial color level value serves as fill content for a small number of pixels, and its distribution strategy follows an edge-priority principle. That is, the initial color level value pixels are preferentially placed at the edges of the standard unit cells to form a natural connection to the next section. For example, when processing horizontal gradients, the initial color level value pixels are preferentially distributed on the left edge of the standard unit cells to provide a buffer transition for visual connection with the previous continuous section.
[0127] For continuous partitions where the ratio of the starting color level value to the ending color level value is similar, the pixels in the standard unit cell are filled with the starting color level value and the ending color level value respectively according to a preset pattern.
[0128] The criterion for similar proportions is that the difference in the distribution ratio of the two color levels within a continuous zone is less than a preset balance threshold, which is usually set to 15%-20%. When the difference in the proportion between the starting and ending color levels is within this range, a patterned fill strategy can better represent the intermediate transition state of the gradient.
[0129] In one optional implementation, the preset pattern selection strategy is dynamically determined based on the gradient direction and visual effect requirements. For horizontal gradients, vertical stripe patterns are preferred, and for vertical gradients, horizontal stripe patterns are preferred, to enhance the visual perception of the gradient direction. For example, when processing a horizontal gradient map for a sunrise effect, in continuous sections near the horizon, areas with similar proportions of orange and blue will use alternating vertical stripe patterns, with different color levels filled in the upper and lower rows within each 2×2 standard unit cell.
[0130] In one alternative implementation, the pattern fill density control mechanism adaptively adjusts according to the size of the standard unit cell. Smaller units use simple alternating patterns, while larger units can support more complex geometric pattern designs. For example, for a 3×3 pixel standard unit cell, a centrally symmetrical cross pattern can be used, with the center and four corner points filled with the starting color level value, and the remaining positions filled with the ending color level value, creating a balanced visual effect.
[0131] In a specific application, when processing a texture containing a sea-sky gradient effect, the terminal device detected multiple consecutive partitions with similar proportions in the intermediate transition area, with sea blue and sky blue accounting for 52% and 48% respectively, satisfying the condition of similar proportions. At this point, the terminal device selected a checkerboard pattern as the filling strategy. Within each 2×2 standard unit cell, the diagonally opposite pixels were filled with sea blue and sky blue respectively, creating a subtle transition effect and making the entire gradient area appear as a natural color blend.
[0132] In a texture processing method provided in one embodiment of this application, the preset pattern includes a diagonal distribution pattern, a checkerboard distribution pattern, and / or a center distribution pattern.
[0133] The method provided in this embodiment enables a variety of pattern selection options, allowing the selection of the most suitable fill pattern based on different gradient types and visual requirements, thereby significantly improving the adaptability of texture processing and the visual quality of the final rendering effect.
[0134] The above plan will be explained in detail below.
[0135] The diagonal pattern is a fill pattern that alternates between two color levels along the diagonal within a standard unit cell. This pattern design enhances the naturalness of color transitions while maintaining a sense of gradient direction, through the visual guidance of the diagonal.
[0136] In one optional implementation, the diagonal pattern is specifically achieved by dividing a standard unit cell into two triangular regions along either the main diagonal or the secondary diagonal, with each triangular region filled with a different color level value. For example, in a 2×2 pixel standard unit cell, the pixels in the upper left and lower right corners are filled with the starting color level value, while the pixels in the upper right and lower left corners are filled with the ending color level value, creating a clear diagonal distribution effect.
[0137] In one optional implementation, the diagonal distribution direction selection mechanism adaptively adjusts based on the main direction of the gradient. When the gradient direction is from the upper left to the lower right, a main diagonal distribution consistent with the gradient direction is selected; when the gradient direction is from the upper right to the lower left, a secondary diagonal distribution is selected. For example, when processing a light and shadow map transitioning from a bright area in the upper left corner to a dark area in the lower right corner, the terminal device will select a main diagonal distribution pattern so that the color distribution within each standard unit cell is consistent with the overall light direction.
[0138] The checkerboard pattern is a fill pattern that alternates between two color levels according to a checkerboard layout. This pattern has a high degree of symmetry and regularity, and can produce a visually uniform blending effect, making it suitable for scenes with two color levels filled in similar proportions.
[0139] In an optional implementation, the chessboard pattern is achieved by allocating color levels based on the parity of pixel coordinates. When the sum of the pixel coordinates is odd, the starting color level is filled; when it is even, the ending color level is filled. For example, in a standard 3×3 pixel grid, pixels with coordinates (0,0), (0,2), (1,1), (2,0), and (2,2) are filled with one color level, while the remaining positions are filled with another color level, forming a standard chessboard pattern.
[0140] In one alternative implementation, the size scaling strategy of the chessboard pattern is dynamically adjusted according to the size of the standard unit cell. Larger units can support chessboard cells of 2×2 or larger, while smaller units use a single-pixel chessboard distribution. For example, when the standard unit cell is 4×4 pixels, it can be divided into four 2×2 sub-regions. Each sub-region maintains a consistent color, while the sub-regions are alternately filled with different color levels according to the chessboard pattern.
[0141] The central distribution pattern uses either concentric circles or a radial distribution of color levels as a fill mode, based on the center of the standard unit grid. This pattern design can create a focusing effect and is suitable for gradient processing scenarios that require highlighting the central area or creating a radiating effect.
[0142] In one optional implementation, the central distribution pattern is specifically implemented by calculating the distance from the pixel to the center point and assigning color level values. Pixels closer to the center are filled with one color level value, and pixels farther away are filled with another color level value. For example, in a standard 3×3 pixel unit, the center pixel and its four neighboring pixels are filled with the starting color level value, and the four corner pixels are filled with the ending color level value, forming a radial distribution effect with the center as the core.
[0143] In an optional implementation, the radius control mechanism for the center distribution allows the size of the central region to be adjusted according to filling requirements, controlling the distribution ratio of the two color levels by setting different distance thresholds. For example, when it is necessary to emphasize the central color, the radius of the central region can be increased, allowing more pixels to fill the central color level value; when it is necessary to highlight the edge transition, the radius of the central region can be decreased, increasing the proportion of the edge color level value.
[0144] In a specific application, when processing a texture containing multiple circular light spots, the terminal device detects continuous partitions with similar ratios between the starting and ending color level values at the edge of the light spots. In this case, it automatically selects the central distribution pattern for filling. Within each standard unit cell, the central and adjacent pixels are filled with brighter color levels, while the edge pixels are filled with darker color levels, creating a natural halo transition effect. This allows the processed texture to exhibit realistic lighting gradients during rendering.
[0145] In a texture processing method provided in one embodiment of this application, the detection of the gradient region of the standard unit cell includes: Step S91: When multiple independent gradient regions are detected, process each gradient region in parallel. Step S92: For the overlapping parts of adjacent gradient regions, apply mixed weights to perform boundary fusion processing to obtain the fusion processing result.
[0146] The method provided in this embodiment enables parallel processing of various regions and effective handling of boundary overlap between regions in complex texture scenes with multiple independent gradient regions. This improves processing efficiency and image quality continuity, and avoids visual discontinuity caused by inconsistent processing between regions.
[0147] The above plan will be explained in detail below.
[0148] In step S91, when multiple independent gradient regions are detected, each gradient region is processed in parallel.
[0149] Among them, independent gradient regions are areas that are separate from each other and not adjacent in the texture, and each region has continuous color gradation characteristics.
[0150] In an alternative implementation, an independent gradient region refers to a set of unconnected regions identified through connectivity analysis. These regions are spatially separated and each contains a complete sequence of gradient changes. For example, in a texture containing multiple circular gradient effects, each circular gradient region is an independent gradient region with clear spatial intervals between them.
[0151] In an alternative implementation, parallel processing refers to allocating a separate processing thread or process to each independent gradient region, while simultaneously executing the same detection and processing algorithms. This approach fully utilizes the computing power of multi-core processors, significantly improving overall processing speed. For example, when five independent gradient regions are detected, the terminal device can launch five parallel processing tasks, each task responsible for handling the color gradation analysis and unit grid marking of a specific region.
[0152] In step S92, for the overlapping parts of adjacent gradient regions, a hybrid weight is applied to perform boundary fusion processing to obtain the fusion processing result.
[0153] Among them, the overlapping part of adjacent gradient regions is the area where two or more gradient regions intersect at the boundary, and a unified processing strategy is required to ensure visual continuity.
[0154] In an alternative implementation, the blending weights are weight coefficients calculated based on the distance of each overlapping pixel to the center of each gradient region. The closer the gradient region is, the greater its influence on the pixel, ensuring a natural boundary transition. For example, when a pixel belongs to the boundary of two gradient regions simultaneously, if the distance of the pixel from the center of the first region is d1 and the distance from the center of the second region is d2, then the weight of the first region is d2 / (d1+d2), and the weight of the second region is d1 / (d1+d2).
[0155] In an optional implementation, the boundary blending process sets the final color level value of each pixel within the overlapping region to a weighted average of the processing results of each related gradient region. This method eliminates the hard segmentation of region boundaries, achieving a smooth visual transition effect. For example, when processing the overlapping boundary of two circular gradient regions, pixels within the overlapping region no longer strictly belong to one region, but are simultaneously influenced by both regions, ultimately presenting a natural blended gradient effect.
[0156] In a specific application, when processing a texture containing three elliptical gradient regions, the terminal device first identifies these three regions as independent through connectivity analysis, and then starts three parallel processing threads to process each region separately. During processing, the system detects a small overlap between the first and second elliptical regions in the lower right corner, and an overlap between the second and third regions in the upper left corner. For these overlapping regions, the terminal device calculates the Euclidean distance from each overlapping pixel to the center of each ellipse, and calculates a weighting coefficient based on the reciprocal of the distance. Finally, the color level value of the overlapping region is set as the weighted average of the processing results of the relevant regions, ensuring the visual continuity of the overall gradient effect.
[0157] In a texture processing method provided in one embodiment of this application, dividing the gradient region into multiple continuous partitions includes: Step S101: Adjust the processing parameters according to the color gradation span of the gradient area; wherein, the processing parameters include the number of consecutive partitions and / or the size of the preset dimensions; Step S102: When the color gradation span exceeds the first preset threshold, increase the number of consecutive partitions and / or increase the preset size.
[0158] The method provided in this embodiment enables the processing parameters to be adaptively adjusted according to the actual color gradation range of the gradient region, thereby achieving an optimal balance between processing accuracy and computational efficiency, and ensuring that gradient regions of different complexities can obtain appropriate processing quality.
[0159] The above plan will be explained in detail below.
[0160] In step S101, the processing parameters are adjusted according to the color gradation span of the gradient region; wherein, the processing parameters include the number of consecutive partitions and / or the size of the preset dimensions.
[0161] The color gradation span is the difference between the maximum and minimum color gradation values within the gradient area, reflecting the intensity of color changes within that area.
[0162] In one alternative implementation, the color gradation span is a key indicator of the complexity of the gradient region; a larger span indicates richer color variations within the region. This value directly affects the accuracy requirements and computational complexity of subsequent processing. For example, a gradient region from pure black (color gradation value 0) to pure white (color gradation value 255) has a color gradation span of 255, which is considered a high-span region; while a region that only varies within a medium grayscale range may only have a color gradation span of 30-50.
[0163] In one optional implementation, the processing parameters are adjusted dynamically based on a comparison between the gradation span and a predefined threshold to determine the processing configuration best suited to the current gradient region characteristics. This adaptive mechanism avoids overprocessing or underprocessing issues that may result from using fixed parameters. For example, when a gentle gradient region with a small gradation span is detected, the terminal device reduces the number of partitions to improve processing efficiency; when encountering a complex gradient with a large gradation span, it increases the number of partitions to ensure processing accuracy.
[0164] In step S102, when the color gradation span exceeds the first preset threshold, the number of consecutive partitions is increased and / or the preset size is increased.
[0165] The first preset threshold is the critical value for determining whether the gradient area needs fine-tuning, and it is usually set as a specific proportion of the color gradation range.
[0166] In an alternative implementation, increasing the number of consecutive zones allows for finer control of gradation transitions within high-span gradient regions. Increasing the number of zones makes the gradation changes within each zone more uniform, avoiding visual abrupt changes caused by large gradation spans. For example, when the gradation span exceeds 100, the original 5 zones may be increased to 8-12 zones, ensuring that the gradation changes within each zone are controlled within a reasonable range.
[0167] In an alternative implementation, increasing the preset size improves processing accuracy by increasing the pixel area of a single processing unit. Larger processing units can contain more pixel information, providing a more robust data foundation for the accurate identification and processing of complex gradients. For example, when encountering highly complex gradient regions, the processing unit can be expanded from 2×2 pixels to 3×3 pixels or even 4×4 pixels to achieve better statistical properties and processing stability.
[0168] In one specific application, when processing a texture area containing a gradient effect from dark blue to bright yellow, the terminal device first calculates the color gradation span of the area to be 180. Since this span exceeds a preset first threshold of 120, the system automatically increases the original 6 consecutive partitions to 10 partitions, while simultaneously increasing the size of the processing unit from the standard 2×2 pixels to 3×3 pixels. Through this parameter adjustment, the terminal device can more accurately capture subtle color changes within this high-span gradient area, resulting in a final processing result exhibiting higher smoothness and visual quality in color transitions.
[0169] In a texture processing method provided in one embodiment of this application, the texture processing result includes: Step S111: Calculate the gradient change rate of the image before and after the filling operation to obtain the gradient change result; Step S112: When the gradient change result does not meet the preset standard, adjust the filling parameters and re-execute the filling process.
[0170] The method provided in this embodiment enables the filling processing quality to be monitored and dynamically optimized in real time through the gradient change rate, ensuring that the final texture processing result maintains the original gradient characteristics while possessing ideal visual continuity, thus avoiding processing quality problems caused by improper parameter settings.
[0171] The above plan will be explained in detail below.
[0172] In step S111, the gradient change rate of the image before and after the filling operation is calculated to obtain the gradient change result.
[0173] The gradient change rate is the degree of change in spatial gradient of the image before and after the padding process, which is used to quantify the effect of the processing operation on preserving the original gradient features.
[0174] In an optional implementation, the gradient change rate is obtained by calculating the difference in gradient fields between the original image and the processed image. This metric objectively reflects whether the filling operation excessively alters the original color transition characteristics, providing a quantitative basis for processing quality assessment. For example, the gradient change rate can be obtained by calculating the gradient vectors of the original image and the processed image in the horizontal and vertical directions and statistically analyzing the difference distribution between them.
[0175] In an optional implementation, the gradient change result is a comprehensive index derived from the statistical differences in gradients across all pixels within a defined evaluation region. This result reflects the degree to which the filling process affects the smoothness and continuity of the image; a smaller value indicates a more ideal processing effect. For example, when the gradient change rate is below 0.1, it indicates that the filling process has well preserved the original gradient features; when the value exceeds 0.3, there may be overprocessing or improper parameters.
[0176] In step S112, if the gradient change result does not meet the preset standard, the filling parameters are adjusted and the filling process is re-executed.
[0177] The preset standard is a threshold standard for judging whether the filling process is qualified, and it is set based on the quality requirements of different application scenarios.
[0178] In an optional implementation, adjusting the fill parameters includes modifying the fill ratio, adjusting the fill pattern distribution density, or changing the fill intensity. Fine-tuning these parameters can reduce interference with the original gradient features while maintaining the processing effect. For example, when the gradient change rate is too high, the fill intensity can be reduced or a gentler fill pattern can be used to reduce visual impact.
[0179] In an alternative implementation, re-performing the filling process means processing the same region again using adjusted parameters. This iterative optimization mechanism ensures that the final result meets preset quality standards. For example, the terminal device may need to perform 2-3 rounds of parameter adjustments and reprocessing until the gradient change rate drops to an acceptable range.
[0180] In one specific application, when processing a texture containing a subtle cloud gradient effect, the terminal device initially calculated a gradient change rate of 0.35 after the first fill operation, exceeding the preset standard of 0.25. The system then reduced the fill intensity from 80% to 60% and adjusted the fill pattern from dense to sparse, before re-performing the fill operation. After this second adjustment, the gradient change rate decreased to 0.22, meeting the quality requirements, and ultimately achieving a result that preserved the original cloud gradient characteristics while maintaining good visual appeal.
[0181] In a texture processing method provided in one embodiment of this application, obtaining a single-channel gradient texture includes: Step S121: Respond to the texture processing request, which includes the path of the texture to be processed; Step S122: Load a single-channel gradient map according to the path of the texture to be processed.
[0182] The method provided in this embodiment enables the texture processing flow to respond to external requests and automatically load specified texture resources, thereby achieving standardization and automation of the processing flow and improving the ease of use and processing efficiency of the system.
[0183] The above plan will be explained in detail below.
[0184] In step S121, a texture processing request is responded to, which includes the path of the texture to be processed.
[0185] Among them, the texture processing request is a processing instruction initiated by an external application or user, which contains the basic parameter information required to perform texture processing.
[0186] In an optional implementation, the texture processing request is transmitted via a structured data packet using a standard interface protocol. This packet contains key information such as the target texture's file path, processing mode, and output format. This standardized request format ensures that processing requests from different sources can be correctly parsed and executed. For example, a typical processing request might include " / textures / gradient_map_01.png" as the texture path and "standard_mode" as the processing mode identifier.
[0187] In an optional implementation, the texture path to be processed is the complete path information pointing to the specific location of the target texture file in the storage system. This path can be either a local file system path or a network resource path, providing the system with accurate location information for accessing texture resources.
[0188] In step S122, a single-channel gradient map is loaded according to the path of the texture to be processed.
[0189] The loading operation involves reading the texture file based on the path information and converting it into a format that the system can process.
[0190] In an optional implementation, the loading process includes steps such as file access permission verification, format compatibility checks, and data integrity verification to ensure that the loaded texture data can be correctly used in subsequent processing flows. This comprehensive loading mechanism avoids processing failures due to file corruption or format incompatibility. For example, the system first checks if the file exists and is readable, then verifies if the file format is a supported image format, and finally checks the integrity of the image data.
[0191] In one alternative implementation, single-channel gradient map loading is the process of converting a multi-channel image into a single-channel grayscale format, providing standardized data input for subsequent gradient analysis and processing. This preprocessing operation simplifies the data structure and improves processing efficiency. For example, when loading an RGB format color gradient map, the system converts it into a single-channel grayscale image using a weighted average or luminance extraction algorithm.
[0192] In one specific application, the terminal device receives a texture processing request from the game engine, specifying the path to the texture file. The system immediately responds to the request, first verifying the file access permissions and existence at that path. After confirming that everything is correct, the loading process begins. During loading, the system detects that the texture is in RGB three-channel format and then applies a standard grayscale conversion algorithm to convert it to a single-channel format. Ultimately, a single-channel texture containing a sunset sky gradient effect is successfully loaded, laying the data foundation for subsequent gradient analysis and processing.
[0193] This exemplary embodiment also discloses a texture processing apparatus. Figure 6 This is a diagram illustrating the composition of a texture processing apparatus according to an exemplary embodiment of this disclosure. Figure 6 As shown, the device includes: The acquisition module is used to acquire a single-channel gradient map and convert the single-channel gradient map into a pixel matrix; The recognition module is used to perform a gridded scan of the pixel matrix based on a preset size and identify standard unit cells with consistent color level values. The determination module is used to detect the gradient region of the standard unit cell and determine the starting and ending color level values within the gradient region. The partitioning module is used to divide the gradient region into multiple continuous partitions according to the distribution ratio of the starting color level value and the ending color level value within the gradient region. The fill module is used to perform fill processing on the pixels in the standard unit cells within the continuous partition to obtain the texture processing result.
[0194] Optionally, the pixel matrix is scanned in a grid pattern based on a preset size to identify standard units with consistent color level values, including: Perform non-overlapping scanning of the pixel matrix according to a preset step size; Check if the grayscale values of all pixels within each candidate region are the same; Candidate regions with the same grayscale value are marked as standard unit cells, and their coordinate positions are recorded.
[0195] Optionally, the gradient region of the standard unit cell is detected, and the starting and ending color level values within the gradient region are determined, including: Sliding detection is performed using a preset number of continuous standard unit grids as the detection window; Calculate the difference between the maximum and minimum values of the color level represented by the standard unit cell within the detection window; When the difference is greater than 0 and does not exceed the preset threshold, and there are multiple different color level values within the detection window, the detection window is marked as a gradient area, and the minimum value is determined as the starting color level value, and the maximum value is determined as the ending color level value.
[0196] Optionally, the preset quantity ranges from 5 to 15 standard units.
[0197] Optionally, based on the distribution ratio of the starting and ending color levels within the gradient area, the gradient area is divided into multiple continuous zones, including: Count the number of standard unit grids corresponding to the starting and ending color level values within the gradient area; Based on the proportion of standard unit cells corresponding to the initial color level value, the gradient area is divided into continuous zones along the gradient direction.
[0198] Optionally, when the preset size is 2×2 pixels, the gradient area is divided into 5 consecutive partitions; when the preset size is 3×3 pixels, the gradient area is divided into 10 consecutive partitions.
[0199] Optionally, padding is performed on pixels within a standard unit cell in a contiguous partition, including: For a continuous partition where the starting color level value is dominant, fill most of the pixels in the standard unit cell with the starting color level value and fill a small number of pixels with the ending color level value. For a continuous partition where the ending color level value dominates, fill most of the pixels in the standard unit cell with the ending color level value and fill a small number of pixels with the starting color level value. For continuous partitions where the ratio of the starting and ending color levels is similar, the pixels in the standard unit cell are filled with the starting and ending color levels respectively according to a preset pattern.
[0200] Optionally, the preset pattern includes a diagonal distribution pattern, a checkerboard distribution pattern, and / or a center distribution pattern.
[0201] Optionally, after the gradient region of the standard unit cell, the following may also be included: When multiple independent gradient regions are detected, each gradient region is processed in parallel. For the overlapping parts of adjacent gradient regions, a hybrid weight is applied to perform boundary fusion processing to obtain the fusion result.
[0202] Optionally, before dividing the gradient region into multiple consecutive partitions, the method further includes: Adjust the processing parameters according to the color gradation span of the gradient area; the processing parameters include the number of consecutive partitions and / or the size of the preset dimensions; When the color gradation span exceeds the first preset threshold, increase the number of consecutive partitions and / or increase the preset size.
[0203] Optionally, before obtaining the texture processing result, the following steps are also included: Calculate the gradient change rate of the image before and after the fill operation to obtain the gradient change result; If the gradient change result does not meet the preset standard, adjust the filling parameters and re-execute the filling process.
[0204] Optionally, before obtaining the single-channel gradient map, the following steps are also included: Respond to the texture processing request, which includes the path to the texture to be processed; Load a single-channel gradient map based on the path of the texture to be processed.
[0205] The method provided in this embodiment enables accurate identification of the boundaries and features of gradient regions through gridded scanning technology, and precise region division based on the distribution ratio of the starting and ending color level values. This achieves high-efficiency and high-quality processing of single-channel gradient maps, effectively solving the technical problems of gradient region identification accuracy and processing efficiency in traditional mapping methods.
[0206] The specific details of each module unit in the above embodiments have been described in detail in the corresponding texture processing method. In addition, the texture processing device also includes other unit modules corresponding to the display control method, so they will not be described again here.
[0207] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0208] Figure 7 This is a schematic diagram of the structure of a computer-readable storage medium according to an exemplary embodiment of the present disclosure. Figure 7 As shown, a program product 1100 according to an embodiment of the present disclosure is described, on which a computer program is stored, which, when executed by a processor, implements the method steps of the above-described texture processing method. The method provided by this embodiment enables accurate identification of the boundaries and features of gradient regions using mesh scanning technology, and precise region division based on the distribution ratio of the starting and ending color level values, thereby achieving high-efficiency and high-quality processing of single-channel gradient textures, effectively solving the technical problems of gradient region identification accuracy and processing efficiency in traditional texture processing methods.
[0209] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable storage media may transmit, propagate, or transfer programs for use by or in connection with an instruction execution system, apparatus, or device.
[0210] The program code contained in a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, radio frequency, or any suitable combination thereof.
[0211] The following is combined Figure 8 The electronic device 1000 in this exemplary embodiment is described. The electronic device 1000 is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0212] See Figure 8As shown, the electronic device 1000 is presented in the form of a general-purpose computing device. The components of the electronic device 1000 may include, but are not limited to: at least one processor 1010, at least one memory 1020, a bus 1030 connecting different system components (including processor 1010 and memory 1020), and a display unit 1040.
[0213] The memory 1020 stores program code that can be executed by the processor 1010, enabling the processor 1010 to execute the specific method steps of the above-described texture processing method by executing the executable instructions. The method provided in this embodiment enables accurate identification of the boundaries and features of gradient regions using mesh scanning technology, and precise region division based on the distribution ratio of the starting and ending color level values. This achieves high-efficiency and high-quality processing of single-channel gradient textures, effectively solving the technical problems of gradient region identification accuracy and processing efficiency in traditional texture processing methods.
[0214] The electronic device may also include: a power supply component configured to manage the power of the electronic device; a wired or wireless network interface configured to connect the electronic device to a network; and an input / output (I / O) interface. The electronic device can operate on an operating system stored in memory, such as Android, iOS, Windows, Mac OS X, Unix, Linux, FreeBSD, or similar.
[0215] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, portable hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, electronic device, or network device, etc.) to execute the method according to the embodiments of the present invention.
[0216] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0217] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A texture processing method, characterized in that, include: Obtain a single-channel gradient map and convert the single-channel gradient map into a pixel matrix; The pixel matrix is scanned in a grid pattern based on a preset size to identify standard unit cells with consistent color level values. Detect the gradient region of the standard unit cell and determine the starting and ending color level values within the gradient region; Based on the distribution ratio of the starting color level value and the ending color level value within the gradient area, the gradient area is divided into multiple continuous partitions; Filling processing is performed on the pixels in the standard unit cells within the continuous partition to obtain the texture processing result.
2. The method according to claim 1, characterized in that, The step of performing a gridded scan of the pixel matrix based on a preset size to identify standard unit cells with consistent color level values includes: The pixel matrix is scanned without overlap according to the preset size step size; Check if the grayscale values of all pixels within each candidate region are the same; Candidate regions with the same grayscale value are marked as standard unit cells, and their coordinate positions are recorded.
3. The method according to claim 1, characterized in that, The step of detecting the gradient region of the standard unit cell and determining the starting and ending color level values within the gradient region includes: Sliding detection is performed using a preset number of continuous standard unit grids as the detection window; Calculate the difference between the maximum and minimum values of the color level values represented by the standard unit grid within the detection window; When the difference is greater than 0 and does not exceed a preset threshold, and there are multiple different color level values within the detection window, the detection window is marked as a gradient region, the minimum value is determined as the starting color level value, and the maximum value is determined as the ending color level value.
4. The method according to claim 3, characterized in that, The preset quantity ranges from 5 to 15 standard unit cells.
5. The method according to claim 1, characterized in that, The gradient region is divided into multiple continuous zones based on the distribution ratio of the starting and ending color levels within the gradient region, including: Count the number of standard unit cells corresponding to the starting and ending color level values within the gradient area; Based on the proportion of standard unit cells corresponding to the initial color level value, the gradient region is divided into continuous partitions along the gradient direction.
6. The method according to claim 5, characterized in that, When the preset size is 2×2 pixels, the gradient area is divided into 5 consecutive partitions; when the preset size is 3×3 pixels, the gradient area is divided into 10 consecutive partitions.
7. The method according to claim 1, characterized in that, The filling process performed on pixels in the standard unit cells within the continuous partition includes: For a continuous partition where the starting color level value is dominant, most pixels in the standard unit cell are filled with the starting color level value, and a small number of pixels are filled with the ending color level value. For a continuous partition where the ending color level value dominates, most pixels in the standard unit cell are filled with the ending color level value, and a small number of pixels are filled with the starting color level value. For continuous partitions where the ratio of the starting color level value to the ending color level value is similar, the pixels in the standard unit cell are filled with the starting color level value and the ending color level value respectively according to a preset pattern.
8. The method according to claim 7, characterized in that, The preset pattern includes a diagonal distribution pattern, a checkerboard distribution pattern, and / or a center distribution pattern.
9. The method according to claim 1, characterized in that, After detecting the gradient region of the standard unit cell, the method further includes: When multiple independent gradient regions are detected, each gradient region is processed in parallel. For the overlapping parts of adjacent gradient regions, a hybrid weight is applied to perform boundary fusion processing to obtain the fusion result.
10. The method according to claim 1, characterized in that, Before dividing the gradient region into multiple consecutive partitions, the method further includes: The processing parameters are adjusted according to the color gradation span of the gradient region; wherein, the processing parameters include the number of consecutive partitions and / or the size of the preset dimensions; When the color gradation span exceeds a first preset threshold, the number of consecutive partitions is increased and / or the preset size is increased.
11. The method according to claim 1, characterized in that, Before obtaining the texture processing result, the following is also included: Calculate the gradient change rate of the image before and after the fill operation to obtain the gradient change result; If the gradient change result does not meet the preset standard, adjust the filling parameters and re-execute the filling process.
12. The method according to claim 1, characterized in that, Before obtaining the single-channel gradient map, the following steps are also included: Respond to a texture processing request, the texture processing request containing the path of the texture to be processed; The single-channel gradient map is loaded according to the path of the texture to be processed.
13. A texture processing apparatus, characterized in that, include: The acquisition module is used to acquire a single-channel gradient map and convert the single-channel gradient map into a pixel matrix; The recognition module is used to perform a gridded scan of the pixel matrix based on a preset size and identify standard unit cells with consistent color level values. The determination module is used to detect the gradient region of the standard unit cell and determine the starting and ending color level values within the gradient region. The partitioning module is used to divide the gradient region into multiple continuous partitions according to the distribution ratio of the starting color level value and the ending color level value within the gradient region. The fill module is used to perform fill processing on the pixels in the standard unit cells within the continuous partition to obtain the texture processing result.
14. A computer-readable storage medium, characterized in that, The device contains a computer program that, when executed by a processor, implements the method of any one of claims 1 to 12.
15. An electronic device, characterized in that, include: Memory, which stores computer programs; A processor that executes the computer program to implement the method of any one of claims 1 to 12.