Model mapping method, apparatus and electronic device
By using vertex color parameters to divide texture areas and apply texture materials in the game engine, the problems of cumbersome and low-precision texture mapping in 3D game models are solved, achieving efficient and simplified texture processing and improved precision.
Patent Information
- Application Number
- CN202111577838.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2041-12-22
AI Technical Summary
In existing technologies, the texturing process for 3D game models is cumbersome, and it is impossible to modify textures and blending effects in the game engine. Furthermore, the resolution of 2D unfolded images is relatively small, affecting texture accuracy.
By obtaining the vertex color parameters of the target model, dividing the texture area according to the vertex color parameters, and obtaining the corresponding texture material in the game engine for texture processing, the texture process is simplified and the texture accuracy is improved.
Directly dividing texture areas and applying texture materials within the game engine simplifies the model texturing process, improves texture accuracy, and enhances production flexibility.
Smart Images

Figure CN114463477B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of model making, and in particular to a model mapping method, device and electronic equipment. BACKGROUND
[0002] In the process of making a three-dimensional game model, different maps usually need to be mixed for the model. In related technologies, first, a target model is subjected to UV unfolding processing by a model making software, such as Maya software, that is, a two-dimensional unfolded map of the target model is created to obtain corresponding data of the relationship between the vertices in three-dimensional space and the two-dimensional unfolded map space. Then, the two-dimensional unfolded map, the target model and a preset map are input into a map drawing software, the preset map is mixed into the two-dimensional unfolded map of the target model by the map drawing software, and the two-dimensional unfolded map mixed with the preset map and the target model made in the model making software are imported into a game engine. Finally, the two-dimensional unfolded map mixed with the preset map is used to make a material in the game engine and is assigned to the model. In this way, the preset map can only be mixed into the two-dimensional unfolded map of the target model in the map drawing software, the mapping process is tedious, and the preset map and the mixing effect cannot be modified in the game engine. Meanwhile, the resolution of the two-dimensional unfolded map exported by the map drawing software is small, which affects the final mapping accuracy. SUMMARY
[0003] Therefore, the present application aims to provide a model mapping method, device and electronic equipment to simplify the mapping process and improve the mapping accuracy of the model.
[0004] In a first aspect, an embodiment of the present application provides a model mapping method, which includes: obtaining a vertex color parameter of a target model; wherein the vertex color parameter is used to indicate the type of map material at the vertex position where the vertex color parameter is located; dividing a model surface of the target model into at least one mapping area according to the vertex color parameter; the vertex color parameters in the same mapping area are the same; obtaining a target map material corresponding to the vertex color parameter in the mapping area, and performing mapping processing on the mapping area based on the target map material to obtain a mapped target model.
[0005] Further, different types of map materials are preset with different mapping parameters, and the vertex color parameter is determined according to the mapping parameters; the step of dividing the model surface of the target model into at least one mapping area according to the vertex color parameter includes: determining a target vertex color parameter corresponding to a specified mapping parameter from the vertex color parameter; wherein the vertex color parameter is a value greater than zero and less than one; and dividing a mapping area corresponding to the specified mapping parameter on the model surface of the target model according to the target vertex color parameter.
[0006] Further, the step of determining the target vertex color parameter corresponding to the specified mapping parameter from the vertex color parameters comprises: calculating a first value of each vertex color parameter according to a first preset formula and the specified mapping parameter; calculating a second value of each vertex color parameter according to a second preset formula and the specified mapping parameter; subtracting the second value of each vertex color parameter from the first value of the vertex color parameter to obtain a third value of each vertex color parameter; and determining the vertex color parameter with the first preset value as the third value as the target vertex color parameter corresponding to the specified mapping parameter.
[0007] Further, the first preset formula is IDL = saturate (VC * f + n - (ID - n)), and the second preset formula is IDH = saturate (VC * f + n - ID), wherein VC represents the vertex color parameter, f represents the amplification ratio of the parameter, ID represents the target mapping parameter, n is a formula parameter of the preset formula, IDL represents the first value of the vertex color parameter, IDH represents the second value of the vertex color parameter, and saturate represents returning a value between 0 and 1.
[0008] Further, the step of dividing the mapping area corresponding to the specified mapping parameter on the model surface of the target model according to the target vertex color parameter comprises: determining the mask value of the vertex position of the target vertex color parameter as a first preset value, determining the mask value of the vertex position of the vertex color parameter other than the target vertex color parameter as a second preset value, and obtaining the mask data corresponding to the specified mapping parameter; and determining the mapping area corresponding to the specified mapping parameter on the model surface of the target model according to the mask data corresponding to the specified mapping parameter.
[0009] Further, the step of obtaining the target mapping material corresponding to the vertex color parameter in the mapping area, performing mapping processing on the mapping area based on the target mapping material, and obtaining the mapped target model comprises: obtaining the target mapping material corresponding to the vertex color parameter in the mapping area from the preset mapping material; determining the sampling mapping material of the target mapping material according to the target model; wherein the size of the sampling mapping material is consistent with the size of the unfolded drawing of the target model; and performing mapping processing on the mapping area corresponding to the target mapping material according to the mask data corresponding to the target mapping material and the sampling mapping material of the target mapping material, and obtaining the mapped target model.
[0010] Further, the step of determining the sampling mapping material of the target mapping material according to the target model comprises: obtaining the correspondence between the vertex of the target model and the pixel position of the target mapping material according to the target model; and performing sampling processing on the target mapping material according to the correspondence to obtain the sampling mapping material of the target mapping material.
[0011] Further, the step of performing the mapping processing on the mapping region corresponding to the target mapping material according to the mask data corresponding to the target mapping material and the sampling mapping material of the target mapping material comprises: multiplying the mask value of each vertex position in the mask data corresponding to the target mapping material with each pixel value in the sampling mapping material of the target mapping material, so that the target mapping material is drawn to the mapping region corresponding to the target mapping material, and the target model after mapping is obtained.
[0012] In a second aspect, an embodiment of the present application provides a model mapping device, the device comprising: an acquisition module configured to acquire vertex color parameters of a target model; wherein the vertex color parameters are used to indicate a mapping material type of a vertex position where the vertex color parameters are located; a division module configured to divide a model surface of the target model into at least one mapping region according to the vertex color parameters; the vertex color parameters in a same mapping region are the same; and a mapping module configured to acquire a target mapping material corresponding to the vertex color parameters in the mapping region, perform mapping processing on the mapping region based on the target mapping material, and obtain a target model after mapping.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, the memory storing machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to implement the model mapping method according to any one of the first aspect.
[0014] In a fourth aspect, an embodiment of the present application provides a machine readable storage medium, the machine readable storage medium storing machine executable instructions, and the machine executable instructions cause the processor to implement the model mapping method according to any one of the first aspect when the machine executable instructions are called and executed by the processor.
[0015] The embodiments of the present application have the following beneficial effects:
[0016] The present application provides a model mapping method and device and electronic device, vertex color parameters of a target model are acquired; the vertex color parameters are used to indicate a mapping material type of a vertex position where the vertex color parameters are located; a model surface of the target model is divided into at least one mapping region according to the vertex color parameters, the vertex color parameters in a same mapping region are the same; a target mapping material corresponding to the vertex color parameters in the mapping region is acquired, and mapping processing is performed on the mapping region based on the target mapping material, and a target model after mapping is obtained. In this way, different kinds of mappings are recorded through the vertex color parameters of the model, and each mapping region of each kind of mapping material can be divided on the model surface according to the vertex color parameters in the game engine, the target mapping material is drawn to the corresponding mapping region, and a mapping picture does not need to be output separately, so that the process of model mapping is simplified, and the mapping precision of the model is improved.
[0017] Other features and advantages of the present application will be set forth in the descriptions that follow, and in part will be apparent from the description, or can be learned by practice of the application. The purposes and other advantages of the present application will be realized and attained by the structures particularly pointed out in the description, claims and drawings.
[0018] In order to make the above objectives, features and advantages of the present application more apparent, the following will describe a preferred embodiment in detail, and the accompanying drawings will be referred to, as follows. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the drawings needed to be used in the specific embodiments or the prior art description. Obviously, the drawings described below are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0020] Figure 1 A flow chart of a model mapping method provided by an embodiment of the present application;
[0021] Figure 2 A flow chart of another model mapping method provided by an embodiment of the present application;
[0022] Figure 3 A structural schematic diagram of a model mapping device provided by an embodiment of the present application;
[0023] Figure 4 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the objectives, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the present application will be described clearly and completely in the following with reference to the drawings. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present application.
[0025] In the current three-dimensional game model production process, it is usually necessary to mix different maps for the model. In the related art, the map resources to be mixed are first preset, and then the target model is subjected to UV unfolding processing by a model production software, such as Maya software, that is, a two-dimensional unfolded map of the target model is created to obtain corresponding data of the relationship between the vertices in the three-dimensional space and the two-dimensional unfolded map space. Then, the two-dimensional unfolded map, the target model, and the preset map are input into a map drawing software, such as SubstancePainter software, to mix the preset map resources to be mixed into the two-dimensional unfolded map of the target model by using the layers and masks in the map drawing software, and the two-dimensional unfolded map mixed with the preset map resources to be mixed and the target model produced by the model production software are imported into a game engine, such as UE4 (Unreal Engine 4). Finally, the two-dimensional unfolded map mixed with the preset map resources to be mixed is used to produce a material in the game engine and is assigned to the model.
[0026] In this way, no matter how many maps are mixed in the early stage of the map process, only one mixed result map will be finally output. Since the resolution size requirement of the game map is limited and high-precision information cannot be recorded, the operation of outputting one result will greatly reduce the picture precision. The preset map can only be mixed into the two-dimensional unfolded map of the target model in the map drawing software, the map process is complicated, and the preset map and the mixing effect cannot be modified in the game engine. In addition, the resolution of the two-dimensional unfolded map exported by the map drawing software is small, which affects the final map precision.
[0027] Based on this, the model map method, device and electronic equipment provided by the embodiments of the present application can be applied to a device installed with a game engine, and in particular, can be applied to a device installed with a virtual engine 4.
[0028] To facilitate the understanding of the present embodiment, first, a model map method disclosed by the embodiments of the present application is introduced in detail, as shown in Figure 1 The method comprises the following steps:
[0029] In step S102, the vertex color parameters of the target model are obtained; wherein the vertex color parameters are used to indicate the types of map materials at the vertex positions where the vertex color parameters are located.
[0030] The target model can be a game model, and is usually a three-dimensional model, such as a game mount, a virtual item in a game scene, etc. The vertex color parameter is usually stored in the vertex color of the model, and can be determined according to the map material type or according to a preset material. Therefore, before step S102, the following steps are further included: in a model making stage, a three-dimensional model drawing software, such as MAYA, 3DSMAX, Houdini, etc., is used to make the target model; a material ball can be set for the target model in advance, and different parameters are set for the vertex color of the target model according to different preset materials; or different parameters are set for the vertex color of the target model according to the map type corresponding to different preset materials. For example, three material types are set for the target model in advance, different material parameters are set for the three preset materials, or different map parameters are set for the maps corresponding to the three preset materials; in any case, each preset material corresponds to a type of map.
[0031] Then, the vertex color parameters corresponding to different types of map materials can be determined according to the map parameters through a specified formula: VC=(ID-1)*f; where VC represents the vertex color parameter, ID represents the map parameter or the material parameter, and f represents the reduction ratio of the map parameter or the material parameter, which can be determined according to the maximum value of the map parameter or the material parameter. If the maximum value is 40, f is 0.025; if the maximum value is 20, f is 0.05. The purpose is to make the calculated vertex color parameter a positive number less than 1.
[0032] Taking the map parameter as an example, if the map parameters are “1”, “2” and “3” respectively, each parameter represents a type of map material. The map parameter “1” can represent a wood grain type of map material, the map parameter “2” can represent a brick type of map material, and the map parameter “3” can represent a soil type of map material. The range of the map parameter or the material parameter is usually set to 1 to 40. Finally, the vertex color parameters are calculated to be “0”, “0.025” and “0.05” through the specified formula VC=(ID-1)*0.025. The vertex color parameter “0” indicates that the vertex color parameter is located at a vertex position of a wood grain type of map material; the vertex color parameter “0.025” indicates that the vertex color parameter is located at a vertex position of a brick type of map material; and the vertex color parameter “0.05” indicates that the vertex color parameter is located at a vertex position of a soil type of map material.
[0033] After obtaining the target model provided with the vertex color parameters in the three-dimensional model making software, the target model can be imported into a game engine, such as UE4, and the target model is mapped by the game engine. Specifically, the vertex color parameters of the target model are obtained, and the vertex color parameters of "0", "0.025" and "0.05" are obtained as an example.
[0034] In step S104, the model surface of the target model is divided into at least one mapping area according to the vertex color parameters; the vertex color parameters in the same mapping area are the same;
[0035] Since different vertex color parameters indicate different mapping material categories, the area of the vertex position where the same vertex color parameter is located can be divided into a mapping area. If the vertex color parameters are "0", "0.025" and "0.05" respectively, the model surface of the target model can be divided into three mapping areas. Since the vertex position where the vertex color parameter is located indicates the category of the mapping material in the game engine, if it is desired to divide the model surface of the target model into mapping areas under the premise of knowing the category of the mapping material corresponding to the mapping area, the mapping parameters of the mapping material can be determined first, the vertex color parameters corresponding to different categories of mapping materials are obtained by back calculation, and then the area of the vertex position where the vertex color parameter is located is determined on the model surface of the target model.
[0036] In step S106, the target mapping material corresponding to the vertex color parameter in the mapping area is obtained, the mapping area is mapped based on the target mapping material, and the mapped target model is obtained.
[0037] The target mapping material corresponding to the vertex color parameter can be set as needed, for example, the target mapping material corresponding to the vertex color parameter "0" can be a wood grain mapping material or a soil mapping material. In the game engine, it can be set or changed as needed according to actual needs.
[0038] Specifically, after the target area is determined, the target mapping material can be sampled to obtain a target mapping material with the same size as the target area, and finally the sampled target mapping material is mapped to the mapping area; similarly, different mapping areas are mapped in the same way to obtain the mapped target model. The target mapping material can also be sampled to obtain a target mapping material with the same size as the unfolded diagram of the target model, and finally the sampled target mapping material is mapped to the target model. The pixel value of the target mapping material is retained for the target area, and the pixel value of the target mapping material is deleted for other areas, to obtain the mapped target model.
[0039] The embodiment of the present application provides a model mapping method, vertex color parameters of a target model are acquired; the vertex color parameters are used to indicate the mapping material type of the vertex position where the vertex color parameters are located; a model surface of the target model is divided into at least one mapping region according to the vertex color parameters, and the vertex color parameters in the same mapping region are the same; target mapping materials corresponding to the vertex color parameters in the mapping region are acquired, the mapping region is mapped based on the target mapping materials, and a mapped target model is obtained. In the method, different types of mappings are recorded through the vertex color parameters of the model, and each mapping material of each type of mapping is divided into a mapping region on the model surface according to the vertex color parameters in the game engine, and the target mapping material is drawn to the corresponding mapping region, so that the mapping picture does not need to be output separately, the process of model mapping is simplified, and the mapping precision of the model is improved.
[0040] Generally, different types of mapping materials are provided with different mapping parameters, and the vertex color parameters are determined according to the mapping parameters. Alternatively, the mapping parameters can be directly preset without determining the type of the mapping material, and the type of the mapping material corresponding to the different mapping parameters can be set for the mapping parameter when the mapping is specifically required. Generally, 40 mapping parameters can be set, and the range is an integer from 1 to 40. Then, when the vertex color parameters are calculated, the corresponding vertex color parameters can be calculated according to the different mapping parameters.
[0041] The step of dividing the model surface of the target model into at least one mapping region according to the vertex color parameters is described below, and one possible implementation manner is as follows:
[0042] In step S201, the target vertex color parameters corresponding to the specified mapping parameters are determined from the vertex color parameters; the vertex color parameters are values greater than zero and less than one;
[0043] Taking the vertex color parameters "0", "0.025" and "0.05" as examples, in order to determine the vertex position region, that is, the target region, of each same vertex color parameter, three mapping parameters "1", "2" and "3" are determined as the specified mapping parameters. When the specified mapping parameter can be "1", the target vertex color parameter corresponding to the specified mapping parameter can be obtained according to the reverse calculation of the specified formula. When the specified mapping parameter can be "2", the target vertex color parameter corresponding to the specified mapping parameter can be obtained according to the reverse calculation of the specified formula. When the specified mapping parameter can be "3", the target vertex color parameter corresponding to the specified mapping parameter can be obtained according to the reverse calculation of the specified formula. Alternatively, the target vertex color parameter corresponding to the specified mapping parameter can be calculated according to the preset formula.
[0044] One possible implementation manner of the above step S201 is as follows:
[0045] (1) calculating a first value of each vertex color parameter according to a first preset formula and a specified map parameter;
[0046] The first preset formula is: IDL = saturate(VC*f-(ID-n)); wherein, VC represents a vertex color parameter; f represents an amplification ratio of the parameter; ID represents a target map parameter; n is a formula parameter of the preset formula; IDL represents the first value of the vertex color parameter; IDH represents a second value of the vertex color parameter; saturate represents returning a value between 0 and 1. The function of saturate(x) is to return 0 if x takes a value less than 0. If x takes a value greater than 1, the return value is 1. If x is between 0 and 1, the value of x is directly returned.
[0047] Taking the maximum map parameter as 40 for example, the above-mentioned f can be 40; n is 2. Specifically, according to the first preset formula, the map parameter corresponding to the vertex color parameter can be determined, which is greater than the specified map parameter minus one, and the result calculated by the first preset formula is the first value.
[0048] Taking the vertex color parameters as "0", "0.025", "0.05" and the specified map parameter as "1" for example, VC = 0, ID = 1 is brought into IDL = saturate(VC*40+1-(ID-1)) to calculate the first value of the vertex color parameter "0", IDL = saturate(1) = 1; VC = 0.025, ID = 1 is brought into IDL = saturate(VC*40+1-(ID-1)) to calculate the first value of the vertex color parameter "0.025", IDL = saturate(2) = 1; VC = 0.05, ID = 1 is brought into IDL = saturate(VC*40+1-(ID-1)) to calculate the first value of the vertex color parameter "0.05", IDL = saturate(3) = 1. Thus, the first value of each vertex color parameter corresponding to the specified map parameter is 1, 1, and 1 respectively.
[0049] (2) calculating a second value of each vertex color parameter according to a second preset formula and a specified map parameter;
[0050] The second preset formula is: IDH = saturate(VC*f+n-ID); wherein, VC represents a vertex color parameter; f represents an amplification ratio of the parameter; ID represents a target map parameter; IDH represents a second value of the vertex color parameter; saturate represents returning a value between 0 and 1.
[0051] Taking a maximum texture parameter of 40 as an example, f can be 40 and n can be 1. Specifically, the texture parameter corresponding to the vertex color parameter can be determined according to the second preset formula. If the parameter is greater than the specified texture parameter range, the result calculated by the second preset formula is the second value mentioned above.
[0052] Taking vertex color parameters "0", "0.025", and "0.05" as an example, and specifying the texture parameter as "1", we substitute VC=0 and ID=1 into IDH=saturate(VC*f+1–ID) to calculate the second value of the vertex color parameter "0", resulting in IDH=saturate(0)=0; we substitute VC=0.025 and ID=1 into IDH=saturate(VC*f+1–ID) to calculate the second value of the vertex color parameter "0.025", resulting in IDH=saturate(1)=1; we substitute VC=0.05 and ID=1 into IDH=saturate(VC*f+1–ID) to calculate the second value of the vertex color parameter "0.05", resulting in IDH=saturate(2)=1. Therefore, we can obtain that the second value of each vertex color parameter corresponding to the specified texture parameter is 0, 1, and 1 respectively.
[0053] (3) Set parameters for each vertex, subtract the second value of the vertex color parameter from the first value of the vertex color parameter to obtain the third value of each vertex color parameter, and determine the vertex color parameter whose third value is the first preset value as the target vertex color parameter corresponding to the specified texture parameter.
[0054] Continuing the example above, let's subtract the second values (0, 1, 1) of the first values of each vertex color parameter corresponding to the specified texture parameter from these values, resulting in the third values (1, 0, 0). The third value of each vertex color parameter can be represented as a mask, i.e., mask = IDL - IDH. The vertex color parameter 0, whose third value is the first preset value "1", is determined as the target vertex color parameter corresponding to the specified texture parameter "1".
[0055] Step S202: Based on the target vertex color parameters, divide the surface of the target model into texture regions corresponding to the specified texture parameters.
[0056] Specifically, you can set the position parameter of the vertex where the target vertex color parameter is located, and determine the texture area corresponding to the specified texture parameter based on the position parameter.
[0057] One possible implementation of step S202 above:
[0058] (1) determining the mask value of the vertex position where the target vertex color parameter is located as a first preset value, determining the mask value of the vertex position where the vertex color parameter other than the target vertex color parameter is located as a second preset value, to obtain the mask data corresponding to the specified mapping parameter;
[0059] (2) determining the mapping area corresponding to the specified mapping parameter on the model surface of the target model according to the mask data corresponding to the specified mapping parameter.
[0060] In actual implementation, a mask can be set for each specified mapping parameter, the mask value of the vertex position where the target vertex color parameter is located can be determined as the first preset value "1", and the mask value of the vertex position where the vertex color parameter other than the target vertex color parameter is located can be determined as the second preset value "0", to obtain the mask data corresponding to the specified mapping parameter; the mask data in this embodiment, i.e., the mask described above, can be represented as mask1 for the mask data corresponding to the specified mapping parameter "1", as mask2 for the mask data corresponding to the specified mapping parameter "2", and as mask3 for the mask data corresponding to the specified mapping parameter "3". The area where the mask value of the vertex position is the first preset value is the mapping area corresponding to the specified mapping parameter.
[0061] In the above manner, the mapping parameters of different kinds of mapping materials can be recorded by the vertex color parameter in the UE4 game platform, the mask data of different mapping parameters can be determined according to the preset formula, the vertex color parameter, and the mapping parameter, and finally the mapping area of different mapping parameters can be determined according to the mask data. Without outputting the mapping picture in other software, the problem of reducing the mapping resolution is avoided, and only the mapping process of the target model needs to be performed in the game engine, so that the mapping process is simple, and the accuracy of the model mapping is improved.
[0062] The following describes the steps of obtaining the target mapping material corresponding to the vertex color parameter in the mapping area, performing mapping processing on the mapping area based on the target mapping material, and obtaining the mapped target model, and one possible implementation manner is as follows:
[0063] Step 21, obtaining the target mapping material corresponding to the vertex color parameter in the mapping area from the preset mapping material;
[0064] Since the vertex color parameters are calculated according to the mapping parameters when the target model is made, the corresponding mapping material can be set for each mapping parameter when the mapping processing is performed, that is, the corresponding mapping material is set for each vertex color parameter. For example, the mapping material of wood grain can be set for the vertex color parameter "0", and the mapping material of soil can also be set for the vertex color parameter "0" according to the needs. In fact, the corresponding mapping material needs to be set for each vertex color parameter. For example, if there are three vertex color parameters, the target mapping material corresponding to the vertex color parameters in the three mapping areas can be obtained.
[0065] In step 22, the sampling mapping material of the target mapping material is determined according to the target model, wherein the size of the sampling mapping material is consistent with the size of the development diagram of the target model.
[0066] Since the shape of the target mapping material is not the same as the target model, the sampling processing needs to be performed on the target mapping material according to the development diagram of the target model, so that the size of the sampling mapping material is the same as the size of the development diagram of the target model.
[0067] In the above step 22, a possible implementation manner is that the corresponding relationship between the vertex of the target model and the pixel position of the target mapping material is obtained according to the target model, and the sampling processing is performed on the target mapping material according to the corresponding relationship to obtain the sampling mapping material of the target mapping material.
[0068] Specifically, the corresponding relationship between the position of each vertex of the target model and each pixel position in the target mapping material can be obtained through the UV reading node. The corresponding relationship is usually the corresponding relationship of UV coordinates. According to the corresponding relationship, the pixel at the position in the target mapping material can be sampled according to the position of the vertex of the target model in the development diagram, and finally the sampling mapping material of the target mapping material which is the same as the development diagram can be obtained.
[0069] In step 23, the mapping area corresponding to the target mapping material is mapped according to the corresponding mask data of the target mapping material and the sampling mapping material of the target mapping material, and the target model after mapping is obtained.
[0070] In the above step 23, a possible implementation manner is that the mask value of each vertex position in the corresponding mask data of the target mapping material is multiplied with each pixel value in the sampling mapping material of the target mapping material, so that the target mapping material is drawn to the mapping area corresponding to the target mapping material, and the target model after mapping is obtained.
[0071] For example, if the mask data corresponding to the target map material are mask1, mask2 and mask3 respectively, and the pixel data of the sampling map material of the target map material are T1, T2 and T3 respectively, the target map material can be drawn to the map area corresponding to the target map material according to the manner of Color = mask1*T1 + mask2*T2 + mask3*T3, and the mapped target model is obtained.
[0072] In the above manner, the target model is mapped by the vertex color parameter, and the mapping accuracy is greatly improved compared with the traditional scheme. In addition, the model is mapped in the UE4 engine, the type of the map material corresponding to each vertex color parameter can be dynamically replaced and modified, higher production flexibility is achieved, and the time required in the model mapping production process is saved.
[0073] In addition, after the mapping is completed, if the target model is preset with a material, for example, the material preset for the head position of the target model is wood grain, the material preset for the body position of the target model is rock, and the material preset for the leg position of the target model is brick. The material can be assigned to the mapped target model to obtain the finally produced target model, and the final effect can be observed in the game engine.
[0074] Corresponding to the above method embodiment, the embodiment of the present application provides a model mapping device, as shown in the figure, the device comprises: Figure 3 The acquisition module 31 is configured to acquire the vertex color parameter of the target model, wherein the vertex color parameter is used to indicate the type of the map material at the vertex position where the vertex color parameter is located.
[0075] The division module 32 is configured to divide the model surface of the target model into at least one map area according to the vertex color parameter, and the vertex color parameters in the same map area are the same.
[0076] The mapping module 33 is configured to acquire the target map material corresponding to the vertex color parameter in the map area, perform mapping processing on the map area based on the target map material, and obtain the mapped target model.
[0077]
[0078] The embodiment of the present application provides a model mapping device, acquires vertex color parameters of a target model; wherein the vertex color parameters are used to indicate the mapping material type of the vertex position where the vertex color parameters are located; according to the vertex color parameters, the model surface of the target model is divided into at least one mapping area, and the vertex color parameters in the same mapping area are the same; target mapping materials corresponding to the vertex color parameters in the mapping area are acquired, the mapping area is mapped based on the target mapping materials, and a mapped target model is obtained. In this way, different kinds of maps are recorded through the vertex color parameters of the model, and each mapping area of the mapping material is divided according to the vertex color parameters on the model surface in the game engine, and the target mapping material is drawn to the corresponding mapping area, so that the process of model mapping is simplified, and the mapping accuracy of the model is improved.
[0079] Further, different kinds of mapping materials are provided with different mapping parameters, and the vertex color parameters are determined according to the mapping parameters; the above-mentioned division module is further used for: determining the target vertex color parameters corresponding to the specified mapping parameters from the vertex color parameters; wherein the vertex color parameters are greater than zero and less than one; and according to the target vertex color parameters, the mapping area corresponding to the specified mapping parameters is divided on the model surface of the target model.
[0080] Further, the above-mentioned division module is further used for: calculating the first value of each vertex color parameter according to the first preset formula and the specified mapping parameters; calculating the second value of each vertex color parameter according to the second preset formula and the specified mapping parameters; for each vertex parameter, the first value of the vertex color parameter is subtracted from the second value of the vertex color parameter to obtain the third value of each vertex color parameter, and the vertex color parameter with the first preset value is determined as the target vertex color parameter corresponding to the specified mapping parameters.
[0081] Further, the above-mentioned first preset formula is: IDL=saturate(VC*f+n-(ID-n)); and the above-mentioned second preset formula is: IDH=saturate(VC*f+n-ID); wherein VC represents the vertex color parameter; f represents the amplification ratio of the parameter; ID represents the target mapping parameter; n is the formula parameter of the preset formula; IDL represents the first value of the vertex color parameter; IDH represents the second value of the vertex color parameter; and saturate represents the value returned between 0 and 1.
[0082] Further, the above-mentioned division module is further used for: determining the mask value of the vertex position where the target vertex color parameter is located as the first preset value, determining the mask value of the vertex position where the vertex color parameter except the target vertex color parameter is located as the second preset value, obtaining the mask data corresponding to the specified mapping parameters; and according to the mask data corresponding to the specified mapping parameters, the mapping area corresponding to the specified mapping parameters is determined on the model surface of the target model.
[0083] Further, the mapping module is further configured to: obtain a target mapping material corresponding to the vertex color parameter in the mapping area from the preset mapping materials; determine a sampling mapping material of the target mapping material according to the target model; wherein the size of the sampling mapping material is consistent with the size of the unfolded drawing of the target model; and perform mapping processing on the mapping area corresponding to the target mapping material according to the mask data corresponding to the target mapping material and the sampling mapping material of the target mapping material, to obtain the target model after mapping.
[0084] Further, the mapping module is further configured to: obtain a target mapping material corresponding to the vertex color parameter in the mapping area from the preset mapping materials; determine a sampling mapping material of the target mapping material according to the target model; wherein the size of the sampling mapping material is consistent with the size of the unfolded drawing of the target model; and perform mapping processing on the mapping area corresponding to the target mapping material according to the mask data corresponding to the target mapping material and the sampling mapping material of the target mapping material, to obtain the target model after mapping.
[0085] Further, the mapping module is further configured to: obtain a target mapping material corresponding to the vertex color parameter in the mapping area from the preset mapping materials; determine a sampling mapping material of the target mapping material according to the target model; wherein the size of the sampling mapping material is consistent with the size of the unfolded drawing of the target model; and perform mapping processing on the mapping area corresponding to the target mapping material according to the mask data corresponding to the target mapping material and the sampling mapping material of the target mapping material, to obtain the target model after mapping.
[0086] The model mapping device provided by the embodiment of the application has the same technical features as the model mapping method provided by the above embodiment, and can solve the same technical problem and achieve the same technical effect.
[0087] The embodiment also provides an electronic device including a processor and a memory, the memory storing machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to implement the model mapping method. The electronic device can be a server or a terminal device.
[0088] Referring to Figure 4 The electronic device includes a processor 100 and a memory 101, the memory 101 storing machine executable instructions capable of being executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the model mapping method.
[0089] Further, Figure 4 The electronic device shown in the figure further includes a bus 102 and a communication interface 103, and the processor 100, the communication interface 103 and the memory 101 are connected through the bus 102.
[0090] The memory 101 can include a random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used. The bus 102 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used to represent the system in the figure, but it does not mean that there is only one bus or one type of bus.
[0091] The processor 100 can be an integrated circuit chip with signal processing capability. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 100 or the instruction in the form of software. The above processor 100 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 gates or transistor logic devices, discrete hardware components. Each method, step and logic block disclosed in the embodiment of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiment of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium in the art. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and combines the hardware to complete the steps of the method of the above embodiment.
[0092] The embodiment also provides a machine readable storage medium, the machine readable storage medium stores machine executable instructions, when the machine executable instructions are called and executed by the processor, the machine executable instructions cause the processor to realize the above model mapping method.
[0093] The model mapping method, device, electronic equipment, and system provided by the embodiments of the present application include a computer readable storage medium storing program codes, the program codes include instructions for executing the method described in the foregoing method embodiments, and specific implementation can be referred to the method embodiments, which will not be described here.
[0094] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0095] In addition, in the description of the embodiments of the present application, unless otherwise explicitly specified and limited, the terms "mounting", "connection", "connecting" should be understood in a broad sense, for example, can be fixed connection, can also be detachable connection, or integral connection; can be mechanical connection, can also be electrical connection; can be directly connected, can also be indirectly connected through an intermediate medium, can be the communication inside two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0096] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or the part of the present application that essentially contributes to the prior art or the part of the technical solutions can be embodied in the form of software products. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0097] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms "first", "second", "third" are only for descriptive purposes, and cannot be understood as indicating or implying relative importance.
[0098] Finally, it should be noted that the above examples are merely specific embodiments of the present application, and are used to illustrate the technical solutions of the present application, but are not intended to limit the present application. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that any person skilled in the art can still modify or easily think of changes to the technical solutions recorded in the foregoing examples, or make equivalent replacements to some of the technical features, within the technical range disclosed by the present application. These modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A model texturing method, characterized in that, The method includes: Obtain the vertex color parameters of the target model; wherein, the vertex color parameters are used to indicate the type of texture material at the vertex position where the vertex color parameter is located; Based on the vertex color parameters, the surface of the target model is divided into at least one texture region; the vertex color parameters are the same in the same texture region; Obtain the target texture material corresponding to the vertex color parameters in the texture region, and perform texture processing on the texture region based on the target texture material to obtain the textured target model; Different types of texture materials have different preset texture parameters, and the vertex color parameters are determined based on the texture parameters; The step of dividing the surface of the target model into at least one texture region based on the vertex color parameters includes: determining the target vertex color parameters corresponding to the specified texture parameters from the vertex color parameters; wherein the vertex color parameters are values greater than zero and less than one; and dividing the surface of the target model into texture regions corresponding to the specified texture parameters based on the target vertex color parameters. The step of determining the target vertex color parameter corresponding to the specified texture parameter from the vertex color parameters includes: calculating a first value for each vertex color parameter according to a first preset formula and the specified texture parameter; calculating a second value for each vertex color parameter according to a second preset formula and the specified texture parameter; subtracting the second value from the first value of each vertex color parameter to obtain a third value for each vertex color parameter; and determining the vertex color parameter whose third value is the first preset value as the target vertex color parameter corresponding to the specified texture parameter.
2. The method according to claim 1, characterized in that, The first preset formula is: IDL=saturate(VC*f+n–(ID–n)); The second preset formula is: IDH=saturate(VC*f+n–ID); Wherein, VC represents the vertex color parameter; f represents the magnification ratio of the parameter; ID represents the target texture parameter; n is the formula parameter of the preset formula; IDL represents the first value of the vertex color parameter; IDH represents the second value of the vertex color parameter; saturate represents a value between 0 and 1.
3. The method according to claim 1, characterized in that, The step of dividing the surface of the target model according to the target vertex color parameters into a texture region corresponding to the specified texture parameters includes: The masking value of the vertex position where the target vertex color parameter is located is determined as a first preset value, and the masking value of the vertex position where the vertex color parameters other than the target vertex color parameter are located is determined as a second preset value, so as to obtain the masking data corresponding to the specified texture parameter. Based on the masking data corresponding to the specified texture parameters, the texture area corresponding to the specified texture parameters is determined on the surface of the target model.
4. The method according to claim 1, characterized in that, The steps of obtaining the target texture material corresponding to the vertex color parameters in the texture region, and performing texture processing on the texture region based on the target texture material to obtain the textured target model include: Obtain the target texture material corresponding to the vertex color parameters in the texture region from the preset texture material; Based on the target model, a sampled texture material for the target texture material is determined; wherein the size of the sampled texture material is consistent with the size of the unfolded image of the target model; Based on the masking data corresponding to the target texture material and the sampled texture material of the target texture material, the texture area corresponding to the target texture material is processed to obtain the textured target model.
5. The method according to claim 4, characterized in that, The step of determining the sampled texture material of the target texture material based on the target model includes: Based on the target model, obtain the correspondence between the vertices of the target model and the pixel positions of the target texture material; Based on the correspondence, the target texture material is sampled to obtain the sampled texture material of the target texture material.
6. The method according to claim 4, characterized in that, The steps of performing texture processing on the texture region corresponding to the target texture material based on the mask data corresponding to the target texture material and the sampled texture material of the target texture material to obtain the textured target model include: The mask value at each vertex position in the mask data corresponding to the target texture material is multiplied by the pixel value in the sampled texture material of the target texture material, so that the target texture material is drawn onto the texture area corresponding to the target texture material, and the textured target model is obtained.
7. A model texturing device, characterized in that, The device includes: The acquisition module is used to acquire the vertex color parameters of the target model; wherein, the vertex color parameters are used to indicate the type of texture material at the vertex position where the vertex color parameter is located; The partitioning module is used to divide the surface of the target model into at least one texture region based on the vertex color parameters; the vertex color parameters in the same texture region are the same. The texturing module is used to obtain the target texture material corresponding to the vertex color parameters in the texturing region, and to perform texturing processing on the texturing region based on the target texture material to obtain the textured target model; Different types of texture materials have different preset texture parameters, and the vertex color parameters are determined based on the texture parameters; The partitioning module is further configured to: determine the target vertex color parameter corresponding to the specified texture parameter from the vertex color parameters; wherein the vertex color parameter is a value greater than zero and less than one; and partition the texture region corresponding to the specified texture parameter on the model surface of the target model according to the target vertex color parameter. The partitioning module is further configured to: calculate a first value for each vertex color parameter according to a first preset formula and the specified texture parameters; calculate a second value for each vertex color parameter according to a second preset formula and the specified texture parameters; for each vertex color parameter, subtract the second value from the first value of the vertex color parameter to obtain a third value for each vertex color parameter; and determine the vertex color parameter whose third value is the first preset value as the target vertex color parameter corresponding to the specified texture parameters.
8. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the model mapping method according to any one of claims 1-6.
9. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the model mapping method according to any one of claims 1-6.
Citation Information
Patent Citations
Virtual character image processing method and device, equipment and storage medium
CN112657195A
Image rendering method and device, computer equipment and storage medium
CN112884875A