CN117994404A - Mapping merging method and device for model, electronic equipment and storage medium - Google Patents

Mapping merging method and device for model, electronic equipment and storage medium Download PDF

Info

Publication number
CN117994404A
CN117994404A CN202311860312.5A CN202311860312A CN117994404A CN 117994404 A CN117994404 A CN 117994404A CN 202311860312 A CN202311860312 A CN 202311860312A CN 117994404 A CN117994404 A CN 117994404A
Authority
CN
China
Prior art keywords
shell
original
models
shells
model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311860312.5A
Other languages
Chinese (zh)
Inventor
陈兆昕
胡明众
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202311860312.5A priority Critical patent/CN117994404A/en
Publication of CN117994404A publication Critical patent/CN117994404A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the invention provides a mapping merging method and device of a model, electronic equipment and a storage medium, wherein the method comprises the following steps: obtaining original UV shells corresponding to the multiple models respectively; processing the original UV shell to obtain an agent UV shell, and generating a comparison relation between the original UV shell and the obtained agent UV shell; generating a target UV shell according to the control relation and the original UV shell; from the target UV shell, a merged map for multiple models is obtained. The pixel utilization rate is improved based on rearrangement of the agent UV shell in a preset quadrant space while the pixel is improved by eliminating the difference of resolution precision based on scaling processing of the original UV shell, the phenomenon that a large number of pixels are wasted due to empty squares after merging is completed is avoided, and the rendering times can be reduced based on merging mapping for a plurality of models.

Description

Mapping merging method and device for model, electronic equipment and storage medium
Technical Field
The present invention relates to the field of image rendering technologies, and in particular, to a method and apparatus for merging maps of a model, a corresponding electronic device, and a corresponding computer-readable storage medium.
Background
Merging perspective models is a common practice in game making, which generally refers to merging multiple models or predictions into one unified model or prediction at long-term viewing angles.
In the related art of merging distant view model texture maps, UV (U, V represents coordinate axes on texture maps for storing texture mapping relation of 2D images projected onto 3D surfaces) and texture maps of models to be merged are mainly sequentially arranged into squares for implementation, and this mode may cause a large amount of pixel waste due to spare squares after merging is completed.
Disclosure of Invention
In view of the foregoing, embodiments of the present invention are directed to providing a method of merging maps of a model, a device of merging maps of a model, a corresponding electronic apparatus, and a corresponding computer-readable storage medium, which overcome or at least partially solve the foregoing problems.
The embodiment of the invention discloses a mapping merging method of a model, which comprises the following steps:
Obtaining original UV shells corresponding to the multiple models respectively; the original UV shell is used for indicating a shell-shaped structure of texture coordinates of the model surface after the model surface is unfolded;
Processing the original UV shell to obtain an agent UV shell, and generating a comparison relation between the original UV shell and the obtained agent UV shell; the control relation is used for scaling information of the original UV shell during processing and position information of the agent UV shell corresponding to the original UV shell during rearrangement in a preset quadrant space;
Generating a target UV shell according to the control relation and the original UV shell;
And obtaining a merging map aiming at the multiple models according to the target UV shell.
The embodiment of the invention also discloses a mapping merging device of the model, which comprises the following steps:
The original UV shell acquisition module is used for acquiring original UV shells corresponding to the multiple models respectively; the original UV shell is used for indicating a shell-shaped structure of texture coordinates of the model surface after the model surface is unfolded;
The control relation generation module is used for processing the original UV shell to obtain a proxy UV shell and generating a control relation between the original UV shell and the proxy UV shell; the control relation is used for recording scaling information of the original UV shell during processing and position information of the agent UV shell corresponding to the original UV shell during rearrangement in a preset quadrant space;
A target UV shell generation module for generating a target UV shell from the control relationship and the original UV shell;
and the mapping merging module is used for obtaining merging mapping aiming at the multiple models according to the target UV shell.
The embodiment of the invention also discloses an electronic device, which comprises: a processor, a memory, and a computer program stored on the memory and capable of running on the processor, which when executed by the processor implements the method of map merging for any of the models.
The embodiment of the invention also discloses a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the mapping merging method of any model when being executed by a processor.
The embodiment of the invention has the following advantages:
In the embodiment of the invention, the original UV shells corresponding to the multiple models can be obtained, the agent UV shells are obtained by processing the original UV shells, and the comparison relation between the original UV shells and the obtained agent UV shells is generated, wherein the comparison relation can be mainly used for recording the scaling information of the original UV shells during processing and the position information of the agent UV shells corresponding to the original UV shells during rearrangement in a preset quadrant space, at the moment, the target UV shells can be generated according to the comparison relation and the original UV shells, so that the combined chartlet aiming at the multiple models can be obtained through the generated target UV shells, and the chartlet combination of the multiple models is realized. By using scaling information recorded by the comparison relation during processing of the original UV shell and position information when the proxy UV shell corresponding to the original UV shell is rearranged in a preset quadrant space, a target UV shell is generated, model maps of a plurality of models are combined, the difference of resolution precision can be eliminated based on scaling processing of the original UV shell, the pixel utilization rate can be improved based on rearrangement of the proxy UV shell in the preset quadrant space while the pixel is improved, the phenomenon that a large number of pixels are wasted due to vacant squares after combination is completed is avoided, and rendering times can be reduced based on the combined maps of the plurality of models, so that drawing call of a GPU is reduced, and rendering efficiency is improved.
Drawings
FIG. 1 is a schematic diagram showing the merging of texture maps of a perspective model in the related art;
FIG. 2 is a flow chart of steps of an embodiment of a method for mapping and merging of models of the present invention;
FIG. 3 is an exemplary diagram of a map merging for a model provided by an embodiment of the present invention;
FIG. 4 is a flow chart of steps of an embodiment of a method of map merging for another model of the present invention;
FIG. 5 is an exemplary diagram of a map merging for another model provided by an embodiment of the present invention;
fig. 6 is a block diagram of an embodiment of a pattern mapping and merging apparatus of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
In game making, draw calls (DrawCall) are involved, mainly in the graphics rendering process, a drawing request issued to a graphics processing unit (Graphics Processing Unit, GPU for short), each DrawCall may contain a set of graphics drawing commands, and the GPU will render the final image according to these commands. The frequency of draw calls has an important effect on the efficiency and performance of graphics rendering, and more DrawCall will increase the communication overhead between the CPU and GPU, thereby reducing the rendering performance. Accordingly, optimizing DrawCall numbers is a common method of improving game or application performance.
Specifically, in game making, the number of distant view model surfaces can be reduced by combining the models and the materials, so that drawing call of the GPU is reduced, and rendering efficiency is improved.
In the related art of merging perspective model texture maps, as shown in fig. 1, the UV and texture maps of multiple models are sequentially arranged into the squares to be implemented mainly by counting the number of different textures of the models to be merged, and then creating the squares according to the number of the textures. The method has the advantages that although the algorithm is simple, the result is stable, and full automation can be realized without manual intervention, under the condition that the resolution of the original model map is not uniform, the resolution precision difference of the combined model material map is larger, and the resolution precision difference of the combined model is further enlarged if the combined model is subjected to excessive scaling treatment by art-related software or personnel; and as shown in fig. 1, the star-shaped model UV of the upper right corner exceeds the quadrant range of 0-1, the model map before merging is sampled in a folding manner, and the model map before merging is sampled in a folding manner, but the sampling result of folding after merging is wrong, so that the model rendering effect is wrong, that is, the above manner does not support the quadrant range of the model UV exceeding 0-1, otherwise, errors can occur in the modeling process. In addition, in the case of low UV utilization of the original model, the pixel waste of the final merging result will be caused, further, since the partial engine or platform only supports square mapping, if the number of merging materials is not square of N, the number of squares will be rounded up, and the empty squares after the merging is completed will cause a great amount of pixel waste, i.e. a problem of low UV utilization, for example, the UV shell of 3 models shown in fig. 1, such as the UV shell composed of a circle and a letter e, the UV shell of a letter L, and the UV shell of a star model, which uses the merging method of filling the squares to cause a situation of remaining one empty space, directly resulting in a waste of 25% of pixel space.
According to the embodiment of the invention, the scaling information recorded by the comparison relation during processing and the position information of the proxy UV shell corresponding to the original UV shell during rearrangement in the preset quadrant space are used for generating the target UV shell, and the model maps of the multiple models are combined, so that the difference of resolution precision can be eliminated based on scaling the original UV shell, the pixel utilization rate can be improved based on rearrangement of the proxy UV shell in the preset quadrant space while the pixel is improved, the phenomenon of wasting of a large number of pixels due to blank squares after combination is completed can be avoided, the rendering times can be reduced based on the combined maps of the multiple models, and therefore the drawing call of the GPU is reduced, and the rendering efficiency is improved. Specifically, overlapping UV can be combined through a finding contour algorithm, and the generated agent UV shell is used for rearrangement, so that the pixel utilization rate of the mapping space is improved to the greatest extent; and correcting based on the original map resolution and the counted model scaling information to eliminate the resolution precision difference. Furthermore, overlapping UV can be merged into a proxy model in a topology merging mode, so that the UV utilization rate is further improved. In addition, the model map merging mode provided by the embodiment of the invention can support full automation without manual intervention, although the merging speed is slower compared with the prior art due to complex algorithm.
Referring to fig. 2, a flowchart illustrating steps of an embodiment of a method for merging a map of a model according to the present invention may specifically include the following steps:
step 201, obtaining original UV shells corresponding to a plurality of models respectively;
for the acquisition of multiple models, all perspective three-dimensional models which need to be subjected to mapping and merging can be mainly acquired.
In three-dimensional modeling, the UV Shell (i.e., UV Shell) corresponds to a body that is independent in a local sense of the model, and may refer to dividing the model surface into non-overlapping portions, that is, the model surface will be divided into a plurality of non-overlapping portions during modeling, and the UV Shell may be generally used to indicate a Shell-like structure of texture coordinates of the model surface after the model surface is unfolded, and specifically, the unfolding and arrangement of the texture on the model surface may be controlled by adjusting parameters of the UV Shell.
In one embodiment of the present invention, after the plurality of models required to be mapped and combined are acquired, the original UV shells corresponding to the respective models may be acquired respectively, so that the acquired original UV shells may be processed subsequently. Wherein, in the subsequent process of processing the original UV shell, each UV shell of each model is processed respectively.
Step 202, processing the original UV shell to obtain an agent UV shell, and generating a comparison relation between the original UV shell and the agent UV shell;
the processing of the original UV shell can comprise scaling processing and rearrangement processing, so that the pixel utilization rate is improved based on rearrangement of the original UV shell while the difference of resolution accuracy is eliminated based on scaling processing of the original UV shell, and the phenomenon of wasting a large amount of pixels due to empty squares after merging is avoided.
Specifically, the scaling processing of the original UV shell can be expressed as size correction of the original UV shell based on the original mapping resolution and the counted model scaling information; the rearrangement of the original UV shell is mainly performed on the rearrangement of the proxy UV shell corresponding to the original UV shell, and specifically, the rearrangement of the proxy UV shell is performed in a preset quadrant space.
In one embodiment of the present invention, the original UV shell may be first processed to obtain a proxy UV shell, and then the comparison of the original UV shell and the proxy UV shell may be generated when the original UV shell is processed.
In practical application, the scaling information of the original UV shell during processing and the position information of the agent UV shell corresponding to the original UV shell during rearrangement in a preset quadrant space can be recorded through a comparison relation.
Step 203, generating a target UV shell according to the comparison relation and the original UV shell;
in one embodiment of the present invention, after obtaining a comparison relation for recording the scaling information of the original UV shell during processing and the position information of the proxy UV shell corresponding to the original UV shell during rearrangement in the preset quadrant space, the target UV shell may be generated using the comparison relation.
The original UV shells are original arrangement of textures on the surfaces of the multiple models which are required to be subjected to mapping and merging, the target UV shells utilize scaling information and position information recorded by corresponding relations during processing, and the generated target UV shells are UV shells obtained by scaling the original UV shells of the multiple models and rearranging the original UV shells in a preset quadrant space, namely, the arrangement of the textures on the surfaces of the multiple models by the UV shells is correspondingly changed.
Step 204, obtaining a merging map for a plurality of models according to the target UV shell.
Because the target UV shell is a UV shell obtained after scaling and rearrangement, the resolution precision difference can be reduced to the greatest extent and the maximum space utilization can be satisfied in the merging map obtained through the target UV shell as shown in fig. 3.
The merging map shown in fig. 3 may include target UV shells of multiple models, that is, it may merge the target UV shells of multiple models into the same map, reduce the number of times of sending a rendering instruction by a CPU, ensure that sending a rendering instruction can implement rendering of multiple maps, thereby reducing drawing call of a GPU and improving rendering efficiency.
In the embodiment of the invention, the original UV shells corresponding to the multiple models can be obtained, the agent UV shells are obtained by processing the original UV shells, and the comparison relation between the original UV shells and the obtained agent UV shells is generated, wherein the comparison relation can be mainly used for recording the scaling information of the original UV shells during processing and the position information of the agent UV shells corresponding to the original UV shells during rearrangement in a preset quadrant space, at the moment, the target UV shells can be generated according to the comparison relation and the original UV shells, so that the combined chartlet aiming at the multiple models can be obtained through the generated target UV shells, and the chartlet combination of the multiple models is realized. By using scaling information recorded by the comparison relation during processing of the original UV shell and position information when the proxy UV shell corresponding to the original UV shell is rearranged in a preset quadrant space, a target UV shell is generated, model maps of a plurality of models are combined, the difference of resolution precision can be eliminated based on scaling processing of the original UV shell, the pixel utilization rate can be improved based on rearrangement of the proxy UV shell in the preset quadrant space while the pixel is improved, the phenomenon that a large number of pixels are wasted due to vacant squares after combination is completed is avoided, and rendering times can be reduced based on the combined maps of the plurality of models, so that drawing call of a GPU is reduced, and rendering efficiency is improved.
Referring to fig. 4, a flowchart illustrating steps of an embodiment of a method for map merging of another model of the present invention may specifically include the steps of:
Step 401, scaling the original UV shell to obtain a scaled original UV shell;
In one embodiment of the present invention, a plurality of models to be mapped and combined may be obtained, and original UV shells corresponding to the plurality of models may be obtained, where the obtained original UV shells may be processed, so as to establish a comparison relationship between the original UV shells and the proxy UV shells during the processing.
The processing of the original UV shell can comprise scaling processing and rearrangement processing, so that the pixel utilization rate is improved based on rearrangement of the original UV shell while the difference of resolution accuracy is eliminated based on scaling processing of the original UV shell, and the phenomenon of wasting a large amount of pixels due to empty squares after merging is avoided.
In practical application, the original UV shell can be processed to obtain the proxy UV shell, scaling processing is further performed on the original UV shell, and the proxy UV shell corresponding to the original UV shell is rearranged in a preset quadrant space.
Specifically, the processing procedure may be represented by first performing scaling processing on the original UV shell, so as to generate a corresponding proxy UV shell based on the obtained scaled original UV shell.
In a specific implementation, texture maps of a plurality of models can be obtained, scaling processing is performed on the original UV shell of each model based on the texture maps, and then the scaled original UV shell is obtained. Wherein the texture map obtained may comprise a normal map and a Diffuse map (i.e. a Diffuse map), which may be used to represent the basis nature and details of the object at the 3D model surface in general, and which are typically present in pairs, both for subsequent model classification.
In a preferred embodiment of the present invention, in addition to obtaining texture maps of a plurality of models, material information of the plurality of models may be obtained, where the obtained material information may include a material map used by the models, and map resolution size information, where the material map may be mainly used for subsequent map merging, and the resolution size may be mainly used for correcting and eliminating differences in pixel precision when the maps are subsequently merged.
In the embodiment of the invention, when the mapping merging is performed on the mapping of the models, the material mapping of a large number of models with long scenes is mainly merged, and a plurality of models using the same material mapping possibly appear in the large number of models, and the models are rotationally scaled and placed in a scene at different positions, so that the maximum model scaling value in the scene is counted for correcting the resolution difference, and batch statistics is conveniently performed on the material mapping of the large number of models, at the moment, the models can be classified to obtain a plurality of groups of models, and then batch statistics is performed on the maximum model scaling value of each group of models, so that the subsequent batch scaling treatment is performed on the original UV shells of the same group of models.
In practice, when different materials are used for mapping the same material, the used materials are used for classifying the models, which results in waste of resources, so that the texture mapping used by the models can be used for classifying a plurality of models in a scene. The multiple models can be classified based on the texture mapping to obtain multiple groups of models, and scaling treatment is further carried out on the original UV shells of each group of models to obtain the original UV shells of each group of models after scaling treatment.
Specifically, the diffuse reflection map or the normal map used by each model may be obtained, and in this case, among the plurality of models, the models with the same diffuse reflection map or normal map used may be divided into the same group of models, so as to obtain a plurality of groups of models. Illustratively, models using the same Diffuse map can be classified into one class according to Diffuse maps used by all three-dimensional models in a scene, and it should be noted that, since texture maps such as Diffuse maps and normal maps used by models usually appear in pairs, when classifying models, if classifying based on Diffuse maps, other texture maps are also classified into the same class.
After classifying the multiple models to obtain multiple groups of models, scaling the original UV shell of each group of models to obtain the scaled original UV shell of each group of models.
Specifically, the scaling process of the original UV shell may be represented as a size correction of the original UV shell based on the original map resolution and the statistical model scaling information. In one embodiment of the present invention, a model scaling value preset for each model included in each set of models may be obtained separately, and then, for a certain set of models, a maximum model scaling value among a plurality of model scaling values preset for each model is used as a maximum model scaling value for the set of models. For example, a plurality of perspective models placed in a scene using the same Diffuse map and rotationally scaled at different positions, i.e. for a plurality of models contained within the same group, may be processed according to the same determined maximum model scaling value, eliminating pixel precision differences.
Specifically, the model scaling values of all models may be obtained from a related art engine, which may be model scaling values that are set by an artist person in advance for each model, where the model scaling values are mainly determined based on scaling attributes of the artist person in the game for the corresponding distant model during manufacturing, and the scaling attributes may be mainly determined based on mapping resolution size information of each set of models, and the manner of determining the model scaling values of each model is not limited herein. At this time, after the model scaling value of each model in each group of models is obtained, the maximum model scaling value in the group can be used as the maximum model scaling value of all models in the group, so as to use the maximum model scaling value to scale the original UV shells of all models in the group. Step 402, generating a proxy UV shell based on the scaled original UV shell;
In the embodiment of the invention, the original UV shells of the multiple models can be scaled according to different groups of models.
In order to maximize UV utilization, the pixel utilization may be greatly increased by merging overlapping UV, generating a proxy UV shell based on the scaled original UV shell.
Specifically, in one case, if the UV shells with overlapping requirements exist in the original UV shells after the scaling processing corresponding to the different groups of models, the UV shells with overlapping requirements can be combined to obtain the proxy UV shell; and in another case, the original UV shell after scaling treatment except the UV shell with the overlapping requirement can be used as the proxy UV shell of the corresponding model, namely, for the UV shell without the overlapping requirement in the original UV shell after scaling treatment, the generation step of the proxy UV shell is not needed, and the original UV shell after scaling treatment can be directly used as the proxy UV shell.
Illustratively, as shown in the left part of fig. 5, if overlapping UV detection is not performed at this time, when rearrangement processing is performed subsequently, two UV shells, i.e., a circle and a letter e, are regarded as two different UV shells to be arranged, thereby causing a decrease in UV utilization rate; in the embodiment of the invention, overlapping UV can be combined by a topology combining method, and as shown in the right part of fig. 5, a circle and a letter e can be combined to obtain a proxy UV shell, and the proxy UV shell is used as a unified whole for subsequent rearrangement processing, so that the UV utilization rate is further improved.
In practical application, models with overlapping requirements in different groups of models can be obtained, the UV shell boundaries of the models with the overlapping requirements in the original UV shells after corresponding scaling treatment and the corresponding vertexes of overlapping UV in the models with the overlapping requirements can be obtained, then a UV shell contour curve can be obtained based on the UV shell boundaries, the vertexes corresponding to the overlapping UV can be determined on the UV shell contour curve, and topological connection is carried out on the vertexes corresponding to the overlapping UV to generate the proxy UV shell.
Wherein UV shell boundaries, mainly referred to as open edges of the UV shell, can be used to define the shape and size of the UV shell, which open edges of the UV shell can be used to determine boundaries and connection patterns of textures during 3D modeling and rendering, and the development and arrangement of textures on the model surface, and the connection patterns between textures can be controlled, typically by adjusting the open edges of the UV shell. The topology merging process may be performed by performing a boolean operation on the UV shell profile curves, where the boolean operation may merge overlapping UV topologies that occur in the profile curves to generate a proxy UV shell for the entire topological connection, which is not limited in this embodiment for a specific boolean operation process.
Step 403, establishing a comparison relation between the original UV shell and the proxy UV shell;
The established comparison relation can be used for recording scaling information of the original UV shell during processing and position information of the agent UV shell corresponding to the original UV shell during rearrangement in a preset quadrant space, and particularly can be used for recording transformation matrix data of the agent UV shell and the original UV shell after rearrangement so as to generate a target UV shell and a merging map for a plurality of models based on relevant information recorded in the comparison relation.
In order to facilitate the recording of transformation matrix data between the proxy UV shell and the original UV shell in a comparison relationship, the established comparison relationship is mainly aimed at the comparison relationship between the original UV shell and the proxy UV shell, in one case, when there is a UV shell with overlapping requirements in the original UV shells after corresponding scaling treatment of different groups of models, the aforementioned comparison relationship can be specifically used for indicating which original UV shells the proxy UV shell is obtained by combining, i.e. the target original UV shell for combining to obtain the proxy UV shell can be determined, and then the comparison relationship between the proxy UV shell and the target original UV shell is established; in another case, for other UV shells where there is an overlapping demand, there is no merging information as indicated by the collation relationship, since the determined proxy UV shell is essentially the original UV shell after the scaling process.
In practical application, the proxy UV shell can mainly store the identification, i.e. ID, of the original UV shell before merging in the form of an array based on the established record of the comparison relation, which is not limited in this embodiment of the present invention.
Step 404, rearranging the agent UV shell in a preset quadrant control, and recording the position information when rearranging in a comparison relation;
In a preferred embodiment of the present invention, after the proxy UV shells are generated, the proxy UV shells of different sets of models may also be placed in a preset quadrant space according to texture coordinates corresponding to the respective original UV shells.
At this time, after the comparison relation between the proxy UV shell and the target original UV shell is generated, the proxy UV shell corresponding to the original UV shell may be rearranged in a preset quadrant space, so as to further improve the pixel utilization rate based on the rearrangement.
In one embodiment of the invention, a preset space filling algorithm may be employed to rearrange the proxy UV shells placed in the preset quadrant space. Wherein, because the overlapped UV is combined into the agent UV shell, and the agent UV shells are unified, when the space filling algorithm is adopted for rearrangement, the agent UV shells are not overlapped with each other. It should be noted that, the space filling algorithm used may treat UV Shell as a partitionable space, and by gradually filling the faces into the space to implement the arrangement, the commonly used space filling algorithm may be a greedy algorithm, a graph-based algorithm, or the like, so as to effectively reduce the overlap, which is not limited by the embodiment of the present invention.
In practical applications, the proxy UV shell corresponding to the original UV shell may be rearranged in a preset quadrant space, for example, UV01 quadrant space, and at this time, because the scaling process is performed on the proxy UV shell, that is, the pixel precision is eliminated, and the space utilization rate is improved based on rearrangement, the subsequent higher pixel map merging can be implemented in the UV01 quadrant space, for example, the merging map with a unit area pixel of 3.11 is generated, and compared with the merging map with a unit area pixel of 1 shown in fig. 1, pixel lifting exists.
In a preferred embodiment of the present invention, in the process of rearranging the proxy UV shell in the preset quadrant space, the position information of the rearranged proxy UV shell in the preset quadrant space may be obtained, the mapping path used by the original UV shell may be obtained, and the obtained position information and the mapping path are used as transformation matrix data and recorded in the generated comparison relationship, so as to facilitate the subsequent use in the generation of the target UV shell and the generation of the merged mapping.
Step 405, generating a target UV shell according to the comparison relation and the original UV shell;
The comparison relation is mainly used for recording transformation matrix data of the agent UV shell and the original UV shell which are rearranged in a preset quadrant space, wherein the transformation matrix data can comprise position information of the agent UV shell corresponding to the original UV shell when rearranged in the preset quadrant space and mapping paths used by the original UV shell in corresponding UV positions, and the position information is mainly used for indicating the changed UV positions.
In one embodiment of the present invention, after obtaining a comparison relation for recording the scaling information of the original UV shell during processing and the position information of the proxy UV shell corresponding to the original UV shell during rearrangement in the preset quadrant space, the target UV shell may be generated using the comparison relation.
Specifically, transformation matrix data may be applied to the original UV shell to obtain the target UV shell. For example, the transformation matrix data recorded in each agent UV shell during rearrangement can be applied on the original UV shell according to the comparison relation between the original UV shell and the agent UV shell stored before, the position of the new UV shell after the application is consistent with that of the agent UV shell, the new UV shell is the target UV shell, at this time, the model part processing is completed, and the final model data can be saved and output.
Step 406, obtaining a merging map for the plurality of models according to the target UV shell.
In the process of obtaining the merging and mapping according to the target UV, specifically, pixel points contained in the target UV shell can be obtained, position information of each pixel point in a preset quadrant space and a mapping path used before rearrangement are obtained based on transformation matrix data, then the position information of each pixel point in the preset quadrant space and the mapping path before rearrangement are adopted, color information corresponding to each pixel point is obtained through sampling, and at the moment, the color information corresponding to each sampled pixel point can be applied to the target UV shell to obtain the merging and mapping.
In practical application, the target UV shell of the transformation data is used, the UV position before transformation and the Diffuse mapping, normal mapping and other mapping paths used by the phase UV shell before transformation of the UV position are stored in advance, at this time, the position of the target UV shell after transformation can be used to generate the combined material mapping, and the combined mapping is obtained.
Wherein, because the target UV shell is a UV shell obtained after scaling treatment and rearrangement in a preset quadrant space, the resolution precision difference can be reduced to the greatest extent and the space utilization can be satisfied to the greatest extent as shown in fig. 3 in the merging map of the model material maps performed by the target UV shell.
In the embodiment of the invention, the scaling information recorded by the comparison relation during processing and the position information recorded during rearrangement of the proxy UV shell corresponding to the original UV shell are used for generating the target UV shell, and the model maps of the models are combined, so that the difference of resolution precision can be eliminated based on scaling the original UV shell, the pixel utilization rate can be improved while the pixel is improved based on rearrangement of the proxy UV shell in the preset quadrant space, the phenomenon of wasting a large number of pixels due to vacant squares after the combination is completed is avoided, and the rendering times can be reduced based on the combined maps of the models, thereby reducing the drawing call of the GPU and improving the rendering efficiency. Furthermore, overlapping UV can be merged into a proxy model in a topology merging mode, so that the UV utilization rate is further improved. In addition, the model map merging mode provided by the embodiment of the invention can support full automation without manual intervention, although the merging speed is slower compared with the prior art due to complex algorithm.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 6, a block diagram illustrating an embodiment of a mapping merging apparatus for a model according to the present invention may specifically include the following modules:
The original UV shell acquisition module 601 is configured to acquire original UV shells corresponding to the multiple models respectively; the original UV shell is used for indicating a shell-shaped structure of texture coordinates of the model surface after the model surface is unfolded;
A control relation generating module 602, configured to process the original UV shell to obtain a proxy UV shell, and generate a control relation between the original UV shell and the proxy UV shell; the control relation is used for recording scaling information of the original UV shell during processing and position information of the agent UV shell corresponding to the original UV shell during rearrangement in a preset quadrant space;
A target UV shell generation module 603 for generating a target UV shell according to the control relationship and the original UV shell;
and the mapping merging module 604 is configured to obtain a merging mapping for the multiple models according to the target UV shell.
In one embodiment of the invention, the collation relation generation module 602 may comprise the following sub-modules:
The control relation generation sub-module is used for carrying out scaling treatment on the original UV shell to obtain the scaled original UV shell; generating a proxy UV shell based on the scaled raw UV shell; and establishing a comparison relation between the original UV shell and the proxy UV shell.
In one embodiment of the invention, the collation relation generation sub-module may comprise the following units:
The scaling processing unit is used for obtaining texture maps used by the multiple models respectively; classifying the plurality of models based on the texture map to obtain a plurality of groups of models; and scaling the original UV shell of each group of models to obtain the scaled original UV shell of each group of models.
In one embodiment of the invention, the texture map comprises a diffuse reflection map and a normal map; the scaling processing unit may comprise the following sub-units:
The scaling processing subunit is used for dividing the models with the same diffuse reflection mapping or normal mapping into the same group of models in the multiple models to obtain multiple groups of models; and determining a maximum model scaling value for each set of models, respectively; and scaling each original UV shell contained in the current group of models by adopting the maximum model scaling value of each group of models.
The step of determining the maximum model scaling value of each group of models respectively may include obtaining model scaling values preset by each model included in each group of models respectively; and regarding a certain group of models, taking the maximum model scaling value among a plurality of model scaling values preset by each model as the maximum model scaling value of the group of models.
In one embodiment of the present invention, the scaling process is performed on the original UV shells of the plurality of models according to different sets of models, and the collation relation generation sub-module may include the following units:
the agent UV shell generation unit is used for merging the UV shells with the overlapping requirements when the UV shells with the overlapping requirements exist in the original UV shells after the corresponding scaling treatment of different groups of models, so as to obtain agent UV shells; and taking other scaled original UV shells except the UV shells with overlapping requirements as proxy UV shells of the corresponding models.
In one embodiment of the invention, the proxy UV shell generation unit may comprise the following sub-units:
The agent UV shell generation subunit is used for acquiring the models with overlapping requirements in different groups of models, acquiring UV shell boundaries of the models with the overlapping requirements in the original UV shells after corresponding scaling treatment, and corresponding vertexes of overlapping UV in the models with the overlapping requirements; obtaining a UV shell contour curve based on the UV shell boundary, and determining a vertex corresponding to the overlapped UV on the UV shell contour curve; and carrying out topological connection on the peaks corresponding to the overlapped UV, and generating the proxy UV shell.
In one embodiment of the invention, after the generation of the proxy UV shell, the collation relation generation sub-module may further comprise the following units:
And the proxy UV shell placing unit is used for placing the proxy UV shells of different groups of models in the preset quadrant space according to texture coordinates corresponding to the corresponding original UV shells.
In one embodiment of the present invention, after the establishment of the control relationship between the original UV shell and the proxy UV shell, the control relationship generation module 602 may further include the following sub-modules:
A rearrangement sub-module for rearranging the agent UV shell placed in the preset quadrant space by adopting a preset space filling algorithm; acquiring position information of the agent UV shell in the preset quadrant space after rearrangement; obtaining a mapping path used by the original UV shell; and recording the position information and the mapping path as transformation matrix data in the comparison relation.
In one embodiment of the present invention, the comparison relationship is used to record transformation matrix data of the proxy UV shell and the original UV shell rearranged in a preset quadrant space; the target UV shell generation module 603 may include the following sub-modules:
And the target UV shell generation sub-module is used for applying the transformation matrix data to the original UV shell to obtain the target UV shell.
In one embodiment of the invention, the map merging module 604 may include the following sub-modules:
The merging and mapping generation sub-module is used for acquiring pixel points contained in the target UV shell, and acquiring position information of each pixel point in the preset quadrant space and a mapping path used before rearrangement based on the transformation matrix data; sampling to obtain color information corresponding to each pixel point by adopting the position information of each pixel point in the preset quadrant space and the mapping path before rearrangement; and applying the color information corresponding to each sampled pixel point in the target UV shell to obtain a merging map.
In the embodiment of the invention, the model mapping merging model provided by the embodiment of the invention can obtain the original UV shells corresponding to the plurality of models respectively, obtain the proxy UV shells by processing the original UV shells, and generate the comparison relation between the original UV shells and the obtained proxy UV shells, wherein the comparison relation can be mainly used for recording the scaling information of the original UV shells during processing and the position information of the proxy UV shells corresponding to the original UV shells during rearrangement in a preset quadrant space, and at the moment, the target UV shells can be generated according to the comparison relation and the original UV shells, so that the merging mapping aiming at the plurality of models can be obtained through the generated target UV shells, and mapping merging of the plurality of models can be realized. By using scaling information recorded by the comparison relation during processing of the original UV shell and position information when the proxy UV shell corresponding to the original UV shell is rearranged in a preset quadrant space, a target UV shell is generated, model maps of a plurality of models are combined, the difference of resolution precision can be eliminated based on scaling processing of the original UV shell, the pixel utilization rate can be improved based on rearrangement of the proxy UV shell in the preset quadrant space while the pixel is improved, the phenomenon that a large number of pixels are wasted due to vacant squares after combination is completed is avoided, and rendering times can be reduced based on the combined maps of the plurality of models, so that drawing call of a GPU is reduced, and rendering efficiency is improved.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
The embodiment of the invention also provides electronic equipment, which comprises:
The method comprises a processor, a memory and a computer program which is stored in the memory and can run on the processor, wherein the computer program realizes all the processes of the mapping merging method embodiment of the model when being executed by the processor, can achieve the same technical effect, and is not repeated here for avoiding repetition.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, realizes the processes of the mapping merging method embodiment of the model, and can achieve the same technical effects, and in order to avoid repetition, the description is omitted.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region, and provide corresponding operation entries for the user to select authorization or rejection.
It is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or terminal device that comprises the element.
The foregoing describes in detail a method for merging maps of a model, a device for merging maps of a model, a corresponding electronic device and a corresponding computer-readable storage medium, and applies specific examples to illustrate the principles and embodiments of the present invention, the above examples being only used to help understand the method and core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (15)

1. A method of map merging for a model, the method comprising:
Obtaining original UV shells corresponding to the multiple models respectively; the original UV shell is used for indicating a shell-shaped structure of texture coordinates of the model surface after the model surface is unfolded;
processing the original UV shell to obtain an agent UV shell, and generating a comparison relation between the original UV shell and the agent UV shell; the control relation is used for recording scaling information of the original UV shell during processing and position information of the agent UV shell corresponding to the original UV shell during rearrangement in a preset quadrant space;
Generating a target UV shell according to the control relation and the original UV shell;
And obtaining a merging map aiming at the multiple models according to the target UV shell.
2. The method of claim 1, wherein said processing said original UV shell to obtain a proxy UV shell, generating a comparison of said original UV shell and said proxy UV shell, comprises:
scaling the original UV shell to obtain a scaled original UV shell;
Generating a proxy UV shell based on the scaled raw UV shell;
and establishing a comparison relation between the original UV shell and the proxy UV shell.
3. The method according to claim 2, wherein the scaling the original UV shell to obtain a scaled original UV shell comprises:
Obtaining texture maps respectively used by the multiple models;
Classifying the plurality of models based on the texture map to obtain a plurality of groups of models;
And scaling the original UV shell of each group of models to obtain the scaled original UV shell of each group of models.
4. The method of claim 3, wherein the texture map comprises a diffuse reflection map and a normal map; classifying the plurality of models based on the texture map to obtain a plurality of groups of models, including:
And dividing the models with the same diffuse reflection map or normal map into the same group of models to obtain a plurality of groups of models.
5. A method according to claim 3, wherein scaling the raw UV shells of each set of models to obtain scaled raw UV shells of each set of models comprises:
determining the maximum model scaling value of each group of models respectively;
and scaling each original UV shell contained in the current group of models by adopting the maximum model scaling value of each group of models.
6. The method of claim 5, wherein the determining the maximum model scaling value for each set of models, respectively, comprises:
respectively obtaining model scaling values preset by each model contained in each group of models;
And regarding a certain group of models, taking the maximum model scaling value among a plurality of model scaling values preset by each model as the maximum model scaling value of the group of models.
7. The method of claim 2, wherein the scaling of the raw UV shells of the plurality of models by different sets of models, the generating a proxy UV shell based on the scaled raw UV shells, comprising:
if the UV shells with overlapping requirements exist in the original UV shells after corresponding scaling treatment of different groups of models, merging the UV shells with the overlapping requirements to obtain proxy UV shells; and
And taking other scaled original UV shells except the UV shells with overlapping requirements as proxy UV shells of corresponding models.
8. The method according to claim 7, wherein if there is an overlapping UV shell in the original UV shells after the scaling processing corresponding to the different models, merging the UV shells with overlapping requirements to obtain a proxy UV shell, including:
acquiring models with overlapping requirements in different groups of models, and acquiring UV shell boundaries of the models with the overlapping requirements in the original UV shells after corresponding scaling treatment and corresponding peaks of overlapping UV in the models with the overlapping requirements;
Obtaining a UV shell contour curve based on the UV shell boundary, and determining a vertex corresponding to the overlapped UV on the UV shell contour curve;
and carrying out topological connection on the peaks corresponding to the overlapped UV, and generating the proxy UV shell.
9. The method of claim 2 or 7, further comprising, after the generating the proxy UV shell:
And placing the proxy UV shells of different groups of models in the preset quadrant space according to texture coordinates corresponding to the corresponding original UV shells.
10. The method of claim 9, further comprising, after said establishing a relationship between said original UV shell and said proxy UV shell:
Rearranging agent UV shells placed in a preset quadrant space by adopting a preset space filling algorithm;
Acquiring position information of the agent UV shell in the preset quadrant space after rearrangement;
obtaining a mapping path used by the original UV shell;
And recording the position information and the mapping path as transformation matrix data in the comparison relation.
11. The method according to claim 1, wherein the collation relation is used for recording transformation matrix data of the proxy UV shell and the original UV shell rearranged in a preset quadrant space; the generating a target UV shell according to the control relation and the original UV shell comprises:
And applying the transformation matrix data to the original UV shell to obtain a target UV shell.
12. The method of claim 11, wherein the deriving a merged map for the plurality of models from the target UV shells comprises:
Acquiring pixel points contained in the target UV shell, and acquiring position information of each pixel point in the preset quadrant space and a mapping path used before rearrangement based on the transformation matrix data;
sampling to obtain color information corresponding to each pixel point by adopting the position information of each pixel point in the preset quadrant space and the mapping path before rearrangement;
and applying the color information corresponding to each sampled pixel point in the target UV shell to obtain a merging map.
13. A map merging apparatus of a model, the apparatus comprising:
The original UV shell acquisition module is used for acquiring original UV shells corresponding to the multiple models respectively; the original UV shell is used for indicating a shell-shaped structure of texture coordinates of the model surface after the model surface is unfolded;
The control relation generation module is used for processing the original UV shell to obtain a proxy UV shell and generating a control relation between the original UV shell and the proxy UV shell; the control relation is used for recording scaling information of the original UV shell during processing and position information of the agent UV shell corresponding to the original UV shell during rearrangement in a preset quadrant space;
A target UV shell generation module for generating a target UV shell from the control relationship and the original UV shell;
and the mapping merging module is used for obtaining merging mapping aiming at the multiple models according to the target UV shell.
14. An electronic device, comprising: a processor, a memory and a computer program stored on the memory and capable of running on the processor, which when executed by the processor implements the mapping merging method of the model according to any one of claims 1 to 12.
15. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements a mapping merging method of a model according to any of the claims 1 to 12.
CN202311860312.5A 2023-12-29 2023-12-29 Mapping merging method and device for model, electronic equipment and storage medium Pending CN117994404A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311860312.5A CN117994404A (en) 2023-12-29 2023-12-29 Mapping merging method and device for model, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311860312.5A CN117994404A (en) 2023-12-29 2023-12-29 Mapping merging method and device for model, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117994404A true CN117994404A (en) 2024-05-07

Family

ID=90886206

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311860312.5A Pending CN117994404A (en) 2023-12-29 2023-12-29 Mapping merging method and device for model, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117994404A (en)

Similar Documents

Publication Publication Date Title
CN107730503B (en) Image object component level semantic segmentation method and device embedded with three-dimensional features
US20210012558A1 (en) Method and apparatus for reconstructing three-dimensional model of human body, and storage medium
CN105678683B (en) A kind of two-dimensional storage method of threedimensional model
CN113178014B (en) Scene model rendering method and device, electronic equipment and storage medium
CN110990516B (en) Map data processing method, device and server
CN110368694B (en) Game scene data processing method, device, equipment and readable storage medium
CN109949693B (en) Map drawing method and device, computing equipment and storage medium
JP2024515867A (en) Mapping three-dimensional model slicing method, printing method, apparatus and device
CN112288665A (en) Image fusion method and device, storage medium and electronic equipment
WO2023160050A1 (en) Data processing method, apparatus and device, and storage medium
CN109410213A (en) Polygon pel method of cutting out, computer readable storage medium, electronic equipment based on bounding box
WO2018039936A1 (en) Fast uv atlas generation and texture mapping
US20230033319A1 (en) Method, apparatus and device for processing shadow texture, computer-readable storage medium, and program product
CN114241151A (en) Three-dimensional model simplification method and device, computer equipment and computer storage medium
CN109115773A (en) Tire information verification method, device and storage medium
CN100593789C (en) Technology for providing network game anti external hanging image origin by 3D technology
CN113681897B (en) Slice processing method, printing method, system, device and storage medium
CN113256755B (en) Image rendering method, intelligent terminal and storage device
CN116310060B (en) Method, device, equipment and storage medium for rendering data
CN109871939B (en) Image processing method and image processing device
CN112562067A (en) Method for generating large-batch point cloud data sets
CN117994404A (en) Mapping merging method and device for model, electronic equipment and storage medium
CN116228986A (en) Indoor scene illumination estimation method based on local-global completion strategy
CN110838167A (en) Model rendering method and device and storage medium
US20220406016A1 (en) Automated weighting generation for three-dimensional models

Legal Events

Date Code Title Description
PB01 Publication