Model processing method and device and electronic equipment
By generating simplified model components and coding through offline preprocessing model components, and generating proxy models online, solving performance bottlenecks caused by complex models and achieving efficient rendering and low-latency gaming experience.
Patent Information
- Application Number
- CN202510311914.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-07-25
AI Technical Summary
In games, complex model structures lead to degradation of client rendering performance. The existing technology merges models and maps on the server side will affect server performance, while the client merging models in real time consumes a lot of performance.
By preprocessing model components offline, simplified model components and component encoding are generated, proxy models are generated online, and the client only renders, reducing model processing and data transmission.
It reduces the performance consumption of clients and servers, improves rendering efficiency and server throughput, and supports more players to build online games at the same time.
Smart Images

Figure CN120361544A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of model rendering, and in particular, to a model processing method, apparatus, and electronic device. Background Art
[0002] In some games, players can build various complex model structures, such as various buildings, which results in a large number of faces and rendering calls of the model components that make up the model structure, affecting the rendering performance of the client. In related technologies, usually, the model and texture are merged on the server side, the merged model is decimated, and then transmitted to the client; or real-time mesh merging and texturing are performed on the client side. However, in the above methods, the implementation on the server side requires merging the model and texture, which affects the performance of the server; the implementation on the client side, although it can reduce the rendering calls, will consume a large amount of client performance. Summary of the Invention
[0003] In view of this, the purpose of the present disclosure is to provide a model processing method, apparatus, and electronic device. By offline preprocessing the model components, the server generates a proxy model of the game model online, and the client only needs to receive the proxy model and render it without performing model processing and data transmission, so as to reduce the performance consumption of the client and the server.
[0004] In a first aspect, an embodiment of the present disclosure provides a model processing method, which is applied to a terminal device. The method includes: in an offline state, determining a component set of a target game by a first terminal device, preprocessing the model components included in the component set offline to obtain simplified model components, determining the texture path of the component texture corresponding to the simplified model components, and generating a correspondence between the component codes and the texture paths of the simplified model components; where the component code is the unique identifier of the simplified model component; during the operation of the target game, receiving, by a second terminal device, a proxy model corresponding to the game model sent by the server; where the game model is composed of multiple model components, the proxy model is obtained by merging multiple simplified model components, and the vertex data of the proxy model includes sequential codes, and the sequential code is the sequence number of the simplified model component in a preset arrangement order, and the preset arrangement order is the arrangement order of multiple simplified model components; determining the texture array of the proxy model according to the component codes and the correspondence of the multiple simplified model components; performing texture sampling on the texture array according to the sequential codes, and rendering the proxy model according to the sampling result.
[0005] Second aspect, embodiments of the present disclosure provide a model processing method, which is applied to a server. The method includes: receiving a simplified model component of a model component included in a component set of a target game sent by a first terminal device, and a correspondence relationship between the component encoding of the simplified model component and the texture map path of the component texture map corresponding to the simplified model component; wherein, the simplified model component is obtained by the first terminal device performing offline preprocessing on the model component in an offline state, the correspondence relationship is generated by the first terminal device in an offline state, and the component encoding is the unique identifier of the simplified model component; during the running of the target game, obtaining a game model, and determining an initial proxy model corresponding to the game model according to the topological structure of the game model and a plurality of simplified model components; wherein, the game model is composed of a plurality of model components; determining a sequence encoding according to a preset arrangement order of the plurality of simplified model components, and writing the sequence encoding into the vertex data of the initial proxy model to obtain a proxy model corresponding to the game model; sending the proxy model to a second terminal device, and determining a texture array of the proxy model by the second terminal device according to the component encoding of the plurality of simplified model components and the correspondence relationship; performing texture sampling on the texture array according to the sequence encoding, and rendering the proxy model according to the sampling result.
[0006] Third aspect, embodiments of the present disclosure provide a model processing device, which is arranged in a terminal device. The device includes: a first determination module, configured to determine, in an offline state by a first terminal device, a component set of a target game, perform offline preprocessing on a model component included in the component set to obtain a simplified model component, determine the texture map path of the component texture map corresponding to the simplified model component, and generate a correspondence relationship between the component encoding of the simplified model component and the texture map path; wherein, the component encoding is the unique identifier of the simplified model component; a model receiving module, configured to receive, during the running of the target game by a second terminal device, a proxy model corresponding to a game model sent by a server; wherein, the game model is composed of a plurality of model components, the proxy model is obtained by merging a plurality of simplified model components, and the vertex data of the proxy model includes a sequence encoding, and the sequence encoding is the sequence number of the simplified model component in a preset arrangement order, and the preset arrangement order is the arrangement order of the plurality of simplified model components; a second determination module, configured to determine a texture array of the proxy model according to the component encoding of the plurality of simplified model components and the correspondence relationship; a model rendering module, configured to perform texture sampling on the texture array according to the sequence encoding, and render the proxy model according to the sampling result.
[0007] Fourth aspect, an embodiment of the present disclosure provides a model processing device, which is disposed in a server. The device includes: a first receiving module, configured to receive a simplified model component of a model component included in a component set of a target game sent by a first terminal device, and a correspondence relationship between the component encoding of the simplified model component and the texture map path of the corresponding component texture map of the simplified model component; wherein, the simplified model component is obtained by the first terminal device performing offline preprocessing on the model component in an offline state, the correspondence relationship is generated by the first terminal device in an offline state, and the component encoding is the unique identifier of the simplified model component; a third determining module, configured to, during the running of the target game, obtain a game model, and determine an initial proxy model corresponding to the game model according to the topological structure of the game model and a plurality of simplified model components; wherein, the game model is composed of a plurality of model components; a fourth determining module, configured to determine a sequence encoding according to a preset arrangement order of the plurality of simplified model components, and write the sequence encoding into the vertex data of the initial proxy model to obtain a proxy model corresponding to the game model; a model sending module, configured to send the proxy model to a terminal device, and the terminal device determines a texture array of the proxy model according to the component encoding of the plurality of simplified model components and the correspondence relationship; perform texture sampling on the texture array according to the sequence encoding, and render the proxy model according to the sampling result.
[0008] Fifth aspect, an embodiment of the present disclosure provides an electronic device, including a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor. The processor executes the computer-executable instructions to implement the model processing method of any item in the first aspect, or implement the model processing method of any item in the second aspect.
[0009] Sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the model processing method of any item in the first aspect, or implement the model processing method of any item in the second aspect.
[0010] The embodiments of the present disclosure bring the following beneficial effects:
[0011] The present disclosure provides a model processing method, apparatus, and electronic device. When the first terminal device is in an offline state, it determines a component set of a target game, performs offline preprocessing on the model components included in the component set to obtain simplified model components, determines the texture path of the component texture corresponding to the simplified model components, and generates a correspondence relationship between the component codes and texture paths of the simplified model components; wherein, the component code is the unique identifier of the simplified model component. When the second terminal device is running the target game, it receives a proxy model corresponding to the game model sent by the server; wherein, the proxy model is obtained by merging multiple simplified model components, and the vertex data of the proxy model includes sequential codes, and the sequential code is the sequence number of the simplified model component in a preset arrangement order, and the preset arrangement order is the arrangement order of multiple simplified model components. According to the component codes and the correspondence relationship of the multiple simplified model components, the texture array of the proxy model is determined; texture sampling is performed on the texture array according to the sequential code, and the proxy model is rendered according to the sampling result. In this way, by performing offline preprocessing on the model components offline and generating a proxy model of the game model by the server online, the client does not need to perform model processing and data transmission, and only needs to receive the proxy model and render it, reducing the performance consumption of the client and the server.
[0012] Other features and advantages of the present disclosure will be described in the following specification, and, in part, will be obvious from the specification, or will be understood by implementing the present disclosure. The objectives and other advantages of the present disclosure are achieved and obtained by the structures specifically pointed out in the specification, claims, and drawings.
[0013] To make the above objectives, features, and advantages of the present disclosure more obvious and understandable, the following specific preferred embodiments are given in conjunction with the accompanying drawings and are described in detail as follows. Description of the Drawings
[0014] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present disclosure. For those skilled in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0015] Figure 1 It is a flowchart of a model processing method provided by an embodiment of the present disclosure;
[0016] Figure 2 It is a flowchart of another model processing method provided by an embodiment of the present disclosure;
[0017] Figure 3 It is a schematic structural diagram of a model processing apparatus provided by an embodiment of the present disclosure;
[0018] Figure 4 A structural schematic diagram of another model processing device provided by an embodiment of the present disclosure;
[0019] Figure 5 A structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. Detailed implementation manners
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.
[0021] In some games, players can build various complex model structures, such as various buildings, which results in a large number of faces and rendering calls of the model components that make up the model structure, affecting the rendering performance of the client. In the related art, usually, the model and texture are merged on the server side, the merged model is decimated, and then transmitted to the client. Although this technical means can solve the performance problem when the client merges the model and reduce the number of faces and rendering calls of the client, the content that needs to be transmitted over the network is relatively large, especially the texture data. It is also necessary to distinguish different platforms for transmission, and there is a large consumption of server computing power for compressing the texture. The server also needs to transmit the texture data, so more server disk space is required.
[0022] By performing real-time mesh merging on the client side, adjacent model elements can be merged into one mesh, or the model can be rendered through GPU instancing. The first above-mentioned technical means can reduce the number of faces and rendering calls in the final rendering, but there will be performance consumption on the client side when merging the meshes, and the number of faces of the merged model is the same as before merging. Since the number of rendering calls in the second above-mentioned technical means is proportional to the number of model types and the number of levels of detail of the model, and the product of the number of model types and the number of levels of detail used by the player to build is not a small number, using this technology cannot reduce the rendering calls to the greatest extent. Based on this, an embodiment of the present disclosure provides a model processing method, device, and electronic device, and this technology can be applied to devices with rendering functions such as mobile phones, laptops, tablets, and servers.
[0023] To facilitate the understanding of this embodiment, first, a model processing method disclosed in an embodiment of the present disclosure will be introduced in detail. This method is applied to a terminal device, such as Figure 1 As shown, the method includes the following steps:
[0024] Step S102, when the first terminal device is in an offline state, determine the component set of the target game, perform offline preprocessing on the model components included in the component set to obtain simplified model components, determine the texture path of the component texture corresponding to the simplified model components, and generate the correspondence between the component codes and texture paths of the simplified model components; wherein, the component code is the unique identifier of the simplified model component;
[0025] In the offline state, obtain the component set from the game-related files corresponding to the target game through the first terminal device (or through the target program running in the first terminal device). The component types of this component set are pre-configured, such as the component set of building types, or the component set of furniture types, etc. The component set includes multiple model components. For example, the component set of building types includes floor model components, wall model components, tile model components, window model components, etc.; again, for example, the component set of furniture types includes sofa model components, table model components, bed model components, etc.
[0026] Among them, to perform offline preprocessing on the model components included in the component set to obtain simplified model components, one optional implementation is: for each model component, perform face reduction processing on the model component to obtain a simplified model component. Another optional implementation is: for each model component, optimize the vertex data of the model component. For example, reduce the floating-point precision, convert floating-point values to integers, etc. Another optional implementation is: for each model component, optimize the topology of the model component. For example, merge coplanar triangles, rewire, etc.
[0027] Among them, to determine the texture path of the component texture corresponding to the simplified model component, one optional implementation is: obtain at least one texture corresponding to the simplified model component, determine the component texture corresponding to the simplified model component according to the at least one texture, save the component texture to a specified folder, and determine the texture path of the component texture according to the specified folder. Another optional implementation is: obtain the pre-configured component texture of the simplified model component, and determine the texture path of the component texture corresponding to the simplified model component according to the save path of the component texture.
[0028] Among them, to generate the correspondence between the component codes and texture paths of the simplified model components, it can be to generate a mapping table according to the correspondence between the component codes of the simplified model components and the texture paths of the component textures corresponding to the simplified model components.
[0029] The above component codes are pre-set, and the component code is the unique identifier of the simplified model component. Of course, the component code is also the unique identifier of the model component.
[0030] Step S104, during the operation of the target game, the second terminal device receives the proxy model corresponding to the game model sent by the server; the game model is composed of multiple model components, the proxy model is obtained by merging multiple simplified model components, and the vertex data of the proxy model includes sequential encodings, where the sequential encoding is the sequence number of the simplified model component in the preset arrangement order, and the preset arrangement order is the arrangement order of multiple simplified model components;
[0031] When the target game is running, in response to the virtual character, player, or non-player character completing the construction of the game model in the game scene, the second terminal device sends the game model to the server. The server generates the proxy model of the game model and then sends the proxy model to the terminal device.
[0032] For example, the proxy model includes multiple simplified model components (i.e., the proxy model is composed of multiple simplified model components joined together), the first simplified model component (component code: aa), the second simplified model component (component code: bb), the third simplified model component (component code: nn), the fourth simplified model component (component code: mm), the fifth simplified model component (component code: ss), and the preset arrangement order is: the second simplified model component, the fourth simplified model component, the fifth simplified model component, the first simplified model component, the third simplified model component; the vertex data of the proxy model includes sequential encodings: 001 corresponds to the second simplified model component, 002 corresponds to the fourth simplified model component, 003 corresponds to the fifth simplified model component, 004 corresponds to the first simplified model component, and 005 corresponds to the third simplified model component.
[0033] Optionally, the model material of the proxy model further includes a target array, which includes component codes arranged in the preset arrangement order. According to the preset arrangement order in the above example, the component codes included in the target array are: bb (i.e., the component code of the second simplified model component), mm (i.e., the component code of the fourth simplified model component), ss (i.e., the component code of the fifth simplified model component), aa (i.e., the component code of the first simplified model component), nn (i.e., the component code of the third simplified model component).
[0034] Step S106, determine the texture array of the proxy model according to the component codes and corresponding relationships of multiple simplified model components;
[0035] The execution subject of the above step S106 is the second terminal device. Optionally, according to the component codes and corresponding relationships in the model material of the proxy model, determine the texture map path corresponding to the component code from the corresponding relationship, obtain the corresponding component texture map according to the texture map path, and store the obtained component texture maps in the order of acquisition to obtain the texture array of the proxy model. The acquisition order is the same as the sequential encoding.
[0036] Optionally, according to the preset arrangement order of multiple simplified model components, sequentially determine the texture mapping path corresponding to the component code from the corresponding relationship based on the component code of the simplified model component, determine the component texture mapping corresponding to the simplified model component according to the texture mapping path, and store the obtained component texture mappings in the obtained order to obtain the texture array of the proxy model.
[0037] Optionally, determine the index of the texture array according to the acquisition order of each component texture mapping, where the index of the texture array is consistent with the sequence code.
[0038] Step S108, perform texture sampling on the texture array according to the sequence code, and render the proxy model according to the sampling result.
[0039] The execution entity of the above step S108 is the second terminal device. For each model vertex of the proxy model, perform texture sampling on the texture array according to the sequence code included in the vertex data of the model vertex, and render the sampling result to the position of the model vertex.
[0040] Optionally, the first terminal device and the second terminal device may be the same or different, that is to say, the target program and the target game may run on different terminal devices or on the same terminal device.
[0041] The above embodiment provides a model processing method. When the first terminal device is in an offline state, determine the component set of the target game, perform offline preprocessing on the model components included in the component set to obtain simplified model components, determine the texture mapping path of the component texture mapping corresponding to the simplified model component, and generate the corresponding relationship between the component code and the texture mapping path of the simplified model component; where the component code is the unique identifier of the simplified model component; when the second terminal device is running the target game, receive the proxy model corresponding to the game model sent by the server; where the proxy model is obtained by merging multiple simplified model components, and the vertex data of the proxy model includes a sequence code, and the sequence code is the sequence number of the simplified model component in the preset arrangement order, and the preset arrangement order is the arrangement order of multiple simplified model components; determine the texture array of the proxy model according to the component codes and the corresponding relationship of multiple simplified model components; perform texture sampling on the texture array according to the sequence code, and render the proxy model according to the sampling result. In this way, by performing offline preprocessing on the model components offline and generating the proxy model of the game model by the server online, the client does not need to perform model processing and data transmission, and only needs to receive the proxy model and render it, reducing the performance consumption of the client and the server.
[0042] The step of obtaining the simplified model component by performing offline preprocessing on the model components included in the component set may be implemented in a possible way: in an offline state through the first terminal device, for each model component in the component set, perform face reduction processing on the model component to obtain the simplified model component of the model component.
[0043] Optionally, perform face reduction processing on each model component through the target tool in the first terminal device to obtain the simplified model component of the model component, where the target tool may be Polygon Cruncher, Simplygon, UniversalImporter, etc.
[0044] When performing face reduction processing, the target function in the tool will determine the proportion of faces to be reduced according to the number of faces of the model component. If the number of faces of the model component is high, the proportion of face reduction will also be high, ensuring that model components with few faces will not have broken faces due to face reduction processing, and model components with many faces will not retain too many faces after face reduction processing. Usually, the model components processed by face reduction will still retain 20%-30% of the faces.
[0045] Since the server needs to process a large number of real-time modification requests for game buildings and the computing load is too high, in the above method, through offline processing in advance, perform face reduction processing on the model components. When the server processes the simplified model components compared with the original model components, it reduces the real-time computing volume of the server, reduces the computing load of the server, improves the throughput of the server, supports more players to play games online simultaneously, shortens the server response time, and the player experience is smoother.
[0046] The step of determining the texture path of the component texture corresponding to the simplified model component may be implemented in a possible way: in an offline state through the first terminal device, obtain at least one texture corresponding to the simplified model component, perform texture merging and compression processing on the at least one texture to obtain the component texture corresponding to the simplified model component; save the component texture corresponding to the simplified model component to a specified folder, and determine the texture path of the component texture.
[0047] The above at least one texture may be one or more of the following: color texture, normal map, self-illumination map, metallicity, roughness, etc., which are the textures required for standard PBR materials. The above texture merging of the at least one texture may be copying the textures to a preset texture, or may be texture overlay of the at least one texture. The above compression processing may be compressing the texture size, or may be compressing the texture resolution, etc. The above specified folder is usually one or more of the folders corresponding to the target game.
[0048] In the above method, through offline processing, the texture maps corresponding to the model components are merged and compressed without the need for server processing, which further improves the throughput of the server, reduces the amount of data transmitted over the network, and enables a single server to support the generation of more player construction agents.
[0049] For the step of obtaining at least one texture map corresponding to the simplified model component and performing texture map merging and compression processing on the at least one texture map to obtain the component texture map corresponding to the simplified model component, a possible implementation manner is as follows: determining at least one model sub-mesh of the simplified model component and the mesh texture map corresponding to the model sub-mesh; determining the proportion and arrangement order of the model sub-mesh in the simplified model component; copying the mesh texture map to a preset texture map, adjusting the size of the mesh texture map in the preset texture map according to the proportion, and sorting the mesh texture maps according to the arrangement order; and performing compression processing on the preset texture map to obtain the component texture map corresponding to the simplified model component.
[0050] For example, compress the texture map size of the preset texture map to a specified size, and the specified size needs to be set.
[0051] The step of generating the correspondence between the component code and the texture map path of the simplified model component includes: in the offline state of the first terminal device, saving the component texture map corresponding to the simplified model component to a specified folder and generating the texture map path of the component texture map; and generating the correspondence according to the component code of the simplified model component and the texture map path of the component texture map corresponding to the simplified model component.
[0052] The above method further includes: sending the simplified model component and the correspondence to the server through the first terminal device, and sending the component texture map corresponding to the simplified model component and the correspondence to the game package of the target game.
[0053] This method enables the server to generate a lightweight proxy model based on the simplified model component, and only needs to transmit the proxy model, as well as the vertex data, material data, etc. of the vertices of the proxy model to the terminal device, without the need to transmit texture map data (the texture map data has been pre-sent to the game package), reducing the amount of data transmitted. In addition, the server does not need to compress the texture map. After the player's building is modified, the server can generate a new proxy model and transmit it in seconds, reducing latency.
[0054] For the step of determining the texture array of the proxy model according to the component codes and correspondences of multiple simplified model components, a possible implementation manner is as follows:
[0055] Step 1, during the running of the target game by the second terminal device, obtaining a target array from the model material of the proxy model, where the target array includes the component codes of multiple simplified model components, and the component codes of the multiple simplified model components are arranged in a preset arrangement order;
[0056] For example, the multiple simplified model components are: the first simplified model component (component code: aa), the second simplified model component (component code: bb), the third simplified model component (component code: nn), the fourth simplified model component (component code: mm), and the fifth simplified model component (component code: ss); the preset arrangement order is: the second simplified model component, the fourth simplified model component, the fifth simplified model component, the first simplified model component, and the third simplified model component; the component codes included in the target array are: bb (i.e., the component code of the second simplified model component), mm (i.e., the component code of the fourth simplified model component), ss (i.e., the component code of the fifth simplified model component), aa (i.e., the component code of the first simplified model component), and nn (i.e., the component code of the third simplified model component).
[0057] Step 2, for each component code in the target array, determine the texture path corresponding to the component code from the corresponding relationship, and obtain the component texture corresponding to the component code according to the texture path;
[0058] Step 3, upload the component texture to the blank texture array to obtain the texture array of the proxy model, and determine the upload order of the component texture as the texture index of the texture array; where the texture index is the index of the component texture in the texture array, and the texture index corresponds one-to-one with the sequence code.
[0059] Among them, the blank texture array is generated when the target game is started. The blank texture array is a Texture Array. All proxy models in the game share the same texture array.
[0060] The execution entities of the above Step 1, Step 2, and Step 3 are all the second terminal device.
[0061] In the above method, the client uses the proxy model, the target array in the proxy model, and the sequence code to render the proxy model, reducing the load pressure on the terminal device. In addition, the server reduces the amount of transmitted data by sending the proxy model, the target array in the proxy model, and the sequence code.
[0062] After the step of receiving the proxy model corresponding to the game model sent by the server, the above method further includes: through the second terminal device, determining that the received proxy model is the proxy model of the target game model according to the component codes of the multiple simplified model components.
[0063] Specifically, the corresponding model component can be determined according to the component code to further understand the type of the model. If the type is the preset type, it is determined that the proxy model is the proxy model of the target game model. This improves the model rendering efficiency.
[0064] An embodiment of the present disclosure provides another model processing method, which is applied to a server, as Figure 2 shown. The method includes the following steps:
[0065] Step S202: Receive the simplified model components included in the component set of the target game sent by the first terminal device, and the correspondence between the component encoding of the simplified model components and the texture map paths of the component texture maps corresponding to the simplified model components; wherein, the simplified model components are obtained by the first terminal device performing offline preprocessing on the model components in an offline state, the correspondence is generated by the first terminal device in an offline state, and the component encoding is the unique identifier of the simplified model components;
[0066] The specific embodiments of the above steps are the same as the implementation steps of the corresponding embodiments described above, and will not be elaborated here.
[0067] Step S204: During the running of the target game, obtain the game model, and determine the initial proxy model corresponding to the game model according to the topological structure of the game model and multiple simplified model components; wherein, the game model is composed of multiple model components;
[0068] The above game model can be currently built by a virtual character, or currently built by a player, or built by a non-player character.
[0069] Optionally, determine the positional relationship between each original model component according to the topological structure of the game model, and replace each original model component with the corresponding simplified model component to obtain the initial proxy model.
[0070] Optionally, determine the positional relationship between each original model component according to the topological structure of the game model, and replace some of the original model components with the corresponding simplified model components to obtain the initial proxy model.
[0071] Step S206: Determine the sequence encoding according to the preset arrangement order of multiple simplified model components, and write the sequence encoding into the vertex data of the initial proxy model to obtain the proxy model corresponding to the game model;
[0072] According to the preset arrangement order of each simplified model component in the initial proxy model, determine the sequence encoding of each simplified model component, and write the sequence encoding into the vertex data corresponding to the simplified model component.
[0073] Step S208: Send the proxy model to the second terminal device, and the second terminal device determines the texture array of the proxy model according to the component encoding of multiple simplified model components and the correspondence; perform texture sampling on the texture array according to the sequence encoding, and render the proxy model according to the sampling result.
[0074] The above embodiments provide a model processing method, which receives a simplified model component of a model component included in a component set of a target game sent by a first terminal device, and a correspondence relationship between the component encoding of the simplified model component and the texture mapping path of the component texture mapping corresponding to the simplified model component; wherein, the simplified model component is obtained by the first terminal device performing offline preprocessing on the model component in an offline state, the correspondence relationship is generated by the first terminal device in an offline state, and the component encoding is the unique identifier of the simplified model component; during the running of the target game, a game model is obtained, and an initial proxy model corresponding to the game model is determined according to the topological structure of the game model and a plurality of simplified model components; a sequence encoding is determined according to a preset arrangement order of the plurality of simplified model components, and the sequence encoding is written into the vertex data of the initial proxy model to obtain a proxy model corresponding to the game model; the proxy model is sent to a second terminal device, and the second terminal device determines a texture array of the proxy model according to the component encoding and the correspondence relationship of the plurality of simplified model components; texture sampling is performed on the texture array according to the sequence encoding, and the proxy model is rendered according to the sampling result. In this way, by performing offline preprocessing on the model components offline and generating a proxy model of the game model online by the server, the client does not need to perform model processing and data transmission, but only needs to receive the proxy model and render it, reducing the performance consumption of the client and the server.
[0075] The above step of determining the initial proxy model corresponding to the game model according to the topological structure of the game model and a plurality of simplified model components, a possible implementation manner:
[0076] Determine the topological structure of the game model, and according to the topological structure, determine a plurality of original model components that make up the game model and the spatial relationship structure between the plurality of original model components; obtain the simplified model components corresponding to the original model components to obtain a plurality of simplified model components; build the plurality of simplified model components according to the spatial relationship structure to obtain a first proxy model of the game model; perform a merging process on the plurality of simplified model components to obtain the initial proxy model corresponding to the game model.
[0077] By performing a merging process on the plurality of simplified model components, the number of faces of the model is reduced, so that the drawing calls of the client are reduced, and thus the performance consumption of the client is reduced.
[0078] After the step of performing a merging process on the plurality of simplified model components to obtain the initial proxy model corresponding to the game model, the above method further includes: performing a face reduction process on the first proxy model.
[0079] Performing a face reduction process on the first proxy model further reduces the number of faces of the model and further reduces the performance consumption of the client.
[0080] After performing decimation on the first proxy model, the above method further includes: changing the data storage format of the vertex data of the model vertices from a first data storage format to a second data storage format, where the floating-point precision of the first data storage format is greater than that of the second data storage format.
[0081] The above first data storage format is float, and the second data storage format is half, reducing the floating-point precision and thus reducing the disk occupancy of the model file.
[0082] For the above step of determining the sequence code according to the preset arrangement order of multiple simplified model components, a possible implementation: arranging the multiple simplified model components in the preset arrangement order to obtain the sequence numbers of the simplified model components; determining the sequence numbers as the sequence code.
[0083] For example, the multiple simplified model components are: the first simplified model component, the second simplified model component,, the third simplified model component,, the fourth simplified model component, the fifth simplified model component; the preset arrangement order is: the second simplified model component, the fourth simplified model component, the fifth simplified model component, the first simplified model component, the third simplified model component; the sequence code is 001, 002, 003, 004, 005, the sequence code of the first simplified model component is 004, the sequence code of the second simplified model component is 001, the sequence code of the third simplified model component is 005, the sequence code of the fourth simplified model component is 002, and the sequence code of the fifth simplified model component is 003.
[0084] The above method further includes: arranging the component codes of the multiple simplified model components in the preset arrangement order of the multiple simplified model components, and determining the arrangement result as the target array; writing the target array into the model material of the proxy model.
[0085] For example, the multiple simplified model components are: the first simplified model component (component code is aa), the second simplified model component (component code is bb), the third simplified model component (component code is nn), the fourth simplified model component (component code is mm), the fifth simplified model component (component code is ss); the preset arrangement order is: the second simplified model component, the fourth simplified model component, the fifth simplified model component, the first simplified model component, the third simplified model component; the component codes included in the target array are: bb (i.e., the component code of the second simplified model component), mm (i.e., the component code of the fourth simplified model component), ss (i.e., the component code of the fifth simplified model component), aa (i.e., the component code of the first simplified model component), nn (i.e., the component code of the third simplified model component).
[0086] In the above method, through three main steps of offline preprocessing, online dynamic processing, and client rendering optimization, the performance bottleneck problem caused by complex game models is solved. Through the two-level decimation mechanism, component encoding, sequential encoding in vertex data, and dynamic texture array technology of the server, the game performance is significantly improved, large-scale dynamic model modification is supported, and a smoother and more free game experience is provided for players.
[0087] Corresponding to the above method embodiments, the embodiments of the present disclosure provide a model processing device, which is arranged in a terminal device, such as Figure 3 As shown, the device includes:
[0088] A first determination module 301, configured to determine a component set of a target game in an offline state through a first terminal device, obtain simplified model components by performing offline processing on the model components included in the component set, determine the texture map path of the component texture map corresponding to the simplified model components, and generate a correspondence between the component encoding of the simplified model components and the texture map path; wherein, the component encoding is the unique identifier of the simplified model components;
[0089] A model receiving module 302, configured to receive a proxy model corresponding to a game model sent by a server during the operation of the target game through a second terminal device; wherein, the game model is composed of multiple model components, the proxy model is obtained by merging multiple simplified model components, and the vertex data of the proxy model includes sequential encoding, and the sequential encoding is the sequence number of the simplified model components in a preset arrangement order, and the preset arrangement order is the arrangement order of multiple simplified model components;
[0090] A second determination module 303, configured to determine the texture array of the proxy model according to the component encoding of multiple simplified model components and the correspondence;
[0091] A model rendering module 304, configured to perform texture sampling on the texture array according to the sequential encoding, and render the proxy model according to the sampling result.
[0092] This embodiment provides a model processing device. When the first terminal device is in an offline state, it determines a component set of a target game, performs offline preprocessing on the model components included in the component set to obtain simplified model components, determines the texture map paths of the component texture maps corresponding to the simplified model components, and generates a correspondence between the component codes of the simplified model components and the texture map paths; wherein, the component code is the unique identifier of the simplified model component. When the target game is running, the second terminal device receives a proxy model corresponding to the game model sent by the server; wherein, the proxy model is obtained by merging multiple simplified model components, and the vertex data of the proxy model includes sequential codes, and the sequential code is the sequence number of the simplified model component in a preset arrangement order, and the preset arrangement order is the arrangement order of multiple simplified model components. According to the component codes of multiple simplified model components and the correspondence, the texture array of the proxy model is determined. Texture sampling is performed on the texture array according to the sequential code, and the proxy model is rendered according to the sampling result. In this way, by performing offline preprocessing on the model components offline and generating a proxy model of the game model by the server online, the client does not need to perform model processing and data transmission, but only needs to receive the proxy model and render it, reducing the performance consumption of the client and the server.
[0093] The above-mentioned first determination module is further configured to: when the first terminal device is in an offline state, for each model component in the component set, perform face reduction processing on the model component to obtain the simplified model component of the model component.
[0094] The above-mentioned first determination module is further configured to: when the first terminal device is in an offline state, obtain at least one texture map corresponding to the simplified model component, perform texture map merging and compression processing on the at least one texture map to obtain the component texture map corresponding to the simplified model component; save the component texture map corresponding to the simplified model component to a specified folder, and determine the texture map path of the component texture map.
[0095] The above-mentioned first determination module is further configured to: determine at least one model sub-mesh of the simplified model component and the mesh texture map corresponding to the model sub-mesh; determine the proportion and arrangement order of the model sub-mesh in the simplified model component; copy the mesh texture map to a preset texture map, adjust the size of the mesh texture map in the preset texture map according to the proportion, and sort the mesh texture maps according to the arrangement order; perform compression processing on the preset texture map to obtain the component texture map corresponding to the simplified model component.
[0096] The above-mentioned first determination module is further configured to: when the first terminal device is in an offline state, save the component texture map corresponding to the simplified model component to a specified folder and generate the texture map path of the component texture map; generate a correspondence according to the component code of the simplified model component and the texture map path of the component texture map corresponding to the simplified model component.
[0097] The above-mentioned second determination module is further configured to: during the operation of the target game by the second terminal device, obtain a target array from the model materials of the proxy model, where the target array includes the component codes of multiple simplified model components, and the component codes of the multiple simplified model components are arranged in a preset arrangement order; for each component code in the target array, determine the texture path corresponding to the component code from the correspondence relationship, and obtain the component texture corresponding to the component code according to the texture path; upload the component texture to the blank texture array to obtain the texture array of the proxy model, and determine the upload order of the component texture as the texture index of the texture array; where the texture index is the index of the component texture in the texture array, and the texture index corresponds one-to-one with the sequence code.
[0098] The above-mentioned device further includes a data sending module, configured to: send the simplified model components and the correspondence relationship to the server through the first terminal device, and send the component textures corresponding to the simplified model components and the correspondence relationship to the game package of the target game.
[0099] The above-mentioned device further includes a verification module, configured to: determine that the received proxy model is the proxy model of the target game model according to the component codes of multiple simplified model components through the second terminal device.
[0100] The model processing device provided by the embodiments of the present disclosure has the same technical features as the model processing method provided by the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.
[0101] Corresponding to the above method embodiment, the embodiments of the present disclosure provide a model processing device, which is set in the server, as Figure 4 shown, the device includes:
[0102] A first receiving module 401, configured to receive the simplified model components of the model components included in the component set of the target game sent by the first terminal device, and the correspondence relationship between the component codes of the simplified model components and the texture paths of the component textures corresponding to the simplified model components; where the simplified model components are obtained by the first terminal device through offline processing of the model components, the correspondence relationship is generated by the first terminal device in the offline state, and the component code is the unique identifier of the simplified model component;
[0103] A third determination module 402, configured to obtain a game model during the operation of the target game, and determine an initial proxy model corresponding to the game model according to the topological structure of the game model and multiple simplified model components; where the game model is composed of multiple model components;
[0104] The fourth determination module 403 is configured to determine an order code according to a preset arrangement order of a plurality of simplified model components, and write the order code into the vertex data of the initial proxy model to obtain a proxy model corresponding to the game model;
[0105] The model sending module 404 is configured to send the proxy model to the second terminal device. The second terminal device determines a texture array of the proxy model according to the component codes and corresponding relationships of the plurality of simplified model components; performs texture sampling on the texture array according to the order code, and renders the proxy model according to the sampling result.
[0106] This embodiment provides a model processing device, which receives the simplified model components of the model components included in the component set of the target game sent by the first terminal device, and the corresponding relationship between the component codes of the simplified model components and the texture map paths of the component texture maps corresponding to the simplified model components; wherein, the simplified model components are obtained by the first terminal device performing offline preprocessing on the model components in an offline state, the corresponding relationship is generated by the first terminal device in an offline state, and the component code is the unique identifier of the simplified model component; during the operation of the target game, obtain the game model, determine the initial proxy model corresponding to the game model according to the topological structure of the game model and a plurality of simplified model components; determine an order code according to the preset arrangement order of the plurality of simplified model components, and write the order code into the vertex data of the initial proxy model to obtain a proxy model corresponding to the game model; send the proxy model to the second terminal device, and the second terminal device determines a texture array of the proxy model according to the component codes and corresponding relationships of the plurality of simplified model components; performs texture sampling on the texture array according to the order code, and renders the proxy model according to the sampling result. In this way, by performing offline preprocessing on the model components offline and generating a proxy model of the game model by the server online, the client does not need to perform model processing and data transmission, and only needs to receive the proxy model and render it, reducing the performance consumption of the client and the server.
[0107] The above-mentioned third determination module is further configured to: determine the topological structure of the game model, and according to the topological structure, determine a plurality of original model components that make up the game model and the spatial relationship structure between the plurality of original model components; obtain the simplified model components corresponding to the original model components to obtain a plurality of simplified model components; build the plurality of simplified model components according to the spatial relationship structure to obtain a first proxy model of the game model; perform a merging process on the plurality of simplified model components to obtain an initial proxy model corresponding to the game model.
[0108] The above-mentioned device further includes a face reduction module, which is configured to: perform a face reduction process on the first proxy model.
[0109] The above device further includes a storage format change module: changing the data storage format of the vertex data of the model vertices from a first data storage format to a second data storage format, where the floating-point precision of the first data storage format is greater than that of the second data storage format.
[0110] The above fourth determination module is further configured to: arrange a plurality of simplified model components in a preset arrangement order to obtain a sequence number of the simplified model components; and determine the sequence number as a sequence code.
[0111] The above device further includes a target array determination module, configured to: arrange the component codes of a plurality of simplified model components in a preset arrangement order of the plurality of simplified model components, and determine the arrangement result as a target array; and write the target array into the model material of the proxy model.
[0112] The model processing device provided by the embodiments of the present disclosure has the same technical features as the model processing method provided by the above embodiments, so it can also solve the same technical problems and achieve the same technical effects.
[0113] This embodiment further provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above model processing method. The electronic device can be a server or a terminal device.
[0114] See Figure 5 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100, and the processor 100 executes the machine-executable instructions to implement the above model processing method.
[0115] Further, Figure 5 the electronic device shown further includes a bus 102 and a communication interface 103. The processor 100, the communication interface 103, and the memory 101 are connected through the bus 102.
[0116] Among them, the memory 101 may include high-speed random access memory (RAM), and may also include non-volatile memory, such as at least one disk memory. The communication connection between this 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, wide area network, local area network, metropolitan area network, etc. can be used. The bus 102 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 only a bidirectional arrow is used in Figure 5 , but it does not mean that there is only one bus or one type of bus.
[0117] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor 100 or the instructions in the form of software. The above-mentioned processor 100 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present disclosure can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, register, etc. This storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and combines its hardware to complete the steps of the method in the foregoing embodiments.
[0118] The processor in the above-mentioned electronic device can implement the following operations in the above-mentioned model processing method by executing machine-executable instructions:
[0119] The processor is disposed in the terminal device
[0120] In the offline state of the first terminal device, determine the component set of the target game, perform offline preprocessing on the model components included in the component set to obtain simplified model components, determine the texture map path of the component texture map corresponding to the simplified model components, and generate a correspondence between the component codes and texture map paths of the simplified model components; wherein, the component code is the unique identifier of the simplified model component; during the operation of the target game by the second terminal device, receive the proxy model corresponding to the game model sent by the server; wherein, the game model is composed of multiple model components, the proxy model is obtained by merging multiple simplified model components, and the vertex data of the proxy model includes sequential codes, and the sequential code is the sequence number of the simplified model component in the preset arrangement order, and the preset arrangement order is the arrangement order of multiple simplified model components; according to the component codes and correspondence of multiple simplified model components, determine the texture array of the proxy model; perform texture sampling on the texture array according to the sequential code, and render the proxy model according to the sampling result. In this method, by performing offline preprocessing on the model components offline and generating the proxy model of the game model by the server online, the client does not need to perform model processing and data transmission, but only needs to receive the proxy model and render it, reducing the performance consumption of the client and the server.
[0121] The step of performing offline preprocessing on the model components included in the component set to obtain simplified model components includes: in the offline state of the first terminal device, for each model component in the component set, perform face reduction processing on the model component to obtain the simplified model component of the model component.
[0122] The step of determining the texture map path of the component texture map corresponding to the simplified model component includes: in the offline state of the first terminal device, obtain at least one texture map corresponding to the simplified model component, perform texture map merging and compression processing on the at least one texture map to obtain the component texture map corresponding to the simplified model component; save the component texture map corresponding to the simplified model component to a specified folder, and determine the texture map path of the component texture map.
[0123] The steps of obtaining at least one texture map corresponding to the simplified model component, performing texture map merging and compression processing on the at least one texture map, and obtaining the component texture map corresponding to the simplified model component include: determining at least one model sub-mesh of the simplified model component and the mesh texture map corresponding to the model sub-mesh; determining the proportion and arrangement order of the model sub-mesh in the simplified model component; copying the mesh texture map to a preset texture map, adjusting the size of the mesh texture map in the preset texture map according to the proportion, and sorting the mesh texture maps according to the arrangement order; and performing compression processing on the preset texture map to obtain the component texture map corresponding to the simplified model component.
[0124] The steps of generating the correspondence between the component code and the texture map path of the simplified model component include: in the offline state by the first terminal device, saving the component texture map corresponding to the simplified model component to a specified folder and generating the texture map path of the component texture map; and generating the correspondence according to the component code of the simplified model component and the texture map path of the component texture map corresponding to the simplified model component.
[0125] The steps of determining the texture array of the proxy model according to the component codes and the correspondence of multiple simplified model components include: during the running of the target game by the second terminal device, obtaining a target array from the model material of the proxy model, where the target array includes the component codes of multiple simplified model components, and the component codes of the multiple simplified model components are arranged in a preset arrangement order; for each component code in the target array, determining the texture map path corresponding to the component code from the correspondence, and obtaining the component texture map corresponding to the component code according to the texture map path; uploading the component texture map to an empty texture array to obtain the texture array of the proxy model, and determining the uploading order of the component texture map as the texture index of the texture array; where the texture index is the index of the component texture map in the texture array, and the texture index corresponds one-to-one with the sequence code.
[0126] The above method further includes: sending the simplified model component and the correspondence to the server by the first terminal device, and sending the component texture map corresponding to the simplified model component and the correspondence to the game package of the target game.
[0127] After the step of receiving the proxy model corresponding to the game model sent by the server, the method further includes: determining by the second terminal device that the received proxy model is the proxy model of the target game model according to the component codes of multiple simplified model components.
[0128] The processor is disposed in the server
[0129] Receive the simplified model components of the model components included in the component set of the target game sent by the first terminal device, as well as the correspondence between the component encoding of the simplified model components and the texture map path of the component texture map corresponding to the simplified model components; wherein, the simplified model components are obtained by the first terminal device performing offline preprocessing on the model components in the offline state, the correspondence is generated by the first terminal device in the offline state, and the component encoding is the unique identifier of the simplified model components; during the running of the target game, obtain the game model, and determine the initial proxy model corresponding to the game model according to the topological structure of the game model and multiple simplified model components; wherein, the game model is composed of multiple model components; determine the sequence encoding according to the preset arrangement order of the multiple simplified model components, and write the sequence encoding into the vertex data of the initial proxy model to obtain the proxy model corresponding to the game model; send the proxy model to the second terminal device, and determine the texture array of the proxy model by the second terminal device according to the component encoding and the correspondence of the multiple simplified model components; perform texture sampling on the texture array according to the sequence encoding, and render the proxy model according to the sampling result. In this method, by performing offline preprocessing on the model components offline and generating the proxy model of the game model online through the server, the client does not need to perform model processing and data transmission, and only needs to receive the proxy model and render it, reducing the performance consumption of the client and the server.
[0130] The above step of determining the initial proxy model corresponding to the game model according to the topological structure of the game model and multiple simplified model components includes: determining the topological structure of the game model, and according to the topological structure, determining multiple original model components that make up the game model and the spatial relationship structure between the multiple original model components; obtaining the simplified model components corresponding to the original model components to obtain multiple simplified model components; building the multiple simplified model components according to the spatial relationship structure to obtain the first proxy model of the game model; performing a merging process on the multiple simplified model components to obtain the initial proxy model corresponding to the game model.
[0131] After the above step of performing a merging process on the multiple simplified model components to obtain the initial proxy model corresponding to the game model, the method further includes: performing a decimation process on the first proxy model.
[0132] After the above step of performing a decimation process on the first proxy model, the method further includes: changing the data storage format of the vertex data of the model vertices from the first data storage format to the second data storage format, wherein the floating-point precision of the first data storage format is greater than the floating-point precision of the second data storage format.
[0133] The above step of determining the sequence encoding according to the preset arrangement order of the multiple simplified model components includes: arranging the multiple simplified model components in the preset arrangement order to obtain the sequence numbers of the simplified model components; determining the sequence numbers as the sequence encoding.
[0134] The above method further includes: arranging the component encodings of multiple simplified model components in a preset arrangement order of the multiple simplified model components, and determining the arrangement result as a target array; writing the target array into the model material of the proxy model.
[0135] This embodiment also provides a machine-readable storage medium storing machine-executable instructions, which, when called and executed by a processor, cause the processor to implement the above model processing method.
[0136] The machine-executable instructions stored in the above machine-readable storage medium can, by executing the machine-executable instructions, implement the following operations in the above model processing method:
[0137] The processor is disposed in the terminal device
[0138] In the offline state of the first terminal device, determine the component set of the target game, perform offline preprocessing on the model components included in the component set to obtain simplified model components, determine the texture path of the component texture corresponding to the simplified model components, and generate the correspondence between the component encoding and the texture path of the simplified model components; wherein, the component encoding is the unique identifier of the simplified model component; during the running of the target game by the second terminal device, receive the proxy model corresponding to the game model sent by the server; wherein, the game model is composed of multiple model components, the proxy model is obtained by merging multiple simplified model components, and the vertex data of the proxy model includes a sequential encoding, and the sequential encoding is the sequence number of the simplified model component in the preset arrangement order, and the preset arrangement order is the arrangement order of the multiple simplified model components; determine the texture array of the proxy model according to the component encodings and the correspondence of the multiple simplified model components; perform texture sampling on the texture array according to the sequential encoding, and render the proxy model according to the sampling result. In this way, by performing offline preprocessing on the model components offline and generating the proxy model of the game model by the server online, the client does not need to perform model processing and data transmission, and only needs to receive the proxy model and render it, reducing the performance consumption of the client and the server.
[0139] The step of performing offline preprocessing on the model components included in the component set to obtain simplified model components includes: in the offline state of the first terminal device, for each model component in the component set, perform face reduction processing on the model component to obtain the simplified model component of the model component.
[0140] The steps of determining the texture path of the component texture corresponding to the simplified model component include: obtaining at least one texture corresponding to the simplified model component in the offline state by the first terminal device, performing texture merging and compression processing on the at least one texture to obtain the component texture corresponding to the simplified model component; saving the component texture corresponding to the simplified model component to a specified folder, and determining the texture path of the component texture.
[0141] The steps of obtaining at least one texture corresponding to the simplified model component, performing texture merging and compression processing on the at least one texture to obtain the component texture corresponding to the simplified model component include: determining at least one model sub-mesh of the simplified model component and the mesh texture corresponding to the model sub-mesh; determining the proportion and arrangement order of the model sub-mesh in the simplified model component; copying the mesh texture to a preset texture, adjusting the size of the mesh texture in the preset texture according to the proportion, and sorting the mesh texture according to the arrangement order; performing compression processing on the preset texture to obtain the component texture corresponding to the simplified model component.
[0142] The steps of generating the correspondence between the component code and the texture path of the simplified model component include: saving the component texture corresponding to the simplified model component to a specified folder in the offline state by the first terminal device, and generating the texture path of the component texture; generating the correspondence according to the component code of the simplified model component and the texture path of the component texture corresponding to the simplified model component.
[0143] The steps of determining the texture array of the proxy model according to the component codes and the correspondence of multiple simplified model components include: obtaining a target array from the model material of the proxy model during the operation of the target game by the second terminal device, where the target array includes the component codes of multiple simplified model components, and the component codes of the multiple simplified model components are arranged in a preset arrangement order; for each component code in the target array, determining the texture path corresponding to the component code from the correspondence, and obtaining the component texture corresponding to the component code according to the texture path; uploading the component texture to a blank texture array to obtain the texture array of the proxy model, and determining the upload order of the component texture as the texture index of the texture array; where the texture index is the index of the component texture in the texture array, and the texture index corresponds one-to-one with the sequence code.
[0144] The above method further includes: sending the simplified model component and the correspondence to the server by the first terminal device, and sending the component texture corresponding to the simplified model component and the correspondence to the game package of the target game.
[0145] After the step of receiving the proxy model corresponding to the game model sent by the receiving server, the method further includes: through the second terminal device, determining that the received proxy model is the proxy model of the target game model according to the component codes of multiple simplified model components.
[0146] The processor is arranged in the server
[0147] Receiving the simplified model components of the model components included in the component set of the target game sent by the first terminal device, and the correspondence between the component codes of the simplified model components and the texture mapping paths of the component texture maps corresponding to the simplified model components; wherein, the simplified model components are obtained by the first terminal device performing offline preprocessing on the model components in the offline state, the correspondence is generated by the first terminal device in the offline state, and the component code is the unique identifier of the simplified model component; during the operation of the target game, obtaining the game model, and determining the initial proxy model corresponding to the game model according to the topological structure of the game model and multiple simplified model components; wherein, the game model is composed of multiple model components; determining the sequence code according to the preset arrangement order of the multiple simplified model components, and writing the sequence code into the vertex data of the initial proxy model to obtain the proxy model corresponding to the game model; sending the proxy model to the second terminal device, and determining the texture array of the proxy model through the second terminal device according to the component codes and the correspondence of the multiple simplified model components; performing texture sampling on the texture array according to the sequence code, and rendering the proxy model according to the sampling result. In this way, by performing offline preprocessing on the model components offline and generating the proxy model of the game model through the server online, the client does not need to perform model processing and data transmission, and only needs to receive the proxy model and render it, reducing the performance consumption of the client and the server.
[0148] The step of determining the initial proxy model corresponding to the game model according to the topological structure of the game model and multiple simplified model components includes: determining the topological structure of the game model, and according to the topological structure, determining multiple original model components that make up the game model and the spatial relationship structure between the multiple original model components; obtaining the simplified model components corresponding to the original model components to obtain multiple simplified model components; building the multiple simplified model components according to the spatial relationship structure to obtain the first proxy model of the game model; and merging the multiple simplified model components to obtain the initial proxy model corresponding to the game model.
[0149] After the step of merging the multiple simplified model components to obtain the initial proxy model corresponding to the game model, the method further includes: performing face reduction processing on the first proxy model.
[0150] After performing decimation on the first proxy model, the method further includes: changing the data storage format of the vertex data of the model vertices from a first data storage format to a second data storage format, where the floating-point precision of the first data storage format is greater than that of the second data storage format.
[0151] The step of determining the sequence code according to the preset arrangement order of multiple simplified model components includes: arranging the multiple simplified model components in the preset arrangement order to obtain the sequence numbers of the simplified model components; and determining the sequence numbers as the sequence code.
[0152] The method further includes: arranging the component codes of the multiple simplified model components in the preset arrangement order of the multiple simplified model components, and determining the arrangement result as the target array; and writing the target array into the model material of the proxy model.
[0153] The computer program product of the model processing method, device, electronic device, and system provided by the embodiments of the present disclosure includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the methods described in the foregoing method embodiments. For specific implementation, reference can be made to the method embodiments, and details are not described herein again.
[0154] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the foregoing method embodiments, and details are not described herein again.
[0155] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "install", "connect", and "couple" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific situations.
[0156] When the above-mentioned functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs.
[0157] In the description of the present disclosure, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present disclosure. In addition, the terms "first", "second", "third" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.
[0158] Finally, it should be noted that the above embodiments are only specific implementation manners of the present disclosure, used to illustrate the technical solutions of the present disclosure, rather than limiting them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art within the technical scope disclosed by the present disclosure can still modify the technical solutions recorded in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes, or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.
Claims
1. A model processing method, characterized in that, The method is applied to a terminal device, and the method includes: In an offline state, a first terminal device determines a set of components of a target game, performs offline preprocessing on the model components included in the set of components to obtain simplified model components, determines the texture map path of the component texture map corresponding to the simplified model components, and generates a correspondence between the component code of the simplified model components and the texture map path; wherein, the component code is the unique identifier of the simplified model components; During the running of the target game, a second terminal device receives a proxy model corresponding to a game model sent by a server; wherein, the game model is composed of multiple model components, the proxy model is obtained by merging multiple simplified model components, the vertex data of the proxy model includes a sequence code, and the sequence code is the sequence number of the simplified model components in a preset arrangement order, and the preset arrangement order is the arrangement order of the multiple simplified model components; According to the component codes of the multiple simplified model components and the correspondence, determine the texture array of the proxy model; Perform texture sampling on the texture array according to the sequence code, and render the proxy model according to the sampling result.
2. The method according to claim 1, characterized in that The step of performing offline preprocessing on the model components included in the set of components to obtain simplified model components includes: In an offline state, the first terminal device performs face reduction processing on each model component in the set of components to obtain the simplified model components of the model components.
3. The method according to claim 1, wherein The step of determining the texture map path of the component texture map corresponding to the simplified model components includes: In an offline state, the first terminal device obtains at least one texture map corresponding to the simplified model components, performs texture map merging and compression processing on the at least one texture map to obtain the component texture map corresponding to the simplified model components; Save the component texture map corresponding to the simplified model components to a specified folder, and determine the texture map path of the component texture map.
4. The method according to claim 3, wherein The step of obtaining at least one texture map corresponding to the simplified model components and performing texture map merging and compression processing on the at least one texture map to obtain the component texture map corresponding to the simplified model components includes: Determine at least one model sub-mesh of the simplified model components and the mesh texture map corresponding to the model sub-mesh; Determine the proportion and arrangement order of the model sub-mesh in the simplified model components; Copy the mesh texture map to a preset texture map, adjust the size of the mesh texture map in the preset texture map according to the proportion, and sort the mesh texture map according to the arrangement order; Perform compression processing on the preset texture map to obtain the component texture map corresponding to the simplified model components.
5. The method according to claim 1, characterized in that, The step of generating a correspondence between the component code of the simplified model components and the texture map path includes: In an offline state, the first terminal device saves the component texture map corresponding to the simplified model components to a specified folder and generates the texture map path of the component texture map; Generate the correspondence according to the component code of the simplified model components and the texture map path of the component texture map corresponding to the simplified model components.
6. The method according to claim 1, characterized in that, The steps of determining the texture array of the proxy model according to the component encoding of the multiple simplified model components and the corresponding relationship include: During the running of the target game by the second terminal device, obtain a target array from the model materials of the proxy model, where the target array includes the component encodings of the multiple simplified model components, and the component encodings of the multiple simplified model components are arranged according to the preset arrangement order; For each component encoding in the target array, determine the texture map path corresponding to the component encoding from the corresponding relationship, and obtain the component texture map corresponding to the component encoding according to the texture map path; Upload the component texture maps to a blank texture array to obtain the texture array of the proxy model, and determine the upload order of the component texture maps as the texture index of the texture array; where the texture index is the index of the component texture map in the texture array, and the texture index corresponds one-to-one with the sequence encoding.
7. The method according to claim 1, wherein The method further includes: Send the simplified model components and the corresponding relationship to the server through the first terminal device, and send the component texture maps corresponding to the simplified model components and the corresponding relationship to the game package of the target game.
8. The method according to claim 1, characterized in that, After the step of receiving the proxy model corresponding to the game model sent by the server, the method further includes: Determine that the received proxy model is the proxy model of the target game model according to the component encodings of the multiple simplified model components through the second terminal device.
9. A model processing method, characterized in that When the method is applied to a server, the method includes: Receive the simplified model components included in the component set of the target game sent by the first terminal device, and the corresponding relationship between the component encoding of the simplified model component and the texture map path of the component texture map corresponding to the simplified model component; where the simplified model component is obtained by the first terminal device performing offline preprocessing on the model component in an offline state, the corresponding relationship is generated by the first terminal device in an offline state, and the component encoding is the unique identifier of the simplified model component; During the running of the target game, obtain a game model, and determine an initial proxy model corresponding to the game model according to the topological structure of the game model and multiple simplified model components; where the game model is composed of multiple model components; Determine a sequence encoding according to the preset arrangement order of the multiple simplified model components, and write the sequence encoding into the vertex data of the initial proxy model to obtain the proxy model corresponding to the game model; Send the proxy model to the second terminal device, and through the second terminal device, determine the texture array of the proxy model according to the component encoding of the multiple simplified model components and the corresponding relationship; perform texture sampling on the texture array according to the sequence encoding, and render the proxy model according to the sampling result.
10. The method according to claim 9, wherein The steps of determining the initial proxy model corresponding to the game model according to the topological structure of the game model and multiple simplified model components include: Determine the topological structure of the game model. According to the topological structure, determine multiple original model components that make up the game model and the spatial relationship structure between the multiple original model components; Obtain the simplified model components corresponding to the original model components to obtain multiple simplified model components; Build the multiple simplified model components according to the spatial relationship structure to obtain the first proxy model of the game model; Perform a merging process on the multiple simplified model components to obtain the initial proxy model corresponding to the game model.
11. The method according to claim 10, characterized in that, After the step of performing a merging process on the multiple simplified model components to obtain the initial proxy model corresponding to the game model, the method further includes: performing a decimation process on the first proxy model.
12. The method according to claim 11, wherein After performing the decimation process on the first proxy model, the method further includes: Change the data storage format of the vertex data of the model vertices from the first data storage format to the second data storage format, where the floating-point precision of the first data storage format is greater than the floating-point precision of the second data storage format.
13. The method according to claim 9, wherein The step of determining the sequential encoding according to the preset arrangement order of the multiple simplified model components includes: Arrange the multiple simplified model components in the preset arrangement order to obtain the sequence numbers of the simplified model components; Determine the sequence numbers as the sequential encoding.
14. The method according to claim 9, wherein The method further includes: Arrange the component encodings of the multiple simplified model components in the preset arrangement order of the multiple simplified model components, and determine the arrangement result as the target array; Write the target array into the model material of the proxy model.
15. A model processing device, characterized in that, The device is set in a terminal device, and the device includes: A first determination module, configured to determine a component set of a target game in an offline state through a first terminal device, perform offline preprocessing on the model components included in the component set to obtain simplified model components, determine the texture map path of the component texture map corresponding to the simplified model components, and generate a correspondence between the component encoding of the simplified model components and the texture map path; where the component encoding is the unique identifier of the simplified model component; A model receiving module, configured to receive, during the running of the target game through a second terminal device, a proxy model corresponding to the game model sent by a server; where the proxy model is obtained by merging multiple simplified model components, and the vertex data of the proxy model includes a sequential encoding, and the sequential encoding is the sequence number of the simplified model component in the preset arrangement order, and the preset arrangement order is the arrangement order of the multiple simplified model components; A second determination module, configured to determine the texture array of the proxy model according to the component encoding of the multiple simplified model components and the correspondence; A model rendering module, configured to perform texture sampling on the texture array according to the sequential encoding, and render the proxy model according to the sampling result.
16. A model processing device, characterized in that, The device is set in a server, and the device includes: A first receiving module, configured to receive a simplified model component of a model component included in a component set of a target game sent by a first terminal device, and a correspondence relationship between a component code of the simplified model component and a texture map path of a component texture map corresponding to the simplified model component; wherein, the simplified model component is obtained by the first terminal device performing offline preprocessing on the model component in an offline state, the correspondence relationship is generated by the first terminal device in an offline state, and the component code is a unique identifier of the simplified model component; A third determining module, configured to, during the running of the target game, obtain a game model, and determine an initial proxy model corresponding to the game model according to a topological structure of the game model and a plurality of simplified model components; A fourth determining module, configured to determine a sequence code according to a preset arrangement order of the plurality of simplified model components, and write the sequence code into vertex data of the initial proxy model to obtain a proxy model corresponding to the game model; A model sending module, configured to send the proxy model to the terminal device, and enable the terminal device to determine a texture array of the proxy model according to the component codes of the plurality of simplified model components and the correspondence relationship; perform texture sampling on the texture array according to the sequence code, and render the proxy model according to a sampling result.
17. An electronic device, characterized in that, Comprising a processor and a memory, the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the model processing method according to any one of claims 1-8, or implement the model processing method according to any one of claims 9-14.
18. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer executable instructions, and when the computer executable instructions are called and executed by a processor, the computer executable instructions cause the processor to implement the model processing method according to any one of claims 1-8, or implement the model processing method according to any one of claims 9-14.