Map processing method and device, and electronic equipment
By utilizing texture importance and object classification principles within the game engine to generate texture sets and merge them into templates, the problem of low texture processing efficiency in existing technologies is solved, enabling batch processing and efficient merging of textures.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2022-10-26
- Publication Date
- 2026-07-31
AI Technical Summary
The existing technology for merging textures is cumbersome, requiring switching between multiple software programs and folders, resulting in low texture processing efficiency.
Within the game engine, multiple texture sets are generated based on preset texture importance and object classification principles. These textures are then merged using templates of preset sizes, reducing software switching and modification steps.
It enables batch processing of textures, improving processing efficiency and convenience, eliminating the need to repeatedly switch and modify between multiple software programs.
Smart Images

Figure CN115690300B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of texture processing, and in particular to a texture processing method, apparatus, and electronic device. Background Technology
[0002] Game models typically include game character models and game scene models. Game characters generally include player characters and NPC (Non-Player Character) models. NPCs refer to game characters in video games that are not controlled by real players. For games with a large number of game models, such as those requiring a large number of game characters, the batches of player characters or NPCs can increase dramatically. Therefore, the batches can be reduced by merging the textures of various parts. To help developers improve efficiency, the game development engine usually enables the function of merging textures and automatically generates material spheres to be assigned to game characters.
[0003] However, currently, merging textures requires the use of other image processing software, resulting in a complex process. Creators need to switch between multiple software programs or folders, and for parts of the texture that need to be modified, they need to make repeated modifications in multiple software programs, which is inconvenient and reduces the efficiency of texture processing. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a texture processing method, apparatus and electronic device to alleviate the above-mentioned technical problems.
[0005] In a first aspect, embodiments of the present invention provide a texture processing method, the method comprising: acquiring textures of multiple objects; classifying the multiple textures according to a preset texture importance level to generate a first texture set containing multiple first textures and a second texture set containing multiple second textures, wherein the texture importance of the first textures is less than the texture importance of the second textures; classifying the multiple first textures contained in the first texture set according to an object classification principle to generate multiple first subsets; wherein each first subset includes multiple first textures of the same object; creating a first texture template of a preset size; sequentially selecting the first textures of each object from each first subset; and arranging the first textures according to a preset first arrangement order. The first merged texture is generated by combining the first texture template with the first merged texture and stored in the first merged texture set. Multiple second textures in the second texture set are classified according to the object classification principle to generate multiple second subsets. Each second subset includes multiple second textures of the same object. A second texture template of a preset size is created. The second texture of each object is selected sequentially from each second subset. Any first merged texture is selected from the first merged texture set. The second texture and the first merged texture are merged into the second texture template according to a preset second arrangement order to generate a second merged texture and stored in the second merged texture set.
[0006] Secondly, embodiments of the present invention also provide a texture processing apparatus, the apparatus comprising: an acquisition module for acquiring textures of multiple objects; a classification module for classifying the multiple textures according to a preset texture importance level, generating a first texture set containing multiple first textures and a second texture set containing multiple second textures, wherein the texture importance level of the first textures is less than that of the second textures; a first classification module for classifying the multiple first textures contained in the first texture set according to an object classification principle, generating multiple first subsets; wherein each first subset includes multiple first textures of the same object; and a first merging module for creating a first texture template of a preset size, sequentially selecting the first textures of each object from each first subset, and merging them according to a preset first arrangement order. The first texture is merged into the first texture template to generate a first merged texture corresponding to the first texture, and the first merged texture is stored in the first merged texture set; the second classification module is used to classify the multiple second textures contained in the second texture set according to the object classification principle to generate multiple second subsets; wherein, each second subset includes multiple second textures of the same object; the second merging module is used to create a second texture template of a preset size, sequentially select the second texture of each object from each second subset, and select any one of the first merged textures from the first merged texture set, merge the second texture and the first merged texture into the second texture template according to a preset second arrangement order to generate a second merged texture, and store the second merged texture in the second merged texture set.
[0007] Thirdly, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the texture processing method described in the first aspect.
[0008] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, performs the steps of the texture processing method described in the first aspect.
[0009] The embodiments of the present invention bring the following beneficial effects:
[0010] The texture processing method, apparatus, and electronic device provided in this invention can acquire textures of multiple objects, classify the multiple textures according to a preset texture importance, generate a first texture set containing multiple first textures and a second texture set containing multiple second textures, and then classify the multiple first textures contained in the first texture set according to the object classification principle to generate multiple first subsets; and create a first texture template of a preset size, sequentially select the first texture of each object from each first subset, and merge the first textures into the first texture template according to a preset first arrangement order to generate a first merge corresponding to the first texture. First, the second textures are applied. Then, according to the object classification principle, the multiple second textures contained in the second texture set are classified to generate multiple second subsets. A second texture template of a preset size is created. The second texture of each object is selected sequentially from each second subset. In addition, any first merged texture is selected from the first merged texture set. The second textures and the first merged textures are merged into the second texture template according to the preset second arrangement order to generate the second merged texture. During the process, there is no need to switch and modify repeatedly between multiple production software to achieve batch processing of textures, which not only improves convenience but also improves the efficiency of texture processing.
[0011] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.
[0012] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0013] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0014] Figure 1 A flowchart of a texture processing method provided in an embodiment of the present invention;
[0015] Figure 2 This is a schematic diagram of a second merged texture provided in an embodiment of the present invention;
[0016] Figure 3 This is a schematic diagram of the structure of a texture processing device provided in an embodiment of the present invention;
[0017] Figure 4 This is a schematic diagram of another texture processing device provided in an embodiment of the present invention;
[0018] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Typically, games with a large number of game models tend to experience a sharp increase in model batches. For example, in games with many characters, the batches for player characters or NPCs will increase dramatically. Therefore, merging textures from different parts is often used to reduce the number of batches.
[0021] Currently, common texture processing methods often rely on image processing software like Photoshop to manually merge textures together, then import them into the engine to create materials, and finally assign these materials to the game character model. This process is quite complex, requiring switching between multiple software programs and folders. Furthermore, the textures of the game character must first be imported from outside the engine into image processing software like Photoshop. A character's textures typically consist of seven parts, each with three texture maps: a color map, a normal map, and a material map. This requires manually processing 21 texture maps. After importing them into the engine, materials still need to be manually created and assigned to the game character model. If the composition of the game character's blocks needs to be changed, repeated modifications are required across different software programs, which is inconvenient and reduces the efficiency of texture processing.
[0022] Based on this, the texture processing method, apparatus and electronic device provided in the embodiments of the present invention can complete the operations that previously required manual processing in batches within the engine, which is quick and convenient. Even if the parts to be replaced are combined, only batch processing is required again.
[0023] To facilitate understanding of this embodiment, a texture processing method disclosed in this embodiment of the invention will first be described in detail.
[0024] In one possible implementation, embodiments of the present invention provide a texture processing method that can be applied to a game engine for processing textures.
[0025] Specifically, such as Figure 1 The flowchart shown illustrates a texture processing method, which includes the following steps:
[0026] Step S102: Obtain textures for multiple objects;
[0027] In practical use, the textures of the aforementioned multiple objects include textures of game characters as well as textures of game scene models. Taking a game character as an example, a game character is usually composed of multiple body parts and items attached to the body parts. Therefore, when the aforementioned objects are game characters, the aforementioned multiple objects usually include the body parts of the game character and / or items attached to the body parts. Specifically, it may include only at least one body part, or only at least one item attached to the body part, or both body parts and items attached to the body parts, etc.
[0028] For example, body parts include the upper body, lower body, head, hands, and feet. Items attached to body parts generally refer to weapons, equipment, or props worn by game characters, such as backpacks and costumes. Each batch of game characters can select appropriate objects based on actual usage. If the number of game characters in the game is large, causing a sharp increase in batches, only the texture of one object can be changed in each batch of game characters, such as the upper body, lower body, or costume, to create a new batch of game characters. Therefore, the aforementioned multiple textures usually include textures of multiple objects to facilitate further processing of the textures of multiple objects according to the actual needs of the game character.
[0029] Furthermore, for game character textures, there are generally three types of textures: color textures, normal textures, and material textures. When processing textures, the processing method for each type of texture is the same. Therefore, in the above step S102, multiple textures of one type are obtained.
[0030] Step S104: According to the preset importance of the textures, classify the multiple textures to generate a first texture set containing multiple first textures and a second texture set containing multiple second textures;
[0031] Among them, the texture importance of the first texture is less than that of the second texture;
[0032] Step S106: Classify the multiple first textures contained in the first texture set according to the object classification principle to generate multiple first subsets;
[0033] Each first subset includes the first texture of multiple identical objects;
[0034] Step S108: Create a first texture template of a preset size, select the first texture of each object from each first subset in sequence, merge the first textures into the first texture template according to the preset first arrangement order, generate the first merged texture corresponding to the first texture, and store the first merged texture in the first merged texture set;
[0035] Step S110: Classify the multiple second textures contained in the second texture set according to the object classification principle to generate multiple second subsets;
[0036] Each second subset includes multiple second textures of the same object;
[0037] Step S112: Create a second texture template of a preset size, select the second texture of each object from each second subset in sequence, and select any first merged texture from the first merged texture set. Merge the second texture and the first merged texture into the second texture template according to the preset second arrangement order to generate the second merged texture, and store the second merged texture in the second merged texture set.
[0038] In practical use, in order to facilitate the storage of the first and second merged texture sets, corresponding storage units can be set up separately for storage. Furthermore, a general texture set can be pre-established to store the first and second merged texture sets in a unified manner. The specific storage method of the first and second merged texture sets can be set according to the actual usage situation, and the embodiments of the present invention do not limit this.
[0039] The texture processing method provided in this embodiment of the invention can acquire textures of multiple objects, classify the multiple textures according to a preset texture importance, generate a first texture set containing multiple first textures and a second texture set containing multiple second textures, and then classify the multiple first textures contained in the first texture set according to the object classification principle to generate multiple first subsets; and create a first texture template of a preset size, sequentially select the first texture of each object from each first subset, and merge the first textures into the first texture template according to a preset first arrangement order to generate a first merged texture corresponding to the first texture; and then according to The object classification principle categorizes the multiple second textures contained in the second texture set, generating multiple second subsets, and creating a second texture template of a preset size. The second texture of each object is selected sequentially from each second subset, and any first merged texture is selected from the first merged texture set. The second texture and the first merged texture are merged into the second texture template according to a preset second arrangement order to generate the second merged texture corresponding to the texture type. During the process, there is no need to repeatedly switch and modify between multiple production software, which can realize batch processing of textures, improving both convenience and efficiency of texture processing.
[0040] In practical use, since each texture processing step is performed on a specific texture type, all textures in the game need to be categorized by texture type before processing. Specifically, in step S102 above, when obtaining textures for multiple objects, all textures included in the game can be obtained; then, according to preset texture types, all textures are categorized by type to obtain multiple textures corresponding to each texture type, and the textures corresponding to each texture type are obtained. The texture types include at least one of the following: color texture, normal texture, and material texture.
[0041] Furthermore, color maps mainly consist of three types: Diffuse, Albedo, and Base Color, which are generally considered equivalent. Normal maps, also known as bump maps, generally include three types: Bump, Normal, and Displacement. All three types of maps can provide more detail to the game character model. Material maps are used to reflect the material of the game character model, such as metal, non-metal, roughness, specular reflectivity, etc.
[0042] Specifically, since different texture types have suffixes in their storage paths, three string lists can be created for type classification. All textures can be iterated through, and color textures, normal textures, and material textures (e.g., albedo, normal, material) can be distinguished by their suffixes. The paths of these distinguished textures can then be stored in newly created string lists, such as albedoTextureList, materialTextureList, and normalTextureList. These three lists can serve as texture categories for each texture type. During texture processing, one of these lists can be processed first, continuing until all three lists are processed. At this point, the second merged texture for each texture type can be obtained, resulting in the merged color texture, normal texture, and material texture for a game character.
[0043] Furthermore, after the textures of the three lists have been processed, the second merged texture corresponding to each texture type can be obtained, and the second merged texture corresponding to each texture type can be merged to generate a model texture. The model texture is then assigned to a pre-built material ball model, and the character model is generated based on the model texture through the material ball model.
[0044] To make it easier to understand, let's take the texture processing process of one type of texture as an example. For example, we first process the color texture. In this case, the textures of the multiple objects obtained in step S102 above are multiple textures in the texture list of the color texture, such as the multiple textures in albedoTextureList mentioned above.
[0045] After obtaining the aforementioned multiple textures, they can be further categorized according to a preset importance level. This categorization process is typically based on the textures' naming identifiers. This is because textures for different objects generally include the object's identifier in their names during storage, facilitating differentiation. For example, textures for objects like hands, shoes, backpacks, and equipment have identifiers like "hands," "shoes," "backpack," and "equip," abbreviated as "h," "s," "b," and "e," respectively. Textures for the head, upper body, and lower body have identifiers like "face," "clothes," and "pants," abbreviated as "f," "c," and "p," respectively. Therefore, textures can be categorized according to their preset importance level using their naming identifiers.
[0046] The specific classification process includes the following steps:
[0047] (1) Obtain the naming identifier for each texture;
[0048] (2) If the name identifier belongs to the name identifier included in the preset first texture importance level, then the corresponding texture is divided into the first texture and the first texture is stored in the pre-established first texture set;
[0049] (3) If the name identifier belongs to the name identifier included in the preset second texture importance level, then the corresponding texture is divided into the second texture and the second texture is stored in the pre-established second texture set;
[0050] The first texture is less important than the second texture.
[0051] Specifically, the naming identifier included in the importance of the first texture generally includes the naming identifier of the texture of the first object; the first object is one or more of multiple objects, wherein, taking a game character as an example, the multiple objects in the embodiments of the present invention include the body parts of the game character and / or items equipped on the body parts.
[0052] The importance of the second texture includes the naming identifier of the texture of the second object. The second object is any object other than the first object mentioned above. Generally, the importance of the texture of the first object is lower than that of the texture of the second object. Therefore, the second object usually refers to the texture of the relatively important body part among the textures of multiple objects, such as the upper body, lower body, and head. Other body parts and items are generally classified as second objects.
[0053] For example, textures for multiple objects in a game character include textures for the upper body, lower body, head, hands, shoes, backpack, and equipment. The naming identifiers for the first texture importance can include the naming identifiers for textures of hands, shoes, backpack, and equipment; while the naming identifiers for the second texture importance typically include the naming identifiers for textures of the upper body, lower body, and head. That is, the textures for the upper body, lower body, and head are more important than those for hands, shoes, backpack, and equipment. Therefore, when classifying multiple textures, the naming identifiers can be used to determine which textures are first-level and which are second-level.
[0054] Specifically, if the naming identifier belongs to any of the naming identifiers of the texture of the first object, then the texture corresponding to the naming identifier is classified as the first texture. For example, among the textures of the above multiple objects, if the naming identifier is any of the naming identifiers of the hand, shoe, backpack, and equipment, then the texture corresponding to the naming identifier is classified as the first texture.
[0055] Furthermore, if the naming identifier belongs to any of the naming identifiers of the texture of the second object, then the texture corresponding to the naming identifier is classified as the second texture. For example, among the textures of the above multiple objects, if the naming identifier is any of the naming identifiers of the upper body, lower body, and head, then the texture corresponding to the naming identifier is classified as the second texture.
[0056] In practical use, the first texture mentioned above is also called a small texture, meaning that textures of objects such as hands, shoes, backpacks, and equipment are small textures. The second texture mentioned above is also called a large texture, meaning that textures of objects such as the upper body, lower body, and head are large textures. When classifying textures based on the above method, the naming identifier can be used to determine which textures in the texture list are large textures and which are small textures. The string information of the texture resource path is then added to the pre-established large texture string list and small texture string list respectively, so as to further classify large and small textures based on the string lists.
[0057] In this embodiment of the invention, when processing the first texture set and the second texture set, the first texture set is processed first, that is, the small textures are processed first, and then the large textures are processed.
[0058] Specifically, steps S106 and S108 are processes for processing the first set of textures, i.e., the small textures. Specifically, they include further classifying the first set of textures and merging the classified first textures.
[0059] The further classification of the first texture set is carried out according to the principle of object classification, specifically including the following steps:
[0060] (1) Construct the first subset corresponding to each first object;
[0061] (3) Traverse the first texture set and place the multiple first textures contained in the first texture set into the first subset corresponding to the first object according to the texture naming identifier.
[0062] Again, taking the first object mentioned above, which includes hands, shoes, backpacks, and equipment, as an example, when classifying, it is necessary to construct the first subset corresponding to hands, shoes, backpacks, and equipment respectively; then, traverse the first texture set. If the first texture is a texture of the hand, then place the first texture into the first subset corresponding to the hand; if the first texture is a texture of the shoe, then place the first texture into the first subset corresponding to the shoe; if the first texture is a texture of the backpack, then place the first texture into the first subset corresponding to the backpack; if the first texture is a texture of the equipment, then place the first texture into the first subset corresponding to the equipment.
[0063] Furthermore, after placing the first texture into the corresponding first subset, the size of the first texture in the first subset needs to be adjusted to a preset first size; wherein, the first size is smaller than the preset size of the first texture template, so that the first texture can be merged into the first texture template in step S108.
[0064] In practical use, when classifying the first texture set according to the object classification principle, it can also be based on a string list. Specifically, the large texture string list and the small texture string list generated in the previous step can be obtained, and the small texture string list, i.e., the first texture, can be processed first.
[0065] Specifically, for the list of small sticker strings, first create an empty list for each small sticker, that is, an empty list corresponding to hands, shoes, backpacks, and equipment; when traversing the first sticker set, the corresponding first sticker (small sticker) can be placed into the corresponding empty list.
[0066] Furthermore, considering that the first image needs to be arranged according to the first arrangement order in subsequent steps, the blank list can be arranged based on the first arrangement order when constructing the blank list.
[0067] For example, in this embodiment of the invention, the first arrangement order is illustrated by arranging the backpack, equipment, shoes, and hands in sequence. It should be understood that in other embodiments, the objects included in the first arrangement order may be arranged in other orders. The specific arrangement order is subject to the actual use, and this embodiment of the invention does not limit it.
[0068] When processing a list of small texture strings, you can first create blank lists corresponding to the small texture objects in the first order. For example, create blank texture lists texture0, texture1, texture2, and texture3, where texture0 is the blank texture list corresponding to the backpack, texture1 is the blank texture list corresponding to the equipment, texture2 is the blank texture list corresponding to the shoes, and texture3 is the blank texture list corresponding to the hands.
[0069] Then iterate through the list of small texture strings. If the texture name contains "b" (backpack), put it into texture0 and then adjust the texture size to the first dimension, such as 256*256. If the texture name contains "e" (equipment), put it into texture1 and then adjust the texture size to the first dimension, such as 256*256. After processing texture2 and texture3 in turn, we can finally get the first subset corresponding to the above hand, shoe, backpack and equipment parts.
[0070] In practical use, the process of traversing the list of small texture strings and creating blank texture lists texture0, texture1, texture2, and texture3 can be achieved using the SortTextureList function. This function can traverse the list of strings, arrange the strings in the list in a specified order, and index the texture resources according to the strings, arranging the textures in the created blank texture list in order.
[0071] Furthermore, based on the aforementioned first subset, in step S108, when merging, a first texture template of a preset size needs to be created. Then, the first texture of each object is selected sequentially from each first subset, and the selected first textures are merged into the corresponding positions on the first texture template according to the first arrangement order, i.e., the arrangement order of backpack, equipment, shoes, and hands, so as to generate the first merged texture corresponding to the first texture.
[0072] Furthermore, considering that not every game character has backpacks and equipment, but shoes (feet) and hands are always present, when selecting the first texture of each object from each first subset, the selection results that do not include the object can be set to empty as needed. For example, no textures can be selected in the first subset of backpacks and equipment. Therefore, when merging using the first texture template, a maximum of four first textures can be merged, and a minimum of two first textures can be merged. In the case of missing parts, it can be judged as a blank texture by default, and then four textures can be added to participate in the merging.
[0073] Furthermore, taking the aforementioned first size of 256*256 as an example, the first texture template of the preset size created above is usually a blank texture of 512*512. During merging, the copyToAltas function can be used to merge the small texture parts into one large texture, that is, to merge four 256*256 first textures into one 512*512 large texture.
[0074] Furthermore, the processing method for the second texture set is the same as that for the first texture set. Taking the textures that need to be processed in the second texture set, including the textures of the upper body, lower body, and head, i.e., large textures, as an example, this will be explained.
[0075] Specifically, step S110 above is the process of processing the large texture image, and this process includes:
[0076] (1) Construct the second subset corresponding to each second object;
[0077] (2) Traverse the second texture set and place the multiple second textures contained in the second texture set into the second subset corresponding to the second object according to the texture name identifier.
[0078] For example, construct the second subsets corresponding to the upper body, lower body, and head respectively; traverse the second texture set, if the second texture is an upper body texture, place the second texture into the second subset corresponding to the upper body; if the second texture is a lower body texture, place the second texture into the second subset corresponding to the lower body; if the second texture is a head texture, place the second texture into the second subset corresponding to the head.
[0079] Furthermore, after placing the second texture into the corresponding second subset, the size of the second texture in the second subset needs to be adjusted to a preset second size; wherein, the second size is smaller than the preset size of the second texture template. Again, taking the first size of 256*256 as an example, the first texture template with the preset size created above is a blank texture of 512*512. At this time, the second size also needs to be set to the same size as the first texture template, i.e., 512*512, so that the second texture and the first merged texture can be merged in subsequent steps.
[0080] Furthermore, when classifying the second texture set according to the object classification principle, it can also be based on a string list. In this case, the large texture string list is being processed. The second subsets corresponding to the upper body, lower body, and head are constructed respectively, which actually create an empty list of large textures. Then, the large texture string list can also be traversed and classified using the SortTextureList function.
[0081] Furthermore, in this embodiment of the invention, the second arrangement order used when classifying the second texture set can also be set according to actual usage, and this embodiment of the invention does not impose any restrictions on this.
[0082] For example, when the second object includes the upper body, lower body, and head, the second arrangement order can be arranged in the order of head, first merged texture, upper body, and lower body. Therefore, when merging according to the second arrangement order, it is necessary to select the second texture of each object from each second subset in turn, and select any first merged texture from the first merged texture set. Then, according to the arrangement order of head, first merged texture, upper body, and lower body, the selected second texture and first merged texture are merged into the corresponding positions on the second texture template to generate the second merged texture corresponding to the texture type.
[0083] In specific implementation, when merging the second texture and the first merged texture, the copyToAltas function can also be used. Taking the first size of 256*256 as an example, when using the copyToAltas function to merge the small texture into a large texture, that is, to merge four 256*256 first textures into a 512*512 large texture. When merging the second texture, it is actually a process of merging the large texture. Therefore, the second size is also 512*512. At this time, the second texture template with the preset size is usually a 1024*1024 blank texture. The copyToAltas function merges the 512*512 second texture (large texture) and the 512*512 first merged texture into a 1024*1024 texture, that is, to merge four 512*512 textures into a 1024*1024 texture, which is the second merged texture in this embodiment of the invention.
[0084] At this point, the second merged texture includes the second texture, as well as the first texture from the first merged texture. For ease of understanding, Figure 2 This diagram illustrates a second merged texture, consisting of... Figure 2 As can be seen, the second merged texture includes textures for all the parts of the game character: upper body, lower body, head, hands, shoes, backpack, and equipment.
[0085] Furthermore, by applying the above texture processing method to all texture types, a game character can be obtained, such as the color texture, normal map, and material texture of an NPC model after merging. Moreover, the texture processing method described in this embodiment can be automated within a game engine, thus enabling automated batch processing of textures and effectively improving texture processing efficiency.
[0086] Furthermore, based on the above embodiments, this invention also provides a texture processing device, such as... Figure 3 The diagram shows a structural schematic of a texture processing device, which includes:
[0087] Module 30 is used to acquire textures of multiple objects;
[0088] The classification module 32 is used to classify multiple textures according to a preset texture importance level, and generate a first texture set containing multiple first textures and a second texture set containing multiple second textures, wherein the texture importance level of the first textures is less than that of the second textures.
[0089] The first classification module 34 is used to classify the multiple first textures contained in the first texture set according to the object classification principle, and generate multiple first subsets; wherein, each first subset includes multiple first textures of the same object;
[0090] The first merging module 36 is used to create a first texture template of a preset size, sequentially select the first texture of each object from each first subset, merge the first texture into the first texture template according to a preset first arrangement order, generate a first merged texture corresponding to the first texture, and store the first merged texture in the first merged texture set;
[0091] The second classification module 38 is used to classify the multiple second textures contained in the second texture set according to the object classification principle, and generate multiple second subsets; wherein, each second subset includes multiple second textures of the same object;
[0092] The second merging module 40 is used to create a second texture template of a preset size, sequentially select the second texture of each object from each of the second subsets, and select any one of the first merged textures from the first merged texture set, merge the second texture and the first merged texture into the second texture template according to a preset second arrangement order, generate a second merged texture, and store the second merged texture into the second merged texture set.
[0093] Furthermore, the aforementioned acquisition module 30 is also used to: acquire all textures; classify all textures according to preset texture types to obtain multiple textures corresponding to each texture type, and acquire the textures of multiple objects corresponding to each texture type.
[0094] Furthermore, the classification module 32 is used to: obtain the naming identifier of each texture; if the naming identifier belongs to the naming identifier included in the preset first texture importance level, then classify the corresponding texture as a first texture and store the first texture in a pre-established first texture set; if the naming identifier belongs to the naming identifier included in the preset second texture importance level, then classify the corresponding texture as a second texture and store the second texture in a pre-established second texture set; wherein, the importance level of the first texture is less than the importance level of the second texture.
[0095] Furthermore, the naming identifier included in the first texture importance includes the naming identifier of the texture of the first object; the first object is one or more of the plurality of objects, the plurality of objects including body parts of a game character and / or items equipped on the body parts; the naming identifier included in the second texture importance includes the naming identifier of the texture of the second object, the second object being other objects among the plurality of objects besides the first object.
[0096] Furthermore, the classification module 32 is also used to: if the naming identifier belongs to any one of the naming identifiers of the texture of the first object, then classify the texture corresponding to the naming identifier as a first texture; if the naming identifier belongs to any one of the naming identifiers of the texture of the second object, then classify the texture corresponding to the naming identifier as a second texture.
[0097] Furthermore, the aforementioned first classification module 34 is also used to: construct a first subset corresponding to each first object; traverse the first texture set and place the multiple first textures contained in the first texture set into the first subset corresponding to the first object according to the naming identifier of the textures.
[0098] Further in Figure 3 On this basis, Figure 4 A schematic diagram of another texture processing device is also shown, except Figure 3 In addition to the structure shown, the above-mentioned device also includes:
[0099] The first size adjustment module 44 is used to adjust the size of the first texture in the first subset to a preset first size; wherein the first size is smaller than the preset size of the first texture template.
[0100] Furthermore, the second classification module 38 is also used to: construct a second subset corresponding to each second object; traverse the second texture set and place multiple second textures contained in the second texture set into the second subset corresponding to the second object according to the naming identifier of the textures.
[0101] Furthermore, the aforementioned device also includes:
[0102] The second size adjustment module 46 is used to adjust the size of the second texture in the second subset to a preset second size; wherein the second size is smaller than the preset size of the second texture template.
[0103] Furthermore, the aforementioned device also includes:
[0104] The module 48 is used to: obtain the second merged texture corresponding to each texture type, merge the second merged texture corresponding to each texture type to generate a model texture; assign the model texture to a pre-established material ball model, and generate a character model based on the model texture through the material ball model.
[0105] The texture processing apparatus provided in this embodiment of the invention has the same technical features as the texture processing method provided in the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.
[0106] Furthermore, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above method.
[0107] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the above-described method.
[0108] Furthermore, embodiments of the present invention also provide a schematic diagram of the structure of an electronic device, such as... Figure 5 The diagram shows the structure of the electronic device, which includes a processor 101 and a memory 100. The memory 100 stores computer-executable instructions that can be executed by the processor 101. The processor 101 executes the computer-executable instructions to implement the above-described method.
[0109] exist Figure 5 In the illustrated embodiment, the electronic device further includes a bus 102 and a communication interface 103, wherein the processor 101, the communication interface 103, and the memory 100 are connected via the bus 102.
[0110] The memory 100 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 102 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0111] Processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 101 or by instructions in software form. Processor 101 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be 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. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this invention can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can reside 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. The storage medium is located in the memory, and the processor 101 reads the information in the memory and uses its hardware to complete the aforementioned method.
[0112] The computer program products of the texture processing method, apparatus and electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.
[0113] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0114] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.
[0115] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion 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, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0116] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0117] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A texture processing method, characterized in that, The method includes: Get textures from multiple objects; According to a preset importance level, multiple textures are classified to generate a first texture set containing multiple first textures and a second texture set containing multiple second textures, wherein the importance level of the first textures is less than that of the second textures; According to the object classification principle, the multiple first textures contained in the first texture set are classified to generate multiple first subsets; wherein, each first subset includes multiple first textures of the same object; Create a first texture template of a preset size, select the first texture of each object from each first subset in sequence, merge the first textures into the first texture template according to a preset first arrangement order, generate a first merged texture corresponding to the first texture, and store the first merged texture in the first merged texture set; According to the object classification principle, the multiple second textures contained in the second texture set are classified to generate multiple second subsets; wherein, each second subset includes multiple second textures of the same object; Create a second texture template of a preset size, sequentially select the second texture of each object from each of the second subsets, and select any one of the first merged textures from the first merged texture set. Merge the second texture and the first merged texture into the second texture template according to a preset second arrangement order to generate a second merged texture, and store the second merged texture in the second merged texture set.
2. The method of claim 1, wherein, The steps for obtaining textures of multiple objects include: Get all textures; According to the preset texture type, all textures are classified by type to obtain multiple textures corresponding to each texture type, and the textures of multiple objects corresponding to each texture type are obtained.
3. The method of claim 1, wherein, The step of classifying multiple textures according to a preset importance level to generate a first texture set containing multiple first textures and a second texture set containing multiple second textures includes: Obtain the naming identifier for each of the textures; If the naming identifier belongs to the naming identifiers included in the preset first texture importance level, then the corresponding texture is classified as the first texture and the first texture is stored in the pre-established first texture set; If the naming identifier belongs to the naming identifier included in the preset second texture importance level, then the corresponding texture is classified as a second texture and the second texture is stored in the pre-established second texture set; The first texture is less important than the second texture.
4. The method of claim 3, wherein, The naming identifier included in the importance of the first texture includes the naming identifier of the texture of the first object; the first object is one or more of the plurality of objects, and the plurality of objects includes body parts of a game character and / or items equipped on the body parts; The importance of the second texture includes the naming identifier of the texture of the second object, which is one of the other objects among the plurality of objects besides the first object.
5. The method of claim 4, wherein, If the naming identifier belongs to the naming identifiers included in the preset first texture importance level, then the step of classifying the corresponding texture as the first texture includes: If the naming identifier belongs to any of the naming identifiers of the texture of the first object, then the texture corresponding to the naming identifier is classified as the first texture; If the naming identifier belongs to the naming identifiers included in the preset second texture importance level, then the step of classifying the corresponding texture as a second texture includes: If the naming identifier belongs to any of the naming identifiers of the texture of the second object, then the texture corresponding to the naming identifier is classified as the second texture.
6. The method of claim 4, wherein, The steps of classifying the multiple first textures contained in the first texture set according to the object classification principle to generate multiple first subsets include: Construct the first subset corresponding to each of the first objects; Traverse the first texture set and place the multiple first textures contained in the first texture set into the first subset corresponding to the first object according to the naming identifier of the textures.
7. The method of claim 6, wherein, The method further includes: Adjust the size of the first texture in the first subset to a preset first size; wherein the first size is smaller than the preset size of the first texture template.
8. The method of claim 4, wherein, The step of classifying the multiple second textures contained in the second texture set according to the object classification principle to generate multiple second subsets includes: Construct the second subset corresponding to each of the second objects; Traverse the second texture set and place the multiple second textures contained in the second texture set into the second subset corresponding to the second object according to the naming identifier of the textures.
9. The method according to claim 8, characterized in that, The method further includes: Adjust the size of the second texture in the second subset to a preset second size; wherein the second size is smaller than the preset size of the second texture template.
10. The method of claim 2, wherein, The method further includes: Obtain the second merged texture corresponding to each texture type, and merge the second merged texture corresponding to each texture type to generate a model texture. The model texture is assigned to a pre-built material ball model, and the character model is generated based on the model texture using the material ball model.
11. A texture mapping processing apparatus characterized by comprising: The device includes: The get module is used to retrieve textures from multiple objects; The classification module is used to classify multiple textures according to a preset texture importance level, and generate a first texture set containing multiple first textures and a second texture set containing multiple second textures, wherein the texture importance level of the first textures is less than that of the second textures; The first classification module is used to classify the multiple first textures contained in the first texture set according to the object classification principle, and generate multiple first subsets; wherein, each first subset includes multiple first textures of the same object; The first merging module is used to create a first texture template of a preset size, sequentially select the first texture of each object from each first subset, merge the first texture into the first texture template according to a preset first arrangement order, generate a first merged texture corresponding to the first texture, and store the first merged texture in the first merged texture set; The second classification module is used to classify the multiple second textures contained in the second texture set according to the object classification principle, and generate multiple second subsets; wherein, each second subset includes multiple second textures of the same object; The second merging module is used to create a second texture template of a preset size, sequentially select the second texture of each object from each of the second subsets, and select any one of the first merged textures from the first merged texture set, merge the second texture and the first merged texture into the second texture template according to a preset second arrangement order, generate a second merged texture, and store the second merged texture into the second merged texture set.
12. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the texture processing method according to any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, performs the steps of the texture processing method according to any one of claims 1-10.