Method for processing a map
Patent Information
- Application Number
- CN202611097334.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-10-30
AI Technical Summary
[0002]相关技术中,游戏引擎对贴图进行缩放或压缩等有损处理时,通常仅在整张贴图粒度上计算全局质量指标,导致开发者难以定位最值得关注的质量问题,无法基于可见性优先级指导优化决策,一定程度上影响了贴图资产质量管控的效率和准确性
[0008]另一方面,本申请实施例提供一种计算机程序产品,包括计算机指令,所述计算机指令被处理器执行时实现如上任一实施例所述的贴图的处理方法。
Smart Images

Figure CN123015799A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer graphics processing technology, specifically to a method for processing textures. Background Technology
[0002] In related technologies, when game engines perform lossy processing such as scaling or compression on textures, they usually only calculate global quality indicators at the granular level of the entire texture. This makes it difficult for developers to locate the most concerning quality issues and to guide optimization decisions based on visibility priorities, which to some extent affects the efficiency and accuracy of texture asset quality control. Summary of the Invention
[0003] This application provides a texture processing method, texture processing apparatus, electronic device, computer-readable storage medium, and computer program product. By determining a target model associated with a first target texture, the first target texture is scaled and / or compressed to obtain a second target texture. Then, based on the mapping position of continuous regions on the model surface on the second target texture, and combined with texture differences and visibility parameters corresponding to each region, the quality of the second target texture is evaluated region by region. This refines the quality evaluation granularity from the entire texture to the level of continuous regions on the model surface, achieving precise regional positioning of quality problems and improving the targeting of quality optimization.
[0004] On one hand, embodiments of this application provide a method for processing textures, the method comprising: Identify a target model in the target game that is associated with a first target texture, wherein the target material of the target model includes the first target texture; The first target texture is processed into an asset to obtain a second target texture, wherein the asset processing includes scaling and / or compression. Determine the mapping position of each continuous region on the surface of the target model in the second target texture, and obtain the texture mapping region corresponding to each continuous region; Based on the differences between the first target texture and the second target texture in each texture mapping region, and the visibility parameters of the continuous regions corresponding to each texture mapping region, the quality of the second target texture in each texture mapping region is estimated, wherein the visibility parameters are used to indicate the degree to which the continuous regions on the target model are occluded.
[0005] On the other hand, embodiments of this application provide a texture processing apparatus, the apparatus comprising: The first determining module determines a target model in the target game that is associated with a first target texture, wherein the target material of the target model includes the first target texture; The processing module is used to perform assetization processing on the first target texture to obtain a second target texture, wherein the assetization processing includes scaling processing and / or compression processing; The second determining module is used to determine the mapping position of each continuous region on the surface of the target model in the second target texture, and to obtain the texture mapping region corresponding to each continuous region; An estimation module is configured to estimate the quality of the second target texture in each of the texture mapping regions based on the difference between the first target texture and the second target texture in each of the texture mapping regions, and the visibility parameters of the continuous regions corresponding to each of the texture mapping regions, wherein the visibility parameters are used to indicate the degree to which the continuous regions on the target model are occluded.
[0006] On the other hand, embodiments of this application provide an electronic device, which includes a processor and a memory. The memory stores a computer program, and the processor executes the texture processing method as described in any of the above embodiments by calling the computer program stored in the memory.
[0007] On the other hand, embodiments of this application provide a computer-readable storage medium storing a computer program adapted for loading by a processor to execute the texture processing method as described in any of the above embodiments.
[0008] On the other hand, embodiments of this application provide a computer program product, including computer instructions, which, when executed by a processor, implement the texture processing method as described in any of the above embodiments.
[0009] The texture processing method, texture processing apparatus, computer-readable storage medium, electronic device, and computer program product provided in this application embodiment determine the target model associated with the first target texture in the target game, perform assetization processing including scaling and / or compression processing on the first target texture to obtain the second target texture, determine the mapping position of each continuous region on the surface of the target model in the second target texture to obtain the texture mapping region corresponding to each continuous region, and then estimate the quality of the second target texture in each texture mapping region based on the difference between the first target texture and the second target texture in each texture mapping region, and the visibility parameters of the continuous regions corresponding to each texture mapping region. This realizes a regional texture quality evaluation that combines three-dimensional geometric mapping relationship and visibility dimension. Compared to solutions that only calculate global quality metrics at the entire texture granularity and cannot distinguish quality differences between different regions, this approach refines the evaluation granularity of texture quality loss from the entire texture to the level of continuous regions corresponding to parts of the model surface. This achieves a certain degree of regionalized location of quality problems, improving the targeting of quality optimization. Furthermore, by introducing a visibility parameter as a weighting factor, quality problems in high-visibility areas are prioritized, while quality losses in low-visibility areas are reasonably downweighted. This enhances the scientific and rational nature of resource optimization decisions, saves video memory and bandwidth, reduces the workload of manual review, and thus, to a certain extent, ensures the overall balance between image quality and performance in the game, improving the efficiency of texture quality evaluation and optimization in large-scale game projects. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a schematic flowchart illustrating the texture processing method provided in the embodiments of this application.
[0012] Figure 2 This is a schematic flowchart illustrating the texture processing method provided in the embodiments of this application.
[0013] Figure 3 This is a schematic diagram of the inverted index and delayed callback data structure provided in the embodiments of this application.
[0014] Figure 4 This is a schematic diagram of UV island division and pixel mapping provided in an embodiment of this application.
[0015] Figure 5 This is a schematic diagram of the calculation of perception-weighted loss provided in an embodiment of this application.
[0016] Figure 6 This is a schematic diagram of the visible baking process provided for an embodiment of this application.
[0017] Figure 7 This is a schematic diagram of cosine-weighted hemispherical sampling provided in an embodiment of this application.
[0018] Figure 8 This is a schematic diagram of the visibility-weighted data flow provided in an embodiment of this application.
[0019] Figure 9 This is a schematic diagram of the structure of the texture processing device provided in the embodiments of this application.
[0020] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0021] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0022] This application provides a method for processing textures, a device for processing textures, a computer-readable storage medium, an electronic device, and a computer program product. Specifically, the texture processing method of this application can be executed by an electronic device, which can be a terminal or a server. The terminal can be a smartphone, tablet, laptop, smart TV, wearable smart device, smart vehicle terminal, etc. The terminal can also include a client, which can be a browser client, instant messaging client, or mini-program, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0023] It should be noted that, in this embodiment, the entity executing the texture processing method can be a terminal device or a server. The terminal device can be a local terminal device or a client device in a cloud platform. This embodiment does not limit the type of the entity executing the texture.
[0024] For example, when the texture processing method runs on a terminal device, the terminal device may include a display screen and a processor. The display screen is used to present a graphical user interface (GUI) and receive instructions generated by the user interacting with the GUI. The processor is used to store applications, generate the GUI, respond to instructions, and control the display of the GUI on the display screen. When the user operates the GUI through the display screen, the GUI can control the local content of the terminal device in response to the received operation instructions. The terminal device can provide the GUI to the user in various ways, such as rendering it on the terminal device's display screen or presenting the GUI through holographic projection.
[0025] For example, when the texture processing method runs on a server, it can be implemented and executed based on a cloud system. The cloud system includes servers and client devices. The application's runtime and the graphical user interface (GUI) presentation are separate. The storage and execution of the texture processing method are completed on the server. The GUI presentation, however, is completed on the client. The client is primarily used for data reception, transmission, and GUI presentation. For instance, the client could be a display device with data transmission capabilities located close to the user, such as a mobile terminal, television, computer, PDA, personal digital assistant, or head-mounted display. However, the terminal device performing data processing is the cloud server. During this process, the user operates the client to send instructions to the server. The server executes the instructions, encodes and compresses the GUI data, returns it to the client via the network, and finally, the client decodes and outputs the GUI.
[0026] It should be noted that, in this embodiment, the entity executing the image processing method can be a terminal device or a server. The terminal device can be a local terminal device or a client device in the aforementioned cloud system. This embodiment does not limit the type of the entity executing the method.
[0027] The technical solution of this application will be described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0028] With the rapid development of the game industry and the increasing demands of players for game graphics quality, the resource scale of large-scale AAA game projects has grown exponentially. During game development, texture resources, as the carrier of game visual presentation, typically occupy a large proportion of the game package and runtime video memory. To achieve a reasonable balance between game graphics performance and hardware performance consumption, game engines usually need to perform two types of lossy processing on texture resources during asset construction: the first is mipmap scaling, which reduces the texture from its original resolution to the target resolution based on the target platform's hardware configuration and graphics settings to reduce video memory usage and bandwidth consumption; the second is texture compression, which uses hardware compression formats such as Block Compression (BC) or Adaptive Scalable Texture Compression (ASTC) to compress the storage bits per pixel from 32 bits to 4 to 8 bits to reduce video memory usage and bandwidth requirements. Both of these processing methods introduce irreversible image quality loss. How to effectively assess the quality loss caused by these processing methods has become a key issue in texture asset management.
[0029] In related technologies, texture quality assessment typically employs three main approaches. The first approach is the global image quality metric method. This involves calculating the statistical difference between the original and processed images of all pixels in the entire texture using image quality evaluation metrics such as Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index (SSIM), outputting a scalar value as the quality metric. The second approach is runtime texture analysis tools. Some graphics debugging tools allow developers to capture frames at runtime and examine the pixel values of textures one by one. Artists can manually select and review each texture during game execution for quality loss assessment. The third approach is offline batch processing tools. Some engines provide offline batch processing tools that calculate texture quality metrics in batches after resource building is complete, presenting the quality loss assessment results in a text report.
[0030] However, a single texture may be mapped to multiple different areas of a model. The above solution only outputs quality metrics at the overall texture granularity, failing to refine to the level of specific areas on the model's surface. This makes it impossible for artists to pinpoint which area of the model has a substandard texture. Furthermore, the solution lacks a connection to 3D geometry, calculating only in 2D image space without considering the mapping relationship of the texture to the 3D model, making it impossible to trace quality issues back to specific surface areas. Additionally, if a high-resolution texture is mapped to a model's recessed, folded, or inner surface, most texels are actually occluded by the model's own geometry, making them almost invisible to the player. The above solution treats quality loss in low-visibility areas equally, failing to differentiate the importance of quality loss in high-visibility and low-visibility areas.
[0031] Furthermore, the above solutions lack automated batch sorting and decision support. In large game projects containing tens of thousands of textures, developers need to manually review the quality of each texture, making it difficult to quickly identify the most critical quality issues. This results in low efficiency and rationality in texture resource optimization, making it difficult to achieve the optimal balance between image quality and performance.
[0032] For the above issues, please refer to Figure 1 , Figure 1 This is a flowchart illustrating a texture processing method provided in an embodiment of this application. It should be noted that the steps shown may be executed in a logical order different from that shown in the flowchart. The method includes: 110: Determine the target model in the target game that is associated with the first target texture, wherein the target material of the target model includes the first target texture; 120: Perform assetization processing on the first target texture to obtain the second target texture, wherein assetization processing includes scaling and / or compression processing; 130: Determine the mapping position of each continuous region on the surface of the target model in the second target texture, and obtain the texture mapping area corresponding to each continuous region; 140: Based on the difference between the first target texture and the second target texture in each texture mapping region, and the visibility parameters of the continuous regions corresponding to each texture mapping region, estimate the quality of the second target texture in each texture mapping region, wherein the visibility parameters are used to indicate the degree to which continuous regions on the target model are occluded.
[0033] Specifically, in related technologies, texture quality assessment is usually performed at the whole texture granularity, failing to refine to the level of regions corresponding to specific parts of the model surface. It also fails to consider the mapping relationship of textures on the 3D model and the visibility differences caused by geometric occlusion. This makes it difficult for developers to locate the texture areas most in need of optimization, resulting in low efficiency and rationality in texture resource optimization, impacting the overall image quality and performance of the game. Based on the above problems, this application provides a texture processing method. First, a target model associated with a first target texture is determined. The first target texture is then assetized to obtain a second target texture. Next, the mapping position of each continuous region on the surface of the target model on the second target texture is determined, obtaining the corresponding texture mapping region. Finally, based on the differences between the original texture and the processed texture in each mapping region, and the visibility parameters of each continuous region, the quality of the second target texture in each mapping region is estimated.
[0034] In some embodiments, the target game can be understood as a game project undergoing resource building and quality assessment, including game resources such as 3D models, textures, and materials.
[0035] In some embodiments, the first target texture can be understood as the original high-resolution texture resource that has not been assetized, which is the original material created by artists, etc., i.e., the original texture.
[0036] In some embodiments, the target model can be understood as a three-dimensional model that references the first target texture in the material, and is the carrier in which the first target texture is actually mapped in the game.
[0037] In some embodiments, the target material can be understood as the material resource used on the target model, which specifies the texture used on the model surface and rendering-related parameters.
[0038] In some embodiments, assetization, or asset construction, can be understood as the process of converting raw texture resources into a resource format that can be directly used by the game engine. This mainly includes scaling and compression. Scaling is used to adjust the texture resolution to adapt to different image quality levels, while compression is used to reduce the texture's storage space and video memory usage. For example, multi-level in-parvo map (Mipmap) scaling is used to progressively reduce the original texture size by a factor of 2, generating a sequence of images with decreasing resolution. Hardware compression formats such as BC or ASTC are also used to compress the storage per pixel from 32 bits to 4 to 8 bits.
[0039] In some embodiments, the second target texture can be understood as a texture resource that has been assetized and can be directly used for game operation.
[0040] In some embodiments, a continuous region can be understood as a continuous geometric region on the model surface defined by edge connectivity, i.e., a UV island. Each continuous region corresponds to an independent part of the model surface, such as the character's face, hands, soles of shoes, etc.
[0041] In some embodiments, the texture mapping region can be understood as the pixel region corresponding to a continuous region on the model surface in the texture space, which is the mapping result between the model surface part and the texture pixel.
[0042] In some embodiments, the visibility parameter can be understood as a parameter used to quantify the degree to which a continuous area on the model surface is occluded by other parts of itself. The higher the degree of occlusion, the lower the visibility of that area to the player, and the smaller the impact of quality loss on the visual experience.
[0043] In some embodiments, quality can be understood as the degree of image quality retention after the texture has been assetized compared to the original texture. Higher quality means that the difference between the processed texture and the original texture is smaller and the image quality loss is less.
[0044] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: In all resources of the target game, find all 3D models whose materials include the first target texture, and identify the 3D model as the target model associated with the first target texture.
[0045] Subsequently, the first target texture undergoes assetization processing. This assetization includes scaling the texture from its original resolution to the target resolution to reduce memory usage and bandwidth consumption, or compression processing to reduce the storage per pixel from high bit depth to low bit depth, further reducing memory and bandwidth requirements. Scaling and compression can also be performed simultaneously. The resulting second target texture is then obtained. For example, the texture might be scaled down from its original resolution of 2048×2048 to a target resolution of 1024×1024, and the storage per pixel might be compressed from 32 bits to 4-8 bits.
[0046] Next, the surface of the target model is divided into regions, with each continuous region corresponding to an independent part of the model surface. Then, the pixel position of each continuous region on the second target texture is determined, resulting in the texture mapping area corresponding to each continuous region, thus realizing a one-to-one correspondence between the parts of the model surface and the texture area.
[0047] Then, the pixel difference between the first target texture and the second target texture in each texture mapping area is calculated. At the same time, the visibility parameter of the continuous area corresponding to each texture mapping area is obtained. The visibility parameter is used to represent the degree to which the corresponding continuous area on the surface of the target model is occluded by other parts of the model itself. The higher the degree of occlusion, the lower the visibility parameter, and the lower the degree of occlusion, the higher the visibility parameter.
[0048] Finally, by combining the pixel differences and visibility parameters of each region, the quality of the second target texture in each texture mapping region is estimated, and the quality evaluation results of each region are obtained.
[0049] Thus, in this embodiment of the application, by determining the target model associated with the first target texture in the target game, the first target texture is subjected to assetization processing including scaling and / or compression to obtain the second target texture. The mapping position of each continuous region on the surface of the target model in the second target texture is determined to obtain the texture mapping region corresponding to each continuous region. Then, based on the difference between the first target texture and the second target texture in each texture mapping region, and the visibility parameters of the continuous regions corresponding to each texture mapping region, the quality of the second target texture in each texture mapping region is estimated. This achieves regional texture quality evaluation that combines three-dimensional geometric mapping relationship and visibility dimension. Compared to solutions that only calculate global quality metrics at the entire texture granularity and cannot distinguish quality differences between different regions, this approach refines the evaluation granularity of texture quality loss from the entire texture to the level of continuous regions corresponding to parts of the model surface. This achieves a certain degree of regionalized location of quality problems, improving the targeting of quality optimization. Furthermore, by introducing a visibility parameter as a weighting factor, quality problems in high-visibility areas are prioritized, while quality losses in low-visibility areas are reasonably downweighted. This enhances the scientific and rational nature of resource optimization decisions, saves video memory and bandwidth, reduces the workload of manual review, and thus, to a certain extent, ensures the overall balance between image quality and performance in the game, improving the efficiency of texture quality evaluation and optimization in large-scale game projects.
[0050] In some embodiments provided in this application, the visibility parameter includes a target weight sub-parameter for the second pixel corresponding to each first pixel in each texture mapping region on the surface of the target model, and each target weight sub-parameter is used to indicate the degree to which the corresponding second pixel is occluded by other pixels on the surface of the target model; Step 140 above includes: Based on the difference between the first target texture and the second target texture at each first pixel, the initial pixel loss value of the first target texture and the second target texture at each first pixel is obtained; Determine the target weight sub-parameters of the second pixel corresponding to each first pixel in each texture mapping region on the surface of the target model; The quality of each texture mapping region is estimated based on the initial pixel loss value of each first pixel in each texture mapping region and the target weight sub-parameter corresponding to each first pixel.
[0051] Specifically, in the texture quality assessment process, only a coarse quality assessment at the global or regional level can be achieved, failing to delve into pixel-level quality loss calculations. This results in the inability to reflect the occlusion differences between different pixels within the same region, affecting the accuracy of the quality assessment and failing to accurately reflect the actual image quality differences seen by the player, thus impacting the scientific and rational nature of resource optimization decisions. Based on the above problems, in some embodiments provided in this application, the visibility parameter is refined to the pixel level. A target weight sub-parameter is defined for each first pixel in each texture mapping region, corresponding to a second pixel on the target model surface, to indicate the degree of occlusion of the corresponding second pixel. During quality estimation, the initial pixel loss value of the original texture and the processed texture is first calculated pixel by pixel. Then, the target weight sub-parameter corresponding to each pixel is obtained. Finally, the quality of each texture mapping region is comprehensively estimated by combining the initial pixel loss value and the target weight sub-parameter.
[0052] In some embodiments, the first pixel can be understood as a texture pixel within the texture mapping area, that is, a pixel unit in the second target texture, which is a basic sampling point in the texture space.
[0053] In some embodiments, the second pixel can be understood as a pixel on the surface of the target model, that is, the pixel unit at the geometric position corresponding to the first pixel on the model surface, and has a UV mapping relationship with the first pixel.
[0054] In some embodiments, the target weight sub-parameter can be understood as the visibility weight value corresponding to each second pixel, which is used to quantify the degree to which the second pixel is occluded by other parts of the model, and is a pixel-level visibility quantization result.
[0055] In some embodiments, the initial pixel loss value can be understood as the degree of quality degradation of a single first pixel after assetization, considering only the quality difference of the texture itself and not the visibility factor.
[0056] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: First, the visibility parameter is refined to the pixel level. Each first pixel in each texture mapping region corresponds to a second pixel on the surface of the target model. The visibility parameter for each second pixel corresponds to a target weight sub-parameter. Here, the first pixel is a pixel in the second target texture, and the second pixel is a surface sampling point on the target model surface that has a mapping relationship with the first pixel. Each target weight sub-parameter indicates the degree to which the corresponding second pixel is occluded by other pixels on the target model surface. Through pixel-level parameter definition, a certain degree of refinement in visibility measurement is achieved.
[0057] During quality estimation, the first and second target textures are compared pixel-by-pixel. The difference between the first and second target textures at each first pixel is calculated to obtain the initial pixel loss value for each first pixel. The initial pixel loss value reflects the degree of quality degradation introduced by assetization at the individual pixel level; a higher loss value indicates a more severe loss of image quality.
[0058] Next, for each first pixel in each texture mapping region, the corresponding second pixel on the target model surface is found, and the target weight sub-parameter for each second pixel is obtained to establish the weight correspondence between texture pixels and model surface pixels. The target weight sub-parameter quantitatively describes the degree to which the corresponding pixel position on the model surface is occluded by its own other geometric structures. The higher the degree of occlusion, the lower the weight value of the pixel, and the lower the degree of occlusion, the higher the weight value of the pixel.
[0059] Finally, based on the initial pixel loss value of each first pixel in each texture mapping region and the target weight sub-parameter corresponding to each first pixel, the quality of each texture mapping region is estimated through weighted calculation and other methods.
[0060] Understandably, during the calculation process, the quality loss of high-visibility pixels is fully reflected, while the quality loss of low-visibility pixels is reasonably reduced in weight, resulting in a region quality estimation result that is more in line with the player's actual visual perception.
[0061] Thus, in this embodiment, the initial pixel loss value of each pixel is first calculated based on the pixel difference between the original texture and the assetized texture. Then, the occlusion weight sub-parameter of the corresponding pixel on the model surface is matched for each texture pixel. Finally, the quality estimation of the texture mapping region is completed by combining the initial pixel loss value of each pixel and the corresponding occlusion weight sub-parameter. This achieves pixel-level fine-grained quality assessment. Compared with the scheme that only calculates a single quality index for the entire texture, refining the visibility measurement from the region level to the pixel level can accurately capture the occlusion differences of different pixels in the same region, thereby improving the accuracy of quality assessment to a certain extent and avoiding the errors caused by region-level visibility assessment. This allows the quality estimation results to more accurately reflect the impact of quality problems at different locations on the model surface on the player's visual experience, thereby enhancing the targeting of texture quality optimization to a certain extent and improving the utilization rate of game texture resources and the efficiency of texture quality optimization.
[0062] In some embodiments provided in this application, the step of obtaining the initial pixel loss value of the first target map and the second target map at each first pixel based on the difference between the first target map and the second target map at each first pixel includes: When both the first target texture and the second target texture contain or do not contain an alpha channel, the difference between each first pixel in the first target texture and each first pixel in the second target texture in each color channel, as well as the first target weight corresponding to each color channel, are weighted and summed to obtain the initial pixel loss value for each pixel.
[0063] Specifically, in calculating the initial pixel loss value, all color channels are typically given the same weight. However, different color channels have varying degrees of importance to human visual perception, leading to a discrepancy between the calculated pixel loss value and the actual quality difference perceived by the human eye, thus failing to accurately reflect the impact of pixel loss on the player's visual experience. Based on the above problems, in some embodiments provided in this application, for ordinary color maps with or without alpha channels, the difference between the original and processed textures at corresponding pixels in each color channel is calculated. Then, a corresponding perceptual weight is assigned to each color channel, and finally, the weighted differences of each channel are summed to obtain the initial pixel loss value for each pixel.
[0064] In some embodiments, the alpha channel can be understood as a channel used in the texture to represent the transparency of pixels. A higher alpha channel value indicates that the pixel is less transparent, and a lower value indicates that the pixel is more transparent.
[0065] In some embodiments, a color channel can be understood as an independent data layer that stores information about different color components of an image, including a red channel, a green channel, a blue channel, and an alpha channel.
[0066] In some embodiments, the first target weight can be understood as the perceptual weight coefficient corresponding to each color channel, which is used to reflect the degree of influence of the color channel on the human visual experience. The higher the weight, the greater the impact of the loss of the color channel on the visual experience.
[0067] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: When calculating the initial pixel loss value, the texture type is first determined. If both the first and second target textures are confirmed to be ordinary color textures, for each first pixel, the pixel values of each color channel in both the first and second target textures are extracted, and the difference between two pixel values in the same color channel is calculated. Ordinary color textures may or may not include an alpha channel. Ordinary color textures are the most commonly used texture type in game development and can be used to describe the basic color information of a model's surface.
[0068] In some embodiments, if a normal color map includes an alpha channel, the alpha channel is also used as an independent color channel in the difference calculation to ensure that quality changes in transparency information can be accurately captured.
[0069] Then, a corresponding first target weight is assigned to each color channel. In some embodiments, color channels typically include a red channel, a green channel, and a blue channel, and textures including an alpha channel also include a transparency channel. Different color channels have different levels of importance to human visual perception. Generally, the human eye is more sensitive to the green channel, so the green channel has a higher weight value, followed by the red channel, and relatively less sensitive to the blue channel, so the blue channel has a lower weight value. The weight of the transparency channel is set according to the importance of the transparency channel in the specific rendering effect.
[0070] Understandably, by assigning different weights to different channels, the loss calculation results can be made to better match the visual perception characteristics of the human eye to some extent.
[0071] Finally, the pixel difference value calculated for each color channel is multiplied by the first target weight corresponding to that color channel, and the weighted results of all channels are summed to obtain the initial pixel loss value of the first pixel.
[0072] Understandably, by using a channel-weighted summation calculation method, it can be ensured to a certain extent that the initial pixel loss value can accurately reflect the actual image quality loss introduced by texture processing at the pixel level.
[0073] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description using a normal texture of a character's face without an alpha channel as an example: The original first target texture has a resolution of 2048×2048. After being scaled by Mipmap, the second target texture has a resolution of 1024×1024.
[0074] Then, take a first pixel from the facial region. The RGB values of this pixel in the first target texture are 255, 220, and 180. The RGB values of the corresponding pixel in the second target texture are 250, 215, and 175. Calculate the absolute difference of each channel: dR equals the absolute value of 255 minus 250, which is 5; dG equals the absolute value of 220 minus 215, which is 5; and dB equals the absolute value of 180 minus 175, which is 5.
[0075] Next, substitute the values into the formula excluding the alpha channel to calculate the initial pixel loss value:
[0076] in, This represents the initial pixel loss value.
[0077] Thus, in this embodiment, when both the first target texture and the second target texture are textures that include or do not include an alpha channel, the differences between the corresponding pixels of the first target texture and the second target texture in each color channel can be weighted and summed in combination with the first target weight corresponding to each color channel to obtain the initial pixel loss value for each pixel. This achieves pixel loss calculation that conforms to human visual perception. Compared with the scheme that uses a uniform calculation standard for all color channels, the method of calculating the initial pixel loss value for ordinary color textures by weighting each channel can match the differences in human visual sensitivity to different color channels. To a certain extent, this improves the consistency between the initial pixel loss value and the actual image quality differences perceived by the human eye, and can more accurately reflect the actual impact of pixel loss on the player's visual experience. This, in turn, avoids the evaluation bias caused by treating the losses of different channels equally to a certain extent, improves the accuracy of ordinary color texture quality evaluation, ensures the reliability of texture mapping area quality estimation results, and provides accurate data support for texture quality control.
[0078] In some embodiments provided in this application, the step of obtaining the initial pixel loss value of the first target map and the second target map at each first pixel based on the difference between the first target map and the second target map at each first pixel includes: When the first target map and the second target map are normal maps, the first normal vector of each pixel of the first target map is determined according to the pixel value of each first pixel of the first target map, and the second normal vector of each pixel of the second target map is determined according to the pixel value of each pixel of the second target map. The difference between the dot product of the first normal vector and the second normal vector of each pixel and a preset value is determined to obtain the initial pixel loss value for each pixel.
[0079] Specifically, normal maps are a special type of texture used in game development to simulate surface details. The calculation method for the quality loss of normal maps differs fundamentally from that of ordinary color maps. In related technologies, most methods use the same pixel difference calculation method as ordinary color maps to evaluate the quality of normal maps. This fails to accurately reflect the actual image quality impact after normal map processing, leading to distorted quality evaluation results and an inability to accurately identify rendering quality issues introduced by normal map processing, thus affecting the accuracy and reliability of texture quality evaluation. Based on the above problems, in some embodiments provided in this application, for normal map types, the corresponding normal vector is decoded based on the pixel value of each pixel in the original and processed textures, and the dot product of the two normal vectors is calculated. The difference between the dot product result and a preset value is calculated to obtain the initial pixel loss value for each pixel. This accurately reflects the impact of normal map processing on surface lighting effects and can adapt to the special properties of normal maps.
[0080] In some embodiments, a normal map can be understood as a special map used to simulate the bump and concavity effect of the surface details of a model. By storing the normal vector information of each pixel, the surface detail of the model can be improved without increasing the number of geometric faces of the model.
[0081] In some embodiments, the normal vector can be understood as a unit vector representing a direction in three-dimensional space, which can be used to describe the orientation of a point on the model surface.
[0082] In some embodiments, the first normal vector can be understood as the normal vector obtained by decoding each pixel in the original normal map, representing the orientation of that position on the model surface in the original state.
[0083] In some embodiments, the second normal vector can be understood as the normal vector obtained by decoding each pixel in the processed normal map, representing the orientation of that position on the surface of the processed model.
[0084] In some embodiments, the dot product can be understood as an operation between two vectors, and the result of the operation can reflect the directional similarity between the two vectors.
[0085] In some embodiments, the preset value can be understood as a pre-set reference value used to calculate the loss value, typically the result of the dot product of vectors in the same direction. For example, 1.
[0086] In some embodiments, a pixel value can be understood as the numerical information stored in each pixel of the texture.
[0087] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: When calculating the initial pixel loss value, the texture type is first determined. If it is confirmed that both the first target texture and the second target texture are normal maps, the first target texture and the second target texture are processed respectively.
[0088] In some embodiments, a normal map is a special texture resource that can be used to simulate the bumps and dents of an object's surface without increasing the number of geometric faces in the model. Each pixel stores normal direction information rather than color information.
[0089] For each pixel of the first target texture, the first normal vector corresponding to that pixel is obtained by decoding and calculating based on the corresponding pixel value. Similarly, for the corresponding pixel of the second target texture, the second normal vector corresponding to that pixel is obtained by decoding and calculating based on the corresponding pixel value.
[0090] In some embodiments, the decoding process of the normal vector needs to follow the standard encoding rules of normal mapping, converting pixel values from color space to vector space to obtain a three-dimensional direction vector of unit length.
[0091] Then, the dot product of the first normal vector and the second normal vector corresponding to each pixel position is calculated. The dot product of the two unit vectors reflects the angle between the two directions. The larger the dot product value, the more consistent the two normal directions are; the smaller the dot product value, the greater the difference between the two normal directions.
[0092] Finally, the difference between the dot product of the normal vectors of each pixel and the preset value is calculated to obtain the initial pixel loss value for that pixel.
[0093] In some embodiments, the preset value is usually the result of the dot product of two identical normal vectors. When the two normal vectors are completely identical, the dot product reaches its maximum value. At this time, the difference is zero, indicating that there is no quality loss.
[0094] Thus, in this embodiment, when the first target texture and the second target texture are normal textures, the corresponding first normal vector can be determined based on the pixel value of each pixel in the first target texture, and the corresponding second normal vector can be determined based on the pixel value of each pixel in the second target texture. Then, the difference between the dot product of the first normal vector and the second normal vector of each pixel and a preset value is calculated to obtain the initial pixel loss value for each pixel. This achieves pixel loss calculation for normal textures. Compared to using ordinary color channel difference calculation, it can accurately quantify the degree of normal direction offset, matching the functional characteristics of normal textures used to simulate surface bumps and details. To a certain extent, it avoids the problem that ordinary calculation methods cannot accurately reflect the impact of normal direction deviation on rendering effects, improves the accuracy of normal texture quality assessment, ensures that the quality assessment results can accurately reflect the actual impact of normal texture processing on game rendering effects, and thus to a certain extent guarantees the reliability of texture mapping area quality estimation results, providing targeted data support for normal texture quality control.
[0095] In some embodiments provided in this application, the step of determining the target weight sub-parameters of the second pixel corresponding to each first pixel in each texture mapping region on the surface of the target model includes: Construct the spatial acceleration structure corresponding to the target model; Determine the position and normal direction of each second pixel on the surface of the target model in the coordinate system corresponding to the target model; Based on the normal direction, cosine-weighted hemispherical ray sampling is performed on each second pixel to determine the sampling ray corresponding to each second pixel; By using a spatial acceleration structure to perform occlusion queries on the sampling ray corresponding to each second pixel, the degree to which each second pixel is occluded by other pixels on the surface of the target model is determined, and the target weight sub-parameters of each second pixel are obtained.
[0096] Specifically, when calculating pixel visibility, a simple occlusion judgment method is usually used, which is computationally inefficient and inaccurate. It cannot efficiently and accurately quantify the self-occlusion degree of each pixel in a large-scale model, making it difficult to adapt to the performance requirements of large-scale game projects. Based on the above problems, in some embodiments provided in this application, a spatial acceleration structure is constructed for the target model to improve ray detection efficiency. The spatial position and normal direction of each second pixel are determined, and multiple sampling rays are generated based on the normal direction using cosine-weighted hemispherical ray sampling. Finally, the spatial acceleration structure is used to query the occlusion of each sampling ray, and the target weight sub-parameters of each second pixel are obtained by statistically analyzing the occlusion situation.
[0097] In some embodiments, a spatial acceleration structure can be understood as a data structure for organizing three-dimensional spatial geometric data, which can improve the efficiency of querying the intersection of rays and geometric bodies. Common spatial acceleration structures include hierarchical bounding boxes, octrees, etc.
[0098] In some embodiments, the coordinate system can be understood as a three-dimensional coordinate system used to describe the spatial position of the model. Typically, a point on the model is used as the origin, and three axes, X, Y, and Z, are established to represent the spatial position.
[0099] In some embodiments, position can be understood as the specific coordinate value of the second pixel in three-dimensional space.
[0100] In some embodiments, the normal direction can be understood as the perpendicular direction of a point on the model surface, used to indicate the orientation of the surface at that point.
[0101] In some embodiments, cosine-weighted hemispherical ray sampling can be understood as a ray sampling method that generates sampling rays within a hemisphere with the surface normal as the central axis. The smaller the angle between the ray and the normal, the higher the weight, which can simulate the observation characteristics of the human eye on the surface.
[0102] In some embodiments, the sampling ray can be understood as a virtual ray used for occlusion query, which is emitted from the pixel position into the hemispherical space to determine whether the direction is occluded by other parts of the model.
[0103] In some embodiments, occlusion query can be understood as the process of determining whether the sampling ray intersects with other geometric surfaces of the model during propagation, in order to determine the degree of occlusion of a pixel.
[0104] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: When calculating pixel visibility, a corresponding spatial acceleration structure is first constructed for the target model. A spatial acceleration structure is a special data structure used to organize 3D spatial geometric data, which can reduce the computational cost of ray-to-geometry intersection detection, lowering the original linear time complexity to logarithmic time complexity.
[0105] Subsequently, the position and normal direction of each second pixel on the target model surface within the corresponding coordinate system of the target model are determined. Position information represents the specific coordinates of the pixel in 3D space, and the normal direction represents the orientation of the surface on which the pixel resides. Position information and normal direction are the fundamental data for visibility calculations, and to a certain extent, determine the starting position and sampling direction range of the sampling ray.
[0106] Then, starting from the position of the second pixel and taking the normal direction of the second pixel as the central axis, cosine-weighted hemispherical ray sampling is performed to generate multiple sampling rays in the hemispherical space where the normal direction is located.
[0107] In some embodiments, the sampling process may employ a cosine weighting strategy, wherein the sampling density is higher and the ray weight is higher for directions with smaller angles to the normal direction, and the sampling density is lower and the ray weight is smaller for directions with larger angles to the normal direction. This is consistent with the distribution pattern of actual illumination and can accurately simulate the visibility situation in the real world.
[0108] Finally, an occlusion query is performed on all sampled rays corresponding to each second pixel using a spatial acceleration structure. This detects whether each ray intersects with other geometric surfaces of the model during propagation, and the proportion of occlusion among all sampled rays is calculated to obtain the degree of occlusion of each second pixel by other pixels on the target model surface. Based on this, the target weight sub-parameter of each second pixel is calculated. Pixels with a higher occlusion ratio have lower target weight sub-parameter values, and pixels with a lower occlusion ratio have higher target weight sub-parameter values.
[0109] Thus, in this embodiment, by constructing a spatial acceleration structure corresponding to the target model, the position and normal direction of each second pixel on the target model surface in the corresponding coordinate system are determined. Based on the normal direction, cosine-weighted hemispherical ray sampling is performed on each second pixel to obtain the corresponding sampling ray. Then, occlusion query is performed on each sampling ray through the spatial acceleration structure to obtain the degree to which each second pixel is occluded by other pixels on the model surface, thereby obtaining the target weight sub-parameters for each second pixel. This achieves efficient and accurate pixel-level visibility quantization calculation. Compared to the direct ray query method without an acceleration structure, the spatial acceleration structure can effectively improve the computational efficiency of occlusion query, reducing the computation time under large-scale complex models to a certain extent. Furthermore, cosine-weighted hemispherical sampling can conform to the visibility perception law under actual lighting conditions, accurately quantifying the self-occlusion degree of each pixel, ensuring the consistency between the visibility calculation results and the actual lighting conditions to a certain extent, accurately reflecting the occlusion effect actually seen by the player, and improving the scientificity and accuracy of visibility weighting.
[0110] In some embodiments provided in this application, the spatial acceleration structure is a hierarchical bounding box constructed heuristically using surface area.
[0111] Specifically, in the visibility computation process, different spatial acceleration structures differ in terms of construction time, query efficiency, and memory usage. Ordinary spatial acceleration structures have low construction efficiency and poor ray query performance, making them unable to efficiently handle visibility computation for large-scale complex models. This results in excessive time overhead in the quality assessment process, making it difficult to meet the production needs of industrial projects. Based on the above problems, some embodiments provided in this application explicitly adopt hierarchical bounding boxes as spatial acceleration structures and use a surface area heuristic algorithm for constructing these hierarchical bounding boxes. This effectively improves the construction efficiency and ray query performance of the spatial acceleration structure, adapting to the visibility computation requirements of large-scale complex models.
[0112] In some embodiments, a hierarchical bounding box can be understood as a tree-like spatial acceleration structure that organizes the geometric data of a model by dividing bounding boxes layer by layer.
[0113] In some embodiments, the surface area heuristic can be understood as a cost function for evaluating the quality of spatial partitioning, which can be used to determine the quality of partitioning by calculating the weighted sum of the surface areas of the child nodes after partitioning.
[0114] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: When constructing the spatial acceleration structure of the target model, a hierarchical bounding box can be used. A hierarchical bounding box is a tree structure in which each node corresponds to a bounding box. The bounding box of the root node encloses the entire model, the bounding boxes of internal nodes enclose child nodes, and the bounding boxes of leaf nodes enclose a small number of original geometric primitives. By recursively dividing the 3D space through the tree structure, the ray query process can quickly eliminate non-intersecting geometric regions.
[0115] Furthermore, a surface area heuristic algorithm is required to construct the hierarchical bounding boxes. The surface area heuristic is a cost function used to evaluate the quality of spatial partitioning; the probability of a ray intersecting a bounding box is proportional to the surface area of the bounding box. When constructing each node of the hierarchical bounding box, the surface area heuristic algorithm attempts multiple possible partitioning positions and axes, and calculates a cost estimate for each partitioning scheme. The cost estimate comprehensively considers the surface areas of the two sub-bounding boxes after partitioning and the number of geometric primitives contained in each sub-node; the smaller the surface area, the fewer primitives are contained, and the lower the cost of the partitioning scheme.
[0116] Understandably, the surface area heuristic algorithm can select the optimal solution with the lowest cost among all possible partitioning schemes for spatial partitioning. This process is executed recursively until all leaf nodes meet the termination condition, which effectively reduces the overlap between bounding boxes, makes the hierarchical bounding box structure more balanced, and makes the spatial partitioning of each node more reasonable, thereby maximizing the efficiency of ray query.
[0117] Finally, the constructed hierarchical bounding box structure can be used for subsequent occlusion querying. When performing occlusion detection on the sampled ray, the process starts from the root node of the hierarchical bounding box and first checks whether the ray intersects with the bounding box of the current node. If they do not intersect, all child nodes of that node are skipped. If they intersect, the child nodes are recursively checked. This method can quickly eliminate a large number of non-intersecting geometric regions and only perform primitive intersection detection on a small number of leaf nodes that may intersect, effectively improving the speed of occlusion querying.
[0118] Thus, in this embodiment, by using a surface area-heuristically constructed hierarchical bounding box as a spatial acceleration structure, more efficient pixel-level visibility quantization calculation is achieved. The surface area-heuristically constructed hierarchical bounding box can optimize spatial partitioning based on the surface integral distribution of the model geometry, thereby improving the efficiency of ray occlusion query to a certain extent, reducing the computational load of ray intersection detection, and lowering the time consumption of visibility calculation. At the same time, it ensures the accuracy of occlusion query, enabling efficient completion of pixel-level visibility calculation for large-scale models. This is suitable for asset construction scenarios with a large number of textures and complex models in large-scale game projects, thereby improving the operational efficiency of quality assessment to a certain extent and ensuring the performance of asset construction.
[0119] In some embodiments provided in this application, the steps described above, which involve performing occlusion queries on the sampling rays corresponding to each second pixel using a spatial acceleration structure to determine the degree to which each second pixel is occluded by other pixels on the surface of the target model, and obtaining the target weight sub-parameters for each second pixel, include: By using a spatial acceleration structure to perform occlusion queries on the sampling ray corresponding to each second pixel, an estimated score of the degree to which each second pixel is occluded by other pixels on the surface of the target model is obtained. The degree estimate score of each second pixel is mapped to a preset numerical range to obtain the target weight sub-parameter of each second pixel.
[0120] Specifically, in the process of calculating the target weight sub-parameters, the estimated scores for occlusion levels of different pixels are not uniform. Directly using the proportion of occluded rays as weight values results in inconsistent numerical ranges, making direct weighted calculations impossible and hindering comparison of the visibility of different pixels. This leads to a lack of a unified standard for subsequent quality loss weighted calculations, resulting in poor consistency in evaluation results. To address these issues, some embodiments provided in this application utilize a spatial acceleration structure to perform occlusion queries on all sampled rays of each second pixel, statistically obtaining the estimated occlusion score for that pixel. This score is then mapped to a preset standardized numerical range to obtain the target weight sub-parameters for each second pixel, ensuring, to a certain extent, the standardization and rationality of the weight values.
[0121] In some embodiments, the degree estimation score can be understood as the raw score of pixel occlusion degree obtained through occlusion query statistics, representing the proportion of occluded sampled rays to the total sampled rays.
[0122] In some embodiments, the preset numerical range can be understood as a pre-defined range of weight values, typically from 0 to 1, used to unify the weight value range of all pixels and ensure the comparability of weights.
[0123] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: In calculating the target weight sub-parameters, the occlusion of all sampled rays corresponding to each second pixel is first queried using a spatial acceleration structure. For each sampled ray, it is checked whether the ray intersects with other geometric surfaces of the model during propagation. If the ray intersects with other geometric surfaces before reaching the maximum distance, the ray is determined to be occluded. The number of occluded rays among all sampled rays of the second pixel is counted, and the proportion of occluded rays to the total number of sampled rays is calculated to obtain the occlusion degree estimate score of the second pixel.
[0124] Understandably, the occlusion estimation score reflects the degree to which the corresponding pixel is geometrically occluded by the model itself. The higher the score, the higher the proportion of the pixel being occluded, and the lower the probability that the player can actually see it. The lower the score, the lower the proportion of the pixel being occluded, and the higher the probability that the player can actually see it.
[0125] In some embodiments, the original occlusion level estimate score typically ranges from 0 to 1, where 0 represents no occlusion and 1 represents complete occlusion.
[0126] Next, the estimated occlusion score for each second pixel is mapped to a preset numerical range. The preset numerical range is a standardized weighted range that has been optimized, typically ranging from 0 to 1 or other numerical intervals suitable for weighted calculation.
[0127] In some embodiments, the mapping process can employ linear or nonlinear mapping methods, adjusting the weight distribution characteristics according to actual needs. Linear mapping can maintain the proportional relationship between the original occlusion degree and the weight value, while nonlinear mapping can enhance or suppress the intermediate regions of occlusion, making the weight distribution more consistent with actual visual perception characteristics.
[0128] Finally, through numerical mapping, the original occlusion estimation scores are converted into standardized target weight sub-parameters. The mapped target weight sub-parameters have a uniform numerical range, making the weight values comparable across different models and sampling settings, and can be directly used in subsequent weighted calculations. Specifically, high-visibility pixels correspond to higher weight values, and low-visibility pixels correspond to lower weight values.
[0129] Thus, in this embodiment, the sampling ray of each second pixel is occluded using a spatial acceleration structure to obtain an estimated score of the degree to which each second pixel is occluded by other pixels on the model surface. The estimated score of each second pixel is then mapped to a preset numerical range to obtain the corresponding target weight sub-parameter. This achieves standardized pixel-level visibility weight quantization, mapping the occlusion degree estimation score to a unified preset numerical range. This ensures that the visibility weights of different pixels in different models have a unified quantification standard, avoiding the incomparability of weights caused by differences in the numerical range of occlusion degree in different scenarios. This makes the calculation of visibility-weighted quality loss consistent, thereby ensuring the horizontal comparability and practicality of quality assessment results for different textures and different regions to a certain extent. Furthermore, the standardized weight values facilitate subsequent aggregation, statistics, and sorting, improving the accuracy and rationality of the global quality ranking to a certain extent, and adapting to the needs of unified evaluation of multiple resources in large-scale projects.
[0130] In some embodiments provided in this application, the step of estimating the quality of each texture mapping region based on the initial pixel loss value of each first pixel in each texture mapping region and the target weight sub-parameter corresponding to each first pixel includes: For each first pixel in each texture mapping region, the initial pixel loss value and the target weight sub-parameter corresponding to each first pixel are weighted and summed to obtain the target pixel loss value for each texture mapping region. Based on the target pixel loss value and the number of pixels in each texture mapping region, the average difference of each pixel in each texture mapping region is determined to obtain a quality estimate for each texture mapping region.
[0131] Specifically, in related technologies, when calculating region quality, the average loss value of all pixels within the region is usually taken directly, without considering the visibility differences of pixels and without normalizing the region size. This results in incomparable quality assessment results for regions of different sizes, failing to accurately reflect the actual quality level of the region. Based on the above problems, in some embodiments provided in this application, the initial pixel loss value of all pixels within the texture mapping region is weighted and summed with the corresponding target weight sub-parameter to obtain the target pixel loss value of the entire region. The target pixel loss value is then divided by the number of pixels within the region to calculate the average difference of each pixel within the region, which is used as the quality estimation result of the texture mapping region. This effectively achieves an organic combination of visibility weighting and area normalization.
[0132] In some embodiments, the target pixel loss value can be understood as the weighted sum of the initial loss values of all pixels in the region and the visibility weights, which is the total visibility weighted loss of the region.
[0133] In some embodiments, the average difference can be understood as the average loss value obtained by dividing the total loss of the region by the number of pixels in the region. It is a normalized region quality index that eliminates the influence of region size on quality assessment.
[0134] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: First, all first pixels in each texture mapping region are traversed. For each first pixel, the initial pixel loss value of the first pixel is multiplied by the corresponding target weight sub-parameter to obtain the weighted loss value of the first pixel. Then, the weighted loss values of all pixels in the region are summed to obtain the target pixel loss value of the entire texture mapping region.
[0135] Understandably, the above weighted summation process fully considers the visibility differences of each pixel. The quality loss of high-visibility pixels contributes more to the total area loss, while the quality loss of low-visibility pixels contributes less to the total area loss, so as to ensure that the area quality estimation results can truly reflect the image quality differences actually perceived by the player.
[0136] Subsequently, the total number of pixels contained in the texture mapping area is counted. The target pixel loss value calculated in the first step is divided by the number of pixels in the area to obtain the average difference of each pixel in the area. This effectively eliminates the influence of the area area on the quality estimation result. The average weighted loss per pixel is used as the quality measurement standard, which enables fair horizontal comparison between texture mapping areas of different sizes.
[0137] Finally, the calculated average difference is used as the quality estimate for the texture mapping area. A higher average value indicates a more severe quality loss after assetization, mainly concentrated in areas with high player visibility, requiring priority optimization. A lower average value indicates better overall quality for the area, or that quality loss is mainly concentrated in areas not visible to the player, allowing for a reduction in resource specifications.
[0138] Thus, in this embodiment, by weighted summing of the initial pixel loss value and the corresponding target weight sub-parameter of each first pixel in each texture mapping region, the target pixel loss value of each texture mapping region is obtained. Then, based on the target pixel loss value and the number of pixels in each texture mapping region, the average difference of each pixel in each texture mapping region is determined, thereby obtaining the quality estimate of each texture mapping region. This achieves standardized aggregation from pixel-level data to region-level quality indicators, retaining the perceptual characteristics of visibility weighting to a certain extent, unifying the evaluation granularity to the continuous region level corresponding to the model parts, so that the quality indicators can directly correspond to the specific surface parts of the model, and the averaging process can eliminate the influence of outliers of individual pixels, improving the stability and reliability of the region quality estimation results to a certain extent. This facilitates developers to directly compare and optimize the quality results of different model parts, providing standardized region-level quality data for subsequent global ranking and leaderboard generation, adapting to the unified quality control needs of large-scale projects.
[0139] In some embodiments provided in this application, step 110 above includes: Construct index data for the first target texture to determine the target model in the target game associated with the first target texture, wherein the index data is used to indicate the target model containing the target material.
[0140] Specifically, in related technologies, when searching for models associated with a texture, it is necessary to traverse all model resources and check material references one by one. This results in low search efficiency, leading to significant computational overhead in large projects containing tens of thousands of models. This impacts the operational efficiency of the asset construction pipeline and fails to meet the efficiency requirements of industrial production. Based on the above problems, in some embodiments provided in this application, index data is pre-built for the first target texture. The index data records all target materials containing the first target texture and their corresponding target model information. When it is necessary to determine the target model associated with the first target texture, the result can be quickly obtained by directly querying the index data, without traversing all model resources, thus improving the efficiency of relational queries.
[0141] In some embodiments, the index data can be understood as a mapping data structure for fast querying, using the texture identifier as the key to store all model information that references the texture, thereby enabling fast texture-to-model association querying.
[0142] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: In the preprocessing stage of asset construction, corresponding index data is pre-built for the first target texture. Index data is a mapping data structure used to store the reference relationships between textures and models. The index data uses the texture identifier as the key, and the corresponding value is a list of all models and materials that reference that texture. Each record contains complete traceability information, including the model identifier, material group index, mesh data path, and material data path.
[0143] In some embodiments, during the construction of index data, the electronic device traverses all 3D model resources in the project, parses the material information of each 3D model, extracts the texture identifier of each material reference, and then aggregates them on a texture-by-texture basis to establish a reverse mapping from texture to all referenced models.
[0144] Understandably, a single complete traversal can establish index data for all textures, effectively avoiding repeated traversals in subsequent processing.
[0145] When it's necessary to identify the target model in the game associated with the first target texture, the pre-built index data can be queried directly. By using the identifier of the first target texture as the key to search the index data, all target materials containing that first target texture and their corresponding target model information can be quickly retrieved. Furthermore, the time complexity of the entire query process is constant, independent of the total number of models in the project, enabling extremely fast query response.
[0146] Understandably, by using indexed data, electronic devices can efficiently establish the association between texture resources and model resources, providing accurate association information for subsequent steps such as UV island division, visibility calculation, and quality assessment. This ensures that all referenced models of the same texture can be accurately identified, without missing any model parts that need to be assessed for quality.
[0147] Thus, in this embodiment, index data for a first target texture is pre-constructed. The index data is used to determine the target model in the target game associated with the first target texture. The index data is used to indicate the target model containing the target material. Then, the first target texture is processed into an asset to obtain a second target texture. The texture mapping area of the continuous area on the surface of the target model is determined. The quality of each texture mapping area is estimated by combining the regional differences and visibility parameters. This achieves efficient positioning of textures and associated models. By constructing index data, a fast mapping relationship between textures and associated models can be established. The association lookup operation that originally required linear time is optimized into a constant time query operation. It is not necessary to traverse all model resources to find associated objects when needed. To a certain extent, the efficiency of model lookup is improved, the time consumption of resource retrieval is reduced, and the running efficiency of texture quality assessment is guaranteed. This is suitable for asset construction scenarios of large-scale game projects.
[0148] In some embodiments provided in this application, the method further includes: Register a target callback function based on the index data, whereby the target callback function is used to access the target material and target model when triggered; The first target texture is processed into an asset to obtain the second target texture, including: The first target texture is processed into an asset; After assetization, the target callback function is triggered to obtain the second target texture.
[0149] Specifically, in the asset construction pipeline, all model data and all mapping relationships are typically loaded and pre-calculated during the preprocessing stage, resulting in extremely high memory consumption. Furthermore, the final construction resolution of the texture cannot be determined during preprocessing, and the pre-calculated mapping relationships may not match the actual construction resolution, leading to inaccurate calculation results. To address these issues, some embodiments provided in this application register a target callback function associated with each texture model based on index data. This callback function only records the data access path and does not pre-calculate data. Once the assetization of the first target texture is completed and the actual resolution is determined, the target callback function is triggered, performing relevant calculations at the correct resolution to obtain the second target texture. This effectively avoids the memory bloat and resolution mismatch problems caused by pre-calculation.
[0150] In some embodiments, the target callback function can be understood as a function that is executed only when a specific event is triggered. In this application embodiment, it can be understood as a lightweight function that is executed after the texture has been assetized, used to access model data and perform subsequent calculations.
[0151] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: First, based on each record in the index data, a lightweight target callback function is registered for each texture model. The target callback function only captures necessary access information such as the mesh data file path and material group index, and does not pre-calculate any pixel-level data during the registration phase.
[0152] In some embodiments, callback functions can be registered in a global thread-safe store and managed using the texture identifier as the key.
[0153] Subsequently, the first target texture is subjected to standardized assetization processing. During the assetization process, the final construction resolution of the texture is determined according to the target platform and image quality level. After completing all processing operations, the processed texture data is obtained.
[0154] Finally, after the assetization process is completed and the second target texture is obtained, all target callback functions corresponding to that texture are triggered. Each callback function loads the UV data of the corresponding model at the current actual construction resolution, performs calculations such as UV island division and pixel mapping establishment, and releases the relevant memory resources after the calculation is completed.
[0155] Thus, in this embodiment, a target callback function is registered based on the index data. The target callback function is used to access the target material and target model when triggered. After the first target texture is assetized, the target callback function is triggered to obtain the second target texture. This achieves efficient decoupling between texture processing and model data access. By adopting a delayed callback mechanism, the callback is triggered only as needed after the texture has actually completed assetization processing. This reduces the memory usage in the preprocessing stage to a certain extent and avoids the memory bloat problem caused by a large amount of pre-stored data. Moreover, the callback mechanism ensures that the associated model data of the same texture is calculated only once when needed, effectively avoiding the problem of repeated calculation. This improves the resource utilization efficiency of the asset construction process to a certain extent and is suitable for the parallel processing scenarios of a large number of textures and models in large-scale projects. In this way, it ensures the stable operation of the quality assessment process in the distributed asset construction environment to a certain extent.
[0156] In some embodiments provided in this application, the step of constructing the index data of the first target texture includes: The mesh and material data of each 3D model in the target game are analyzed to determine the model material and the textures included in the model material for each 3D model. Based on the first target texture, as well as the model material and the textures included in the model material of each 3D model, index data is constructed.
[0157] Specifically, in related technologies, the construction of the association between textures and models often relies on manual recording or incomplete resource information, which can easily lead to omissions or errors in the association, making it impossible to obtain all associated models and affecting the completeness and accuracy of the evaluation results. Based on the above problems, in some embodiments provided in this application, each 3D model in the target game is analyzed, including its mesh data and material data, to determine all materials used by each model and all textures contained in each material. Based on the analyzed associations of all model material textures, index data for the first target texture is constructed.
[0158] In some embodiments, mesh data can be understood as the geometric data of a 3D model, including geometric information such as the model's vertices, edges, and faces.
[0159] In some embodiments, material data can be understood as parameter data of the model material, including the textures used by the material, rendering parameters, shader information, etc., which can be used to control the rendering effect of the model.
[0160] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: First, iterate through all 3D model resources in the target game, and parse the mesh data and material data of each 3D model. Parsing the mesh data can obtain the geometric structure information of the model, and parsing the material data can obtain all the materials used by the model, as well as the identifiers of all textures referenced by each material.
[0161] For each model, record the texture information of all materials referenced by that model, and establish the association between the model and the textures.
[0162] Finally, based on the relationships between all models, an index of the first target texture is constructed, and information about all models that reference the first target texture is recorded in the index data to ensure that all associated models are included.
[0163] Thus, in this embodiment, by parsing the mesh and material data of each 3D model in the target game, the model material and textures included in the model material of each 3D model are determined. Then, based on the first target texture and the association relationship between the model material and the corresponding texture of each 3D model, the index data of the first target texture is constructed. This realizes the construction of texture-model association index. By parsing the mesh and material data of all 3D models to extract the association relationship between materials and textures, it can comprehensively cover all model resources in the project, ensuring the integrity of the index data to a certain extent and avoiding the omission of associated models. Moreover, the index is constructed based on the correspondence obtained from the parsing, which to a certain extent ensures the accuracy of the index data, ensuring that each texture can be matched with all associated models. This provides a complete and accurate model association foundation for subsequent texture quality assessment, avoiding quality assessment omissions due to missing or incorrect indexes. It can adapt to the association management needs of a large number of models and textures in large-scale projects, thereby ensuring the integrity and reliability of the quality assessment process to a certain extent.
[0164] In some embodiments provided in this application, the steps of parsing the mesh data and material data of each 3D model in the target game to determine the model material and textures included in the model material of each 3D model include: The mesh and material data of each 3D model in the target game at the highest precision level are analyzed to determine the model material and the textures included in the model material for each 3D model.
[0165] Specifically, game models typically comprise multiple precision levels for switching between different viewing distances, with lower precision models used for long distances and higher precision models for close distances. However, in related technologies, when constructing texture index data, all precision levels of models are usually parsed and processed, resulting in significant unnecessary computational overhead. Furthermore, lower precision models are typically rendered at long distances, and texture quality loss has minimal impact on player perception, making quality assessment of lower precision models meaningless. Based on these issues, some embodiments provided in this application process only the highest precision level 3D model in the target game during model parsing for index data construction. The mesh and material data of the high precision level model are parsed to determine the materials contained in each highest precision level model and the textures referenced by those materials. Index data is then constructed based on this determination, reducing unnecessary computational overhead to some extent.
[0166] In some embodiments, the highest precision level can be understood as the highest level of detail in the model precision level, which has the most faces and the richest details. It is the model used by players when observing the model up close and has the greatest impact on the player's visual experience.
[0167] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: When iterating through all 3D models in the target game, the precision level of each model is first determined. In game development, multiple model versions with different face counts are typically created for the same object; these are called different precision levels, numbered sequentially from zero, with level zero being the highest precision level, and higher numbers indicating lower precision. Electronic devices only select the model with the highest precision level for further processing; all lower precision level models are skipped.
[0168] For the selected 3D models with the highest precision level, the mesh data and material data of each model are loaded and parsed, the material and texture information is extracted and index data is constructed, and the subsequent quality assessment is only performed on the models with the highest precision level.
[0169] Thus, in this embodiment, by analyzing only the mesh and material data of each 3D model at the highest precision level in the target game, the model material and textures included in the model material of each 3D model are determined. This achieves efficient and targeted texture and model association index construction. Data analysis only for the highest precision level 3D models can effectively filter redundant data from low precision level models, reducing the amount of data processing during index construction to a certain extent and improving the efficiency of index construction. Moreover, the highest precision level models are the main rendering objects when players observe them up close, and texture quality has the greatest impact on players' visual perception. Focusing on the highest precision level models ensures that the index data covers all models that have an important impact on players' perception, avoiding the occupation of computing resources by invalid data from low precision models to a certain extent. While ensuring the effectiveness of the index, the efficiency of the asset construction process is improved, which can adapt to the processing scenarios of a large number of models with different precision levels in large-scale projects, thereby ensuring the pertinence and efficiency of quality assessment to a certain extent.
[0170] In some embodiments provided in this application, step 130 above includes: The set of triangles corresponding to the target material associated with the first target texture in the target model is divided into at least one continuous region. Based on the pixel area covered by each continuous region on the second target texture, determine the texture mapping area corresponding to each continuous region.
[0171] Specifically, model surfaces are typically composed of numerous triangles. In related technologies, these triangles are not grouped reasonably according to connectivity, making it impossible to accurately map individual parts of the model surface to texture areas, hindering targeted optimization of quality issues. Based on these problems, in some embodiments provided in this application, firstly, connectivity partitioning is performed on all triangles in the target model corresponding to the material associated with the target texture, dividing the triangle set into multiple continuous regions. Each continuous region corresponds to a specific part of the model surface. Then, all pixels covered by each continuous region on the second target texture are determined, thereby determining the texture mapping area corresponding to each continuous region and establishing an accurate correspondence between the model space and the texture space.
[0172] In some embodiments, the triangle set refers to the set of all triangles that make up the surface of the model, and the surface of the three-dimensional model is made up of a large number of triangles.
[0173] In some embodiments, UV coordinates refer to the two-dimensional coordinates of model vertices in texture space, which can be used to map vertices on the model surface to their corresponding positions on the texture.
[0174] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: First, extract all triangles corresponding to the target material associated with the first target texture from the target model to form a set of triangles to be processed.
[0175] Understandably, a model typically contains multiple material groups, each corresponding to different texture resources. Only the triangles corresponding to the materials related to the currently processed texture are extracted, effectively reducing the processing of irrelevant geometric data.
[0176] Subsequently, connectivity analysis is performed on the extracted triangle set, merging triangles with edge connectivity into the same set. Edge connectivity refers to two triangles sharing the same edge. Through this connectivity relationship, the entire triangle set can be divided into several non-overlapping connected components. Each connected component is a continuous region on the model surface, corresponding to a specific surface part of the model, such as the character's face, arms, legs, etc.
[0177] Finally, the UV coordinates of all triangles in each continuous region on the second target map are determined, and the pixel range covered by the triangles on the second target map is determined based on the UV coordinate information of all triangles in the region.
[0178] In some embodiments, all pixels covered by each triangle in the texture space can be calculated using rasterization. The pixels covered by all triangles within a continuous region are then merged to obtain the complete texture mapping region for that continuous region. Each texture mapping region corresponds to a specific part of the model surface, achieving a precise mapping from the model space region to the texture space region.
[0179] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description using a game character's body model as an example: The body model's body material uses a first target texture with a resolution of 2048×2048, and the corresponding triangle set contains 12,000 triangles.
[0180] First, the aforementioned 12,000 triangles are filtered out. Based on UV edge connectivity, these 12,000 triangles are divided into 6 continuous regions, corresponding to the character's face, torso, left arm, right arm, left leg, and right leg, respectively. Among them, the continuous facial region contains 3,200 triangles, and the continuous torso region contains 3,500 triangles.
[0181] Next, create a pixel mapping table with a size of 2048×2048, with all initial values set to -1.
[0182] Subsequently, the first triangle of the continuous facial region is processed. The UV coordinates of the three vertices of this triangle are (0.2,0.1), (0.4,0.1) and (0.3,0.3), respectively. Substituting the above UV coordinates into the mapping formula, the vertex mapping coordinates are calculated to be (409,204), (818,204) and (614,613), respectively.
[0183] Simultaneously, calculate the axis-aligned bounding box of the triangle. The coordinate range is from 409 to 818. The coordinate range is from 204 to 613, containing a total of 410×410=168100 pixels.
[0184] Subsequently, the centroid coordinate test was performed on each of the 168,100 pixels. Among them, 82,000 pixels were located inside the triangle. The value of these 82,000 pixels in the pixel mapping table was set to the number 0 of the continuous facial region.
[0185] Repeat the above process to process all 3200 triangles in the continuous facial region. Finally, all pixels with a value of 0 in the pixel mapping table constitute the texture mapping region corresponding to the continuous facial region, which contains approximately 1.2 million effective pixels.
[0186] Subsequently, the same method was used to process the other five consecutive regions, resulting in their respective texture mapping regions. Each texture mapping region accurately corresponds to an independent part of the model surface, providing a precise spatial index basis for subsequent region-by-region calculation of texture quality loss.
[0187] Thus, in this embodiment, by dividing the set of triangles corresponding to the target material associated with the first target texture in the target model into at least one continuous region, and then determining the texture mapping region corresponding to each continuous region based on the pixel region covered by each continuous region on the second target texture, the mapping space and the model geometry are correspondingly divided. By dividing the set of triangles corresponding to the target material into continuous regions and then matching the corresponding pixel regions, it can be ensured to a certain extent that each continuous region can be accurately mapped to the corresponding pixel range on the texture. This makes the granularity of the quality assessment region match the actual surface part of the model, avoiding the problem of the texture region not corresponding to the model part. Moreover, the division method based on the set of triangles can fit the topological structure of the model's UV unfolding, ensuring to a certain extent that the division of continuous regions can conform to the actual connectivity of the model surface. This provides an accurate spatial division basis for subsequent region-level quality assessment, allowing the quality assessment results to directly correspond to the specific surface part of the model, helping developers to locate the model region where the quality problem is located, thereby improving the practicality and pertinence of the quality assessment to a certain extent.
[0188] In some embodiments provided in this application, the step of dividing the set of triangles corresponding to the target material associated with the first target texture in the target model into at least one continuous region includes: Construct the edge key based on the coordinates of the two endpoints of each side of each triangle; When two triangles have edges with the same edge key, merge the two triangles into the same set; All triangles belonging to the same set are defined as a continuous region.
[0189] Specifically, in related technologies, when dividing continuous regions of a model, connectivity in geometric space is typically used for judgment, without considering connectivity in UV space. This leads to a mismatch between the divided regions and the actual regions on the texture, resulting in poor accuracy in region division and affecting subsequent quality assessment results. To address these issues, in some embodiments provided in this application, for each edge of each triangle, a unique edge key is constructed based on the UV coordinates of the two endpoints of each edge. The edge key is then used to quickly determine whether different triangles share the same UV edge. When two triangles have UV edges with the same edge key, the two triangles are merged into the same set, and each triangle set constitutes a continuous region, achieving efficient connectivity judgment and triangle grouping.
[0190] In some embodiments, an edge key can be understood as an identifier that can uniquely identify a UV edge, generated by the UV coordinates of the two endpoints of the edge, and the edge keys of the same UV edge are the same.
[0191] In some embodiments, the sides of a triangle can be understood as the corresponding sides of the triangle in UV space, determined by the UV coordinates of the two vertices.
[0192] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: First, the set of triangles corresponding to the target material associated with the first target texture in the target model is filtered, keeping only the triangles belonging to that target material and excluding triangles of other materials, to ensure that the partitioning process only targets the material region being processed.
[0193] Subsequently, each triangle in the triangle set is traversed. In some embodiments, an independent disjoint-set data structure can be created for each triangle, the parent node of each triangle is initialized to itself, and the rank of each set is recorded for subsequent rank-based merging optimization.
[0194] Next, each edge of the triangle is processed. For each edge, the coordinates of the two endpoints in UV space are obtained, and a unique edge key is constructed after standardizing the coordinates of the two endpoints. The edge key can be constructed using the precise bit representation of the UV coordinates. The binary bits of the floating-point number are directly converted into an unsigned integer as the hash input, ensuring that UV coordinates with the same floating-point value produce the same key value.
[0195] In some embodiments, the endpoint order can be normalized during the edge key construction process. The UV coordinates of the two endpoints are arranged in ascending order before the hash value is calculated to ensure that the same edge key can be generated no matter which triangle is traversed from, thus ensuring the accuracy of edge matching.
[0196] Understandably, the edge key is a unique identifier for UV edges, which can quickly determine whether two triangles share the same UV edge. Constructing the edge key based on UV space coordinates can ensure that connectivity determination is performed in the texture mapping space, which to some extent avoids the incorrect merging of triangles that are continuous in 3D space but discontinuous in UV space.
[0197] Subsequently, all edge keys of all triangles are traversed to establish a mapping relationship between edge keys and triangles. When two different triangles are found to have UV edges with the same edge key, it indicates that the two triangles share the same edge in UV space and have an edge connectivity relationship, and the two triangles are merged into the same set.
[0198] In some embodiments, a disjoint-set data structure can be used to achieve efficient set merging operations, a path finding strategy can be used for path semi-compression, and a rank-based merging strategy can be used to effectively ensure the near-linear time complexity of connectivity analysis and improve the computational efficiency of the connectivity analysis process.
[0199] Finally, by traversing the root nodes of all triangles, all triangles belonging to the same set are identified as a contiguous region. All triangles within each contiguous region are edge-connected in UV space, corresponding to a contiguous region in texture space, and also to a contiguous part of the model surface.
[0200] In some embodiments, each distinct root node may be assigned a consecutive island number starting from 0, and the island number is determined solely by UV edge connectivity and is independent of visibility in subsequent calculations.
[0201] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description using the body material of a game character as an example: The triangle set corresponding to this body material contains 12,000 triangles, which are mapped to a first target texture of 2048×2048.
[0202] First, filter out the 12,000 triangles mentioned above, create an independent disjoint-set data structure for each triangle, initialize the parent node of each triangle to itself, and record the rank of each set.
[0203] Then, the three edges of each triangle are traversed, and the edge key is constructed using the precise bit representation of the UV coordinates. For example, if the UV coordinates of the two endpoints of an edge of a triangle are (0.1, 0.2) and (0.15, 0.25), the two coordinates are arranged in ascending order, and their floating-point binary bits are directly converted to unsigned integers to calculate the hash value and obtain the edge key. When traversing the same edge of another triangle, the same edge key is generated, and the sets containing the two triangles are merged using a disjoint-set data structure. The merging process can use a rank-based merging strategy to merge the set with the smaller rank into the set with the larger rank. The path lookup process can use a path semi-compression strategy to directly point the nodes on the search path to the grandparent node, further improving query efficiency.
[0204] Finally, after a complete traversal and merging process, the 12,000 triangles were divided into 6 consecutive regions, corresponding to the character's face, torso, left arm, right arm, left leg, and right leg, respectively. Each consecutive region contains between 800 and 3,500 triangles, and each region corresponds exactly to the actual part on the model's surface.
[0205] In some embodiments, each consecutive region may be assigned a consecutive number from 0 to 5 to record the UV coordinate range of each region. For example, the UV coordinate range of the facial region is (0.2, 0.1) to (0.4, 0.3), providing a basis for subsequently determining the texture mapping region corresponding to each consecutive region.
[0206] Thus, in this embodiment, edge keys are constructed based on the coordinates of the two endpoints of each side of each triangle. When two triangles have edges with the same edge key, the two triangles are merged into the same set, and all triangles belonging to the same set are determined as a continuous region. This achieves continuous region partitioning based on UV edge connectivity. By constructing edge keys for each side of each triangle and merging connected triangles according to the edge key matching relationship, the set of interconnected triangles in UV space can be automatically identified, ensuring that the partitioned continuous region corresponds to the actual connected parts on the model surface. This avoids the problem of mismatch between region partitioning and model surface topology to a certain extent. Moreover, the edge key matching method has a simple and efficient calculation logic, which can quickly complete the connectivity analysis of large-scale triangle sets and adapt to the UV island partitioning requirements of complex 3D models. It provides an accurate spatial partitioning basis for subsequent regional quality assessment, making the regional granularity of quality assessment correspond to the actual surface parts of the model, thereby improving the accuracy and practicality of quality assessment to a certain extent.
[0207] In some embodiments provided in this application, the step of determining the texture mapping region corresponding to each continuous region based on the pixel region covered by each continuous region on the second target texture includes: Map the vertex coordinates of each triangle corresponding to each continuous region from the first coordinate system to the second coordinate system corresponding to the second target texture, and determine the vertex mapping coordinates of each triangle corresponding to each continuous region; Based on the coordinates of the vertices of the triangle, determine the geometric shape that can enclose the triangle; Based on the pixels located within the geometry in the second target texture, determine the texture mapping area corresponding to each continuous region.
[0208] Specifically, in related technologies, when determining the texture pixels corresponding to a continuous region, a simple coordinate mapping is usually used, which is prone to pixel omission or incorrect assignment, resulting in inaccurate determination of the texture mapping region and affecting the accuracy of region quality assessment. Based on the above problems, in some embodiments provided in this application, the vertices of a triangle are mapped from the first coordinate system of the model to the second coordinate system of the texture, obtaining the mapped coordinates of the vertices in the texture space. The coverage area of the triangle is determined based on the coordinates of the three vertices, all pixels inside the triangle are calculated, and finally, all pixels covered by the triangle within a continuous region are merged to obtain the complete texture mapping region of that continuous region.
[0209] In some embodiments, the first coordinate system, namely the UV coordinate system, can be understood as the coordinate system in which the original coordinates of the model vertices are located. It is usually a three-dimensional model space or UV parameter space, and its range is usually from 0 to 1, in order to represent the relative position of the model surface vertices on the texture.
[0210] In some embodiments, the second coordinate system, i.e. the pixel coordinate system, can be understood as the pixel coordinate system of the second target texture, which represents the position on the texture in pixels. The origin is usually located at the upper left corner of the texture, the horizontal axis is the width direction, the vertical axis is the height direction, and the range is usually from 0 to the width and height of the texture minus 1.
[0211] In some embodiments, vertex mapping coordinates can be understood as the pixel coordinates of a triangle vertex after it has been mapped from the UV coordinate system to the pixel coordinate system.
[0212] In some embodiments, the geometry can be understood as an axis-aligned bounding box (AABB) that encloses a triangle, which can be used to reduce the range of pixel traversal and improve judgment efficiency.
[0213] In some embodiments, the centroid coordinate method can be understood as a geometric algorithm for determining whether a point is located inside a triangle.
[0214] In some embodiments, the pixel mapping table can be understood as a two-dimensional array used to record the serial number of the continuous region to which each pixel belongs, with an initial value of -1 indicating that it is not covered by any continuous region.
[0215] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description: First, for each triangle corresponding to each continuous region, map the coordinates of the three vertices of the triangle from the first coordinate system to the second coordinate system corresponding to the second target texture. The first coordinate system is usually the local coordinate system of the model or the UV parameter space, and the second coordinate system is the pixel coordinate system of the texture. Through linear mapping formulas, coordinate transformation matrices, or direct UV attribute sampling, the position of each vertex is accurately mapped to the texture space, obtaining the pixel position of each vertex in the texture, i.e., the vertex mapping coordinates. The mapping formula can be:
[0216]
[0217] in, and Let be the coordinates of the triangle's vertices in the first coordinate system. The pixel width of the second target texture. The pixel height of the second target texture. and The coordinates of the triangle's vertices in the second coordinate system are the vertex-mapped coordinates.
[0218] Understandably, through the above linear mapping, the relative UV coordinates in the range of 0 to 1 can be converted into the actual pixel coordinates under the corresponding texture resolution, realizing the conversion between the two coordinate systems.
[0219] Subsequently, based on the mapped coordinates of the triangle's three vertices, a geometric shape that can completely enclose the triangle is determined, typically an axis-aligned rectangular bounding box. The bounding box defines the pixel range that the triangle may cover, restricting subsequent calculations to a local area, reducing the number of pixels to be processed, and improving computational efficiency. Furthermore, the boundary of the bounding box is determined based on the maximum and minimum values of the three vertex coordinates; that is, the three vertex coordinates are used. The minimum coordinate value is used as the left boundary, and the maximum coordinate value is used as the right boundary. Three vertices are selected. The minimum value of the coordinates is used as the upper boundary, and the maximum value is used as the lower boundary to ensure that the triangle is completely contained within it.
[0220] In some embodiments, a pixel mapping table with the same resolution as the second target texture can also be created, with all elements initialized to -1, indicating that it is not covered by any contiguous area.
[0221] Then, iterate through each pixel within the bounding box and determine whether the pixel is inside the triangle using either a barycentric coordinate algorithm or an edge function algorithm. For each pixel inside the triangle, mark it as belonging to the current triangle by setting its value in the pixel mapping table to the number of the contiguous region to which the triangle belongs.
[0222] Simultaneously, the axis-aligned bounding box and centroid coordinates of each continuous region in the first coordinate system are calculated for subsequent source localization of quality issues. Pixels not covered by any triangles retain a value of -1 in the pixel mapping table, are considered invalid pixels, and do not participate in subsequent quality loss calculations.
[0223] Understandably, the above rasterization calculation accurately determines all pixels covered by each triangle in the texture space, effectively avoiding pixel assignment errors caused by the simple bounding box method.
[0224] Finally, all pixels covered by triangles within a continuous region are merged, and duplicate pixels are removed to obtain the complete texture mapping region for that continuous region. Each texture mapping region accurately corresponds to a continuous part of the model surface, establishing a pixel-level correspondence between the model space and the texture space.
[0225] In some embodiments, continuous regions with fewer than a preset minimum threshold of pixels are not recorded to filter noise and avoid interference from small regions on the overall quality assessment results. For example, continuous regions with fewer than 2000 pixels are not recorded.
[0226] To more clearly illustrate the texture processing method provided in the embodiments of this application, please refer to the following exemplary description using a continuous area of a game character's torso as an example: The continuous area of the torso consists of 1500 triangles, and the corresponding second target texture resolution is 1024×1024.
[0227] First, extract the UV coordinates of the three vertices of one of the triangles, which are (0.2, 0.3), (0.25, 0.35), and (0.22, 0.4). Substitute these UV coordinates into the mapping formula to calculate the vertex mapping coordinates as (204, 307), (255, 358), and (225, 409).
[0228] Next, the axis-aligned bounding box of the triangle is calculated, where, The coordinate range is 204 to 255. The coordinates range from 307 to 409, containing a total of 52 × 103 = 5356 pixels.
[0229] Then, coordinate tests were performed on each of the 5356 pixels. After calculation, 2100 pixels were found to be inside the triangle. These 2100 pixels were marked as belonging to the continuous torso region.
[0230] Subsequently, the mapping and testing process was repeated for all 1,500 triangles in the continuous region, and all pixels belonging to the continuous region were collected. Finally, the texture mapping region corresponding to the continuous torso region was obtained, which contained approximately 800,000 effective pixels.
[0231] Understandably, the above method accurately establishes the correspondence between continuous areas of the character's torso and texture pixels, providing an accurate spatial index basis for subsequent region-by-region calculation of texture quality loss.
[0232] Thus, in this embodiment, the vertex coordinates of each triangle corresponding to each continuous region are mapped from the first coordinate system to the second coordinate system corresponding to the second target texture, determining the vertex mapping coordinates of each triangle corresponding to each continuous region. Based on the vertex mapping coordinates of the triangle, the geometry that can wrap the triangle is determined. Then, based on the pixels in the second target texture located within the geometry, the texture mapping area corresponding to each continuous region is determined. This achieves pixel mapping from model geometry to texture space. The positioning of the triangle vertices in texture space is completed through coordinate system transformation. Then, the complete pixel range corresponding to the triangle is determined by using the wrapping geometry. This can accurately match the correspondence between the continuous region of the model and the texture pixel region, avoiding region correspondence errors caused by pixel range matching deviations to a certain extent. At the same time, it can completely cover all texture pixels corresponding to each triangle, avoiding pixel omissions or redundant statistics to a certain extent. This provides an accurate pixel range basis for subsequent region-level quality loss calculation, enabling the quality assessment of each continuous region to be completed based on all corresponding texture pixels, thereby improving the accuracy and reliability of the quality assessment results to a certain extent and adapting to the texture mapping statistics requirements of 3D models with different complexities.
[0233] To more clearly illustrate the texture processing method provided in the embodiments of this application, please also refer to... Figure 2 , Figure 3 , Figure 4 , Figure 5 , Figure 6 And the following exemplary description, Figure 2 This is a schematic flowchart illustrating the texture processing method provided in an embodiment of this application. Figure 3 This is a schematic diagram of the inverted index and delayed callback data structure provided in an embodiment of this application. Figure 4 This is a schematic diagram of UV island division and pixel mapping provided in an embodiment of this application. Figure 5 This is a schematic diagram of the perception-weighted loss calculation provided in an embodiment of this application. Figure 6This is a schematic diagram of the visible baking process provided in an embodiment of this application. Figure 7 This is a schematic diagram of cosine-weighted hemispherical sampling provided in an embodiment of this application. Figure 8 This is a schematic diagram of the visibility-weighted data flow provided in the embodiments of this application, namely: like Figure 2 and Figure 3 As shown, in the preprocessing stage, index data construction and target callback function registration are performed first. The electronic device traverses all 3D model resources in the target game, prioritizing the processing of the highest precision level 3D models, i.e., LOD0 models. During the traversal, the model name is scanned. If the model name contains the LOD mark and the level is not 0, it is skipped directly. Low precision level models are only rendered at a distance, and the texture quality loss has a smaller impact on the player's perception.
[0234] For each retained LOD0 model, load the mesh data and material data associated with that model, extract the texture identifiers referenced by each material group from the parameter list of the material data, and validate the identifiers in 8-4-4-4-12 hexadecimal format to exclude invalid references.
[0235] Subsequently, as Figure 2 As shown, an inverted index is constructed, with the texture identifier as the key and the value being a list of all model group records that reference the texture. Each record contains the model identifier, material group index, mesh data path, and material data path.
[0236] like Figure 3 As shown, after the reverse index is built, a lightweight delayed callback function is registered for each record in the reverse index. The callback function only captures the mesh data file path and material group index, without pre-compiling any pixel-level data. The callback payload contains the globally unique identifier (GUID) of the texture and the build resolution, the model GUID and material group index, and the pre-computed UV island data, i.e., the pixel map.
[0237] In some embodiments, a texture may be referenced by multiple models at the same time, and the reverse index ensures that all model groups referencing the texture can register callbacks on the same texture.
[0238] like Figure 2 and Figure 3 As shown, after the first target texture completes the assetization process, i.e., scaling and / or compression, to obtain the second target texture, the electronic device queries the reverse index through the texture identifier, triggers all associated delayed callbacks, and performs UV island division and mapping.
[0239] like Figure 2 and Figure 4As shown, firstly, all triangles corresponding to the target material associated with the first target texture are extracted from the target model to form a set of triangles to be processed.
[0240] Subsequently, the triangle set is divided into multiple continuous regions, namely UV islands, through UV edge connectivity analysis and disjoint-set analysis. The specific process is as follows: create an independent disjoint-set for each filtered triangle, traverse the three edges of each triangle, and construct the edge key by representing the precise position of the UV coordinates of the two endpoints of the edge. If two triangles share the same UV edge key, they are merged into the same set through disjoint-set. The path finding adopts a path semi-compression strategy, and the merging adopts a rank merging strategy to ensure near-linear time complexity.
[0241] After the traversal is complete, each distinct root node is assigned a consecutive region number starting from 0, and the set of triangles corresponding to each number is a consecutive region.
[0242] Subsequently, rasterization is performed to create a pixel-island mapping table, i.e., a pixelMap. A pixel mapping table with the same resolution as the second target texture is created, and all elements are initialized to -1 to indicate that they are not covered by any contiguous area.
[0243] For each triangle in each continuous region, map the UV coordinates of the three vertices from the first coordinate system to the second coordinate system corresponding to the second target texture.
[0244] Then, the axis-aligned bounding box of the triangle in pixel space is calculated. For each pixel within the bounding box, a centroid coordinate test is performed to determine whether the pixel is inside the triangle. For pixels that pass the test, the value of the pixel in the pixel map table is set as the number of the continuous region to which the triangle belongs. At the same time, the UV space bounding box and centroid coordinates of each continuous region are calculated for subsequent source tracing.
[0245] like Figure 4 As shown, UV island 0 (face region), UV island 1 (torso region), and UV island 2 (shoe sole region) in the original texture space, after UV edge connectivity and disjoint-set analysis, correspond to pixel regions numbered 0, 1, and 2 respectively in the pixel mapping table. Uncovered pixels are marked as -1. Among them, UV island 0 is a high-visibility region with a large impact on quality loss, UV island 1 is a medium-visibility region, and UV island 2 is a low-visibility region with negligible quality loss.
[0246] like Figure 2 and Figure 5 As shown, after the pixel mapping table is constructed, island-by-island loss accumulation is performed. First, the perceptual weighted difference between the first target texture (Mip0 original texture) and the second target texture (Mip1 upsampled texture) is calculated pixel by pixel. The channel difference of each pixel is calculated first.
[0247] Then, different perceptual weighting formulas are applied according to the texture type. For ordinary textures without an alpha channel, the loss value calculation formula is as follows: For a regular texture containing an alpha channel, the formula for calculating the loss value is: For normal maps, first change the pixel values from... Decoded as The formula for calculating the loss value is: (The formula is missing from the provided text.) ,in, The normal vector for the first target texture. The normal vector for the second target texture.
[0248] In some embodiments, the design of the above weighting coefficients is based on the following: the human eye is most sensitive to the green channel and has the highest weight, which can be set to 0.72 or 0.54; it is least sensitive to the blue channel and has the lowest weight, which can be set to 0.07 or 0.052; the Alpha channel has a relatively high weight of 0.243; errors in the Alpha channel can lead to visible edge artifacts.
[0249] After completing the pixel-by-pixel loss calculation, island-by-island loss aggregation is performed. Each valid pixel in the pixel mapping table (i.e., pixels with a mapping value other than -1) is traversed, and the loss value of that pixel is added to the total loss counter of its corresponding contiguous region. Simultaneously, the pixel counter of that contiguous region is incremented by 1. The unweighted average loss for each contiguous region is equal to the total loss value of that region divided by the pixel count. The loss value range is... 0 indicates that they are exactly the same, and 1 indicates that they are the most different.
[0250] In some embodiments, no records are output for continuous regions with fewer than a minimum threshold of 2000 pixels to filter noise.
[0251] In addition, in some embodiments, the texture is used as the outer loop to ensure that the pixel differences of the same texture are calculated only once, so as to avoid repeated calculations when the same texture is referenced by multiple models.
[0252] At the same time, such as Figure 2 and Figure 8 As shown, visibility baking is performed, which is processed on a model-by-model basis and decoupled from the loss calculation pipeline via disk files.
[0253] like Figure 8As shown, the input for visibility baking is the mesh data, UV data, and normal data of the 3D model. First, SAH-BVH accelerated structure construction is performed. Using all material groups of triangles in the complete model as units, a surface area heuristic hierarchical bounding box is constructed. During the construction process, the space is evenly divided into 8 buckets on each of the X / Y / Z axes, generating 7 candidate split positions per axis, for a total of 21 candidate split methods. The cost of each split method is calculated and the method with the lowest cost is selected. When the optimal split cost is not lower than the number of triangles in the current node or the number of triangles is lower than the leaf threshold of 4, the splitting stops and leaf nodes are created.
[0254] Subsequently, the BVH built with the complete model can correctly detect self-occlusion across material group boundaries. At the same time, the outer layer adopts a model serial processing strategy to ensure that only one BVH exists in memory at any given time, effectively controlling memory peaks.
[0255] After completing the BVH construction, texel-world space mapping is performed. The rasterization method is reused to calculate the world space position and normal direction of each texel covered by a triangle in the UV space, i.e., the second pixel, by interpolating the barycentric coordinates, and generate a texelMap.
[0256] Subsequently, as Figure 7 As shown, cosine-weighted hemispherical ray sampling is performed. Figure 7 This demonstrates the cosine-weighted hemispherical sampling process on a single texel: a normal is extended upwards from a texel point on the model surface, and an upper hemisphere is defined centered on this normal. All sampled rays are emitted within this hemisphere. Rays that hit the model's own geometry are marked as occluded, i.e., blocked. Figure 7 The ray marked with X is a typical occluded ray. In the specific sampling process, Mallley's Method can be used to generate directions that conform to a cosine distribution. The specific process is as follows: First, generate two independent uniform random numbers. and ,and and The range of values is Then, the sampling radius is calculated. Sampling angle And determine the sampling direction components in the local coordinate system as .
[0257] Finally, the local orientation is transformed to world space using the TBN matrix. In some embodiments, the probability density of the sampling direction must conform to a cosine distribution, with the highest sampling density near the normal direction and the lowest density in the grazing direction.
[0258] In some embodiments, 64 sampling rays are emitted for each texel by default, and arbitrary hit queries are performed through BVH. The maximum detection distance of the rays is set to detect only local self-occlusion. A deterministic pseudo-random number generator is used with the texel index as a seed to ensure that the results are reproducible.
[0259] Subsequently, as Figure 2 and Figure 6 As shown, visibility calculation is performed, and the formula for calculating the visibility value is: ,in, The number of rays that are blocked. The total number of rays is used to quantize the calculated visibility value. The uint8 integer, where 0 represents complete occlusion and 255 represents complete visibility.
[0260] In some embodiments, visibility baking can adopt a multi-threaded parallel strategy of serial outer model and parallel inner texel model. The inner layer distributes texels through atomic counters to achieve automatic load balancing. BVH is a read-only structure that is naturally thread-safe and does not require locking.
[0261] Finally, output R8 grayscale visibility data with a default resolution of 512x512. Each model, material group, and texture combination has a corresponding visibility data file written to the disk cache, while recording statistical information such as average visibility and the number of covered texels.
[0262] After completing the island-by-island loss accumulation and visibility baking, as Figure 2 and Figure 8 As shown, visibility weighting is performed. First, the corresponding R8 visibility data file is loaded from the disk cache based on the current texture identifier, model identifier, and material group index triplet. If the resolution of the visibility data is different from the actual construction resolution of the second target texture, bilinear interpolation resampling is performed to align the visibility data resolution with the texture resolution. Since visibility is a low-frequency signal, bilinear interpolation accuracy is sufficient.
[0263] Subsequently, the loss accumulation was modified to a visibility-weighted accumulation. For each valid pixel, the visibility value corresponding to that pixel was first normalized by dividing it by 255.0. The range of weighting factors is used, and then the initial loss value of the pixel is multiplied by this weighting factor to obtain the visibility-weighted loss value, as shown in the formula: .
[0264] In some embodiments, the visibility-weighted loss value can be accumulated into the visibility-weighted loss counter of the corresponding contiguous region, while the weighting factor itself can be accumulated into the visibility weight accumulator of the contiguous region. The final record for each contiguous region includes the unweighted average loss, the visibility-weighted average loss, and the average visibility, wherein the visibility-weighted average loss is equal to the total visibility-weighted loss of the contiguous region divided by the pixel count, and the average visibility is equal to the accumulated visibility weight value of the contiguous region divided by the pixel count.
[0265] In addition, in some embodiments, if visibility baking is not performed, the visibility weight is 1.0 by default, and the loss calculation result is completely consistent with that when weighting is not enabled, so as to ensure that different schemes can be used independently.
[0266] Subsequently, after completing the island-by-island loss accumulation and / or visibility baking, a UVIslandLossRecord array is generated. Each record contains textureGuid (unique texture identifier), modelGuid (source model identifier), groupIdx (material group index), islandId (unique UV island sequence number), pixelCount (island coverage pixel count), mipDiffLoss (island-by-island quality loss), avgR / avgG / avgB (island-by-island average color channel value), and bboxMin / MaxU / V (UV spatial axis aligned bounding boxes).
[0267] Finally, as Figure 2 As shown, global aggregation and ranking output are performed. After the UVIslandLossRecords of all continuous regions of all textures are imported into global storage, the electronic device performs multi-dimensional group statistics and outputs the number of records, average loss, variance and total number of pixels for each group. In some embodiments, grouping can be performed by category, i.e., 16 combinations of Mipmap level, whether compressed, and whether normal map.
[0268] In some embodiments, the loss distribution of all continuous regions of a texture can be viewed by texture grouping, or the loss distribution of all continuous regions referenced by a model can be viewed by model grouping.
[0269] Finally, all records are sorted in descending order by visibility-weighted average loss, and a Top-N quality problem leaderboard is output. Each record in the leaderboard carries complete traceability information, including model identifier, material group index, texture identifier, and continuous region number. Developers can directly locate specific surface parts of a specific model from the leaderboard entries.
[0270] In a distributed asset building environment, each computing node independently generates UV island record logs. Incremental aggregation tools can automatically scan the distributed building output directory, discover newly added or updated node logs, and import the records into a unified database. For records with the same unique key, the new record overwrites the old record to ensure data timeliness. Finally, multi-dimensional statistics and ranking outputs are performed on the unified database.
[0271] To facilitate better implementation of the texture processing method in the embodiments of this application, the embodiments of this application also provide a texture processing apparatus. Please refer to... Figure 9 , Figure 9 This is a schematic diagram of the structure of a texture processing apparatus provided in an embodiment of this application. The texture processing apparatus 200 may include: The first determining module 210 is used to determine the target model in the target game that is associated with the first target texture, wherein the target material of the target model includes the first target texture; The processing module 220 is used to perform assetization processing on the first target texture to obtain the second target texture, wherein the assetization processing includes scaling processing and / or compression processing. The second determining module 230 is used to determine the mapping position of each continuous region on the surface of the target model in the second target texture, so as to obtain the texture mapping area corresponding to each continuous region. The estimation module 240 is used to estimate the quality of the second target texture in each texture mapping region based on the difference between the first target texture and the second target texture in each texture mapping region, and the visibility parameters of the continuous regions corresponding to each texture mapping region, wherein the visibility parameters are used to indicate the degree to which continuous regions on the target model are occluded.
[0272] In some embodiments, the visibility parameter includes a target weight sub-parameter for the second pixel corresponding to each first pixel in each texture mapping region on the surface of the target model, wherein each target weight sub-parameter is used to indicate the degree to which the corresponding second pixel is occluded by other pixels on the surface of the target model; the estimation module 240 can also be used to obtain the initial pixel loss value of the first target map and the second target map on each first pixel based on the difference between the first target map and the second target map on each first pixel; determine the target weight sub-parameter for the second pixel corresponding to each first pixel in each texture mapping region on the surface of the target model; and estimate the quality of each texture mapping region based on the initial pixel loss value of each first pixel in each texture mapping region and the target weight sub-parameter corresponding to each first pixel.
[0273] In some embodiments, the estimation module 240 can also be used to perform weighted summation on the difference between each first pixel in the first target map and each first pixel in the second target map in each color channel, and the first target weight corresponding to each color channel, when both the first target map and the second target map are maps that include or do not include an alpha channel, to obtain the initial pixel loss value of each pixel.
[0274] In some embodiments, the estimation module 240 can also be used to determine the first normal vector of each pixel of the first target map based on the pixel value of each first pixel of the first target map when the first target map and the second target map are normal maps, and to determine the second normal vector of each pixel of the second target map based on the pixel value of each pixel of the second target map; and to determine the difference between the dot product of the first normal vector and the second normal vector of each pixel and a preset value, so as to obtain the initial pixel loss value of each pixel.
[0275] In some embodiments, the estimation module 240 can also be used to construct a spatial acceleration structure corresponding to the target model; determine the position and normal direction of each second pixel on the surface of the target model in the coordinate system corresponding to the target model; and perform cosine-weighted hemispherical ray sampling on each second pixel according to the normal direction to determine the sampling ray corresponding to each second pixel; perform occlusion query on the sampling ray corresponding to each second pixel through the spatial acceleration structure to determine the degree to which each second pixel is occluded by other pixels on the surface of the target model, and obtain the target weight sub-parameter of each second pixel.
[0276] In some embodiments, the spatial acceleration structure is a hierarchical bounding box constructed heuristically using surface area.
[0277] In some embodiments, the estimation module 240 can also be used to perform occlusion queries on the sampling rays corresponding to each second pixel through a spatial acceleration structure to obtain an estimated score of the degree of occlusion of each second pixel by other pixels on the surface of the target model; and map the estimated score of each second pixel to a preset numerical range to obtain the target weight sub-parameter of each second pixel.
[0278] In some embodiments, the estimation module 240 can also be used to perform weighted summation on the initial pixel loss value of each first pixel in each texture mapping region and the target weight sub-parameter corresponding to each first pixel to obtain the target pixel loss value of each texture mapping region; and determine the average difference of each pixel in each texture mapping region based on the target pixel loss value of each texture mapping region and the number of pixels in the region, so as to obtain the quality estimate of each texture mapping region.
[0279] In some embodiments, the first determining module 210 may also be used to construct index data of the first target texture to determine the target model associated with the first target texture in the target game through the index data, wherein the index data is used to indicate the target model containing the target material.
[0280] In some embodiments, the first determining module 210 can also be used to register a target callback function according to index data, wherein the target callback function is used to access the target material and the target model when triggered; the processing module 220 can also be used to perform assetization processing on the first target texture; and after assetization processing, trigger the target callback function to obtain the second target texture.
[0281] In some embodiments, the first determining module 210 can also be used to parse the mesh data and material data of each three-dimensional model in the target game, determine the model material and the textures included in the model material of each three-dimensional model, and construct index data based on the first target texture and the model material and the textures included in the model material of each three-dimensional model.
[0282] In some embodiments, the first determining module 210 can also be used to parse the mesh data and material data of each 3D model at the highest precision level in the target game, and determine the model material and textures included in the model material of each 3D model.
[0283] In some embodiments, the second determining module 230 may further be used to divide the set of triangles corresponding to the target material associated with the first target texture in the target model into at least one continuous region; and determine the texture mapping region corresponding to each continuous region based on the pixel region covered by each continuous region on the second target texture.
[0284] In some embodiments, the second determining module 230 can also be used to construct a side key based on the coordinates of the two endpoints of each side of each triangle; merge the two triangles into the same set when two triangles have sides with the same side key; and determine all triangles belonging to the same set as a continuous region.
[0285] In some embodiments, the second determining module 230 may further be used to map the vertex coordinates of each triangle corresponding to each continuous region from the first coordinate system to the second coordinate system corresponding to the second target texture, determine the vertex mapping coordinates of each triangle corresponding to each continuous region; determine the geometry that can wrap the triangle based on the vertex mapping coordinates of the triangle; and determine the texture mapping region corresponding to each continuous region based on the pixels in the second target texture located within the geometry.
[0286] Each unit in the above-mentioned texture processing device can be implemented entirely or partially through software, hardware, or a combination thereof. Each unit can be embedded in or independent of the processor in the electronic device in hardware form, or stored in the memory of the electronic device in software form, so that the processor can call and execute the operations corresponding to each unit.
[0287] The texture processing device 200 can be integrated into a terminal or server that has memory and a processor and thus computing power, or the texture processing device 200 can be the terminal or server.
[0288] Optionally, this application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0289] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may be a terminal or a server. Figure 10 As shown, the electronic device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 and the memory 302 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figures does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0290] The processor 301 is the control center of the electronic device 300. It connects various parts of the electronic device 300 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 302, and calling data stored in the memory 302, it executes various functions of the electronic device 300 and processes data, thereby performing overall processing of the electronic device 300.
[0291] In this embodiment, the processor 301 in the electronic device 300 loads the instructions corresponding to the processes of one or more computer programs into the memory 302 according to the following steps, and the processor 301 runs the computer programs stored in the memory 302 to realize various functions: Identify the target model in the target game that is associated with the first target texture, wherein the target material of the target model includes the first target texture; The first target texture is processed into an asset to obtain the second target texture. The asset processing includes scaling and / or compression. Determine the mapping position of each continuous region on the surface of the target model in the second target texture, and obtain the texture mapping area corresponding to each continuous region; Based on the difference between the first target texture and the second target texture in each texture mapping region, and the visibility parameters of the continuous regions corresponding to each texture mapping region, the quality of the second target texture in each texture mapping region is estimated, wherein the visibility parameters are used to indicate the degree to which continuous regions on the target model are occluded.
[0292] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0293] Optional, such as Figure 10 As shown, the electronic device 300 also includes: a display screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the display screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 10 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0294] The display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program. Optionally, the touch panel may include a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, and transmits the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 301, and can receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel according to the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the display screen 303 can also be used as part of the input unit 306 to achieve input functions.
[0295] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0296] Audio circuitry 305 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 305 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 305, converted back into audio data, and then processed by processor 301 before being transmitted via radio frequency circuitry 304 to, for example, another electronic device, or output to memory 302 for further processing. Audio circuitry 305 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.
[0297] The input unit 306 can be used to receive input numbers, characters, or object feature information (such as fingerprints, irises, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0298] Power supply 307 is used to supply power to various components of electronic device 300. Optionally, power supply 307 can be logically connected to processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 307 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0299] although Figure 10 As not shown in the diagram, the electronic device 300 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0300] This application also provides a computer-readable storage medium for storing a computer program. This computer-readable storage medium can be applied to a computer device, and the computer program causes the computer device to execute the corresponding process in the texturing method described in the embodiments of this application; for brevity, further details are omitted here.
[0301] This application also provides a computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the corresponding process in the texturing method described in the embodiments of this application. For simplicity, further details are omitted here.
[0302] This application also provides a computer program comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the corresponding process in the texturing method of this application; for brevity, further details are omitted here.
[0303] It should be understood that the processor in this application may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor described above can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0304] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0305] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0306] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0307] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0308] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0309] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0310] In addition, the functional units in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0311] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer or a server) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0312] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for processing textures, characterized in that, The method includes: Identify a target model in the target game that is associated with a first target texture, wherein the target material of the target model includes the first target texture; The first target texture is processed into an asset to obtain a second target texture, wherein the asset processing includes scaling and / or compression. Determine the mapping position of each continuous region on the surface of the target model in the second target texture, and obtain the texture mapping region corresponding to each continuous region; Based on the differences between the first target texture and the second target texture in each texture mapping region, and the visibility parameters of the continuous regions corresponding to each texture mapping region, the quality of the second target texture in each texture mapping region is estimated, wherein the visibility parameters are used to indicate the degree to which the continuous regions on the target model are occluded.
2. The texture processing method according to claim 1, characterized in that, The visibility parameter includes a target weight sub-parameter for the second pixel corresponding to each first pixel in each of the texture mapping regions on the surface of the target model. Each target weight sub-parameter is used to indicate the degree to which the corresponding second pixel is occluded by other pixels on the surface of the target model. The step of estimating the quality of the second target texture in each texture mapping region based on the differences between the first target texture and the second target texture in each texture mapping region, and the visibility parameters of the continuous regions corresponding to each texture mapping region, includes: Based on the difference between the first target texture and the second target texture at each first pixel, the initial pixel loss value of the first target texture and the second target texture at each first pixel is obtained; Determine the target weight sub-parameters for each second pixel corresponding to each first pixel in each of the texture mapping regions on the surface of the target model; The quality of each texture mapping region is estimated based on the initial pixel loss value of each first pixel in each texture mapping region and the target weight sub-parameter corresponding to each first pixel.
3. The texturing method according to claim 2, characterized in that, The step of obtaining the initial pixel loss value of the first target map and the second target map at each first pixel based on the difference between the first target map and the second target map at each first pixel includes: When both the first target texture and the second target texture are textures that include or do not include an alpha channel, the difference between each first pixel in the first target texture and each first pixel in the second target texture in each color channel, as well as the first target weight corresponding to each color channel, are weighted and summed to obtain the initial pixel loss value of each pixel.
4. The texturing method according to claim 2, characterized in that, The step of obtaining the initial pixel loss value of the first target map and the second target map at each first pixel based on the difference between the first target map and the second target map at each first pixel includes: When the first target texture and the second target texture are normal textures, the first normal vector of each pixel of the first target texture is determined based on the pixel value of each first pixel of the first target texture, and the second normal vector of each pixel of the second target texture is determined based on the pixel value of each pixel of the second target texture. The difference between the dot product of the first normal vector and the second normal vector of each pixel and a preset value is determined to obtain the initial pixel loss value of each pixel.
5. The texturing method according to claim 2, characterized in that, The step of determining the target weight sub-parameters for the second pixel corresponding to each first pixel in each of the texture mapping regions on the surface of the target model includes: Construct the spatial acceleration structure corresponding to the target model; Determine the position and normal direction of each second pixel on the surface of the target model in the coordinate system corresponding to the target model; Based on the normal direction, cosine-weighted hemispherical ray sampling is performed on each second pixel to determine the sampling ray corresponding to each second pixel; By performing occlusion queries on the sampling rays corresponding to each second pixel through the spatial acceleration structure, the degree to which each second pixel is occluded by other pixels on the surface of the target model is determined, and the target weight sub-parameter of each second pixel is obtained.
6. The texturing method according to claim 2, characterized in that, The step of estimating the quality of each texture mapping region based on the initial pixel loss value of each first pixel in each texture mapping region and the target weight sub-parameter corresponding to each first pixel includes: For each first pixel in each texture mapping region, the initial pixel loss value is summed with the target weight sub-parameter corresponding to each first pixel to obtain the target pixel loss value for each texture mapping region. Based on the target pixel loss value and the number of pixels in each texture mapping region, the average difference of each pixel in each texture mapping region is determined to obtain a quality estimate for each texture mapping region.
7. The texture processing method according to claim 1, characterized in that, The determination of the target model associated with the first target texture in the target game includes: An index of the first target texture is constructed to determine the target model associated with the first target texture in the target game, wherein the index data is used to indicate the target model containing the target material.
8. The texture processing method according to claim 7, characterized in that, The method further includes: Register a target callback function based on the index data, wherein the target callback function is used to access the target material and the target model when triggered; The step of assetizing the first target texture to obtain the second target texture includes: The first target texture is processed into an asset; After the assetization process, the target callback function is triggered to obtain the second target texture.
9. The texture processing method according to claim 7, characterized in that, The index data for constructing the first target texture includes: The mesh data and material data of each 3D model in the target game are analyzed to determine the model material and the textures included in the model material for each 3D model. The index data is constructed based on the first target texture, the model material of each 3D model, and the textures included in the model material.
10. The texture processing method according to claim 1, characterized in that, Determining the mapping position of each continuous region on the surface of the target model in the second target texture, and obtaining the texture mapping region corresponding to each continuous region, includes: The set of triangles corresponding to the target material associated with the first target texture in the target model is divided into at least one continuous region. Based on the pixel area covered by each of the continuous regions on the second target texture, the texture mapping area corresponding to each of the continuous regions is determined.
