Model resource rendering method, device and equipment
By establishing parameter mapping information and dynamically adjusting the accuracy type, the lack of gameplay caused by model rendering in the existing technology is solved, efficient rendering and smooth switching of model resources in the game is achieved, and game performance is improved.
Patent Information
- Application Number
- CN202411913986.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-04
AI Technical Summary
In the prior art, model rendering is completely reliant on GPU. When there are many types of models, it is necessary to write a separate shader for the model, which causes a lot of work burden and is difficult to complete certain highly interactive gameplay in the game, affecting the performance of the game.
By establishing parameter mapping information of model resources, model data is constructed according to different precision types, and the accuracy type is dynamically adjusted between different resource processors. Taking advantage of the advantages of central processors and graphics processors, the switching and balance of model resources between different precision types is achieved.
Effectively balance the performance pressure between different resource processors, realize fast and smooth switching of model resources between different resource processors, and improve game performance.
Smart Images

Figure CN119746396A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of rendering technology, and in particular to a rendering method, device and equipment for model resources. Background Art
[0002] With the popularization of mobile Internet, players' gaming devices are no longer limited to PCs or consoles. Mobile devices such as smartphones and tablets have become the main gaming platforms, greatly promoting the development of computer games on mobile platforms. When computer games are ported to mobile platforms, due to the stricter restrictions on CPU and other resource data on mobile platforms, the number of models in large multiplayer scenes has increased and the actions have become more diverse, resulting in a significant increase in CPU overhead, until performance bottlenecks occur.
[0003] In order to reduce the CPU burden caused by model actions in large multiplayer scenes, relevant technologies can implement the rendering process of model resources through animation compression, LOD, instanced rendering, multi-threaded animation processing, etc. Among them, instanced rendering, as a more commonly used rendering method, mainly passes the animation data to the GPU for processing, for example, by sampling animation maps or directly modifying vertex data in fixed-point shaders to simulate animation effects. Although relying entirely on the GPU for rendering can better simulate the appearance and actions of characters, this method requires writing shaders separately for models when there are many types of models, which causes a lot of workload and makes it difficult to complete certain highly interactive gameplay in the game, resulting in a lack of gameplay in the game and affecting the performance of the game. Summary of the invention
[0004] In view of this, the present application provides a rendering method and device for model resources, the main purpose of which is to solve the problem in the prior art that it is difficult to complete certain highly interactive gameplay in the game by relying entirely on GPU processing, resulting in missing gameplay in the game and affecting the game performance.
[0005] According to a first aspect of the present application, a method for rendering a model resource is provided, comprising:
[0006] In response to a loading instruction of a model resource, parameter mapping information of the model resource is established, wherein the parameter mapping information records the type of precision allocated to the model resource in the game scene;
[0007] constructing model data of different precision types according to the parameter mapping information, so as to render the model data of corresponding precision types through different resource processors;
[0008] When there is a performance imbalance between different resource processors, the parameter mapping information of the model resource is updated to control the model resource to switch the precision type through the updated parameter mapping information.
[0009] Furthermore, the step of establishing parameter mapping information of the model resource in response to the loading instruction of the model resource includes:
[0010] In response to a model resource loading instruction, obtaining parameter restriction information for model loading, wherein the parameter restriction information at least includes a quantity restriction of model resources of different precision types in a game scene;
[0011] Allocate a type parameter for the model resource according to the parameter restriction information, the type parameter being the precision type of the model resource loaded in the game scene;
[0012] According to the type parameters, parameter mapping information of the model resource is established.
[0013] Furthermore, before establishing parameter mapping information of the model resource according to the type parameter, the method further includes:
[0014] Pre-collecting game logic information loaded by the model, wherein the game logic information at least includes position transformation information of the model resources in the game scene;
[0015] Allocating a sorting parameter to the model resource according to the game logic information, the sorting parameter being the order in which the model resource is loaded in the game scene;
[0016] Correspondingly, the parameter mapping information of the model resource is established according to the type parameter, including:
[0017] Parameter mapping information of the model resource is established according to the sorting parameter and the type parameter.
[0018] Furthermore, before establishing parameter mapping information of the model resource according to the game logic information in response to the loading instruction of the model resource, the method further includes:
[0019] Pre-generate a model resource file required for running the game, wherein the model resource file at least includes a low-precision model resource and a parameter configuration file associated with the low-precision model resource;
[0020] Correspondingly, constructing model data of different precision types according to the parameter mapping information so as to render the model data of corresponding precision types through different resource processors includes:
[0021] When it is determined according to the parameter mapping information that the model resource is of a low-poly type, loading a parameter configuration file associated with the low-precision model resource into a memory;
[0022] Construct array data of low-precision model resources according to the parameter configuration file;
[0023] The array data of the low-precision model resource is submitted to the graphics processor in an instantiated form for rendering.
[0024] Furthermore, constructing the array data of the low-precision model resource according to the parameter configuration file includes:
[0025] Get the action currently played by the model resource in the game scene;
[0026] The action parameters of the model resource are read from the parameter configuration file according to the action currently played by the model resource, and are constructed as array data of the low-precision model resource.
[0027] Furthermore, constructing model data of different precision types according to the parameter mapping information so as to render the model data of corresponding precision types through different resource processors also includes:
[0028] When it is determined that the model resource is a high-poly model type according to the parameter mapping information, the high-precision model resource required for running the game is loaded into the memory for rendering through the central processing unit;
[0029] The loaded high-precision model resources are placed into the cache pool so that the corresponding high-precision model resources in the cache pool can be reused when they are loaded again.
[0030] Furthermore, when there is a performance imbalance between different resource processors, before updating the parameter mapping information of the model resource to control the model resource to switch the precision type through the updated parameter mapping information, the method further includes:
[0031] Obtaining a flag bit set when a model resource enters a current loading cycle, wherein the flag bit triggers a change when there is a performance imbalance between different resource processors;
[0032] Accordingly, when there is a performance imbalance between different resource processors, updating the parameter mapping information of the model resource to control the model resource to switch the precision type through the updated parameter mapping information includes:
[0033] When the model resource is triggered to enter the next loading cycle, detecting whether the flag bit is changed;
[0034] If the flag bit is changed, the parameter mapping information of the model resource is updated according to the performance pressure corresponding to the different resource processors, so as to control the precision type switching of the model resource through the updated parameter mapping information;
[0035] The updating of the parameter mapping information of the model resource according to the performance pressures corresponding to the different resource processors, so as to control the precision type switching of the model resource through the updated parameter mapping information, includes:
[0036] If the performance pressure corresponding to the central processing unit is greater than the performance pressure corresponding to the graphics processing unit, some model resources in the parameter mapping information of the updated model resources are switched from high-precision type to low-precision type, and the array data of the low-precision model resources are submitted to the graphics processing unit for rendering in an instantiated form accordingly;
[0037] If the performance pressure corresponding to the central processing unit is less than or equal to the performance pressure corresponding to the graphics processing unit, some model resources in the parameter mapping information of the model resources are updated and switched from low-precision type to high-precision type. Accordingly, the high-precision model resources required for the game operation are loaded into the memory for rendering through the central processing unit.
[0038] According to a second aspect of the present application, a rendering device for a model resource is provided, comprising:
[0039] An establishing unit, configured to establish parameter mapping information of the model resource in response to a loading instruction of the model resource, wherein the parameter mapping information records the precision type allocated to the model resource in the game scene;
[0040] A rendering unit, used for constructing model data of different precision types according to the parameter mapping information, so as to render the model data of corresponding precision types through different resource processors;
[0041] The switching unit is used to update the parameter mapping information of the model resource when there is a performance imbalance between different resource processors, so as to control the model resource to switch the precision type through the updated parameter mapping information.
[0042] Furthermore, the establishing unit includes:
[0043] An acquisition module, configured to acquire parameter restriction information of model loading in response to a loading instruction of a model resource, wherein the parameter restriction information at least includes a quantity restriction of model resources of different precision types in a game scene;
[0044] A first allocation module, configured to allocate a type parameter to the model resource according to the parameter restriction information, wherein the type parameter is a precision type of the model resource loaded in the game scene;
[0045] The establishment module is used to establish parameter mapping information of the model resource according to the type parameter.
[0046] Furthermore, the establishing unit further includes:
[0047] A collection module, used for pre-collecting game logic information loaded by the model before establishing parameter mapping information of the model resource according to the type parameter, wherein the game logic information at least includes position transformation information of the model resource in the game scene;
[0048] A second allocation module, configured to allocate a sorting parameter to the model resource according to the game logic information, wherein the sorting parameter is the order in which the model resource is loaded in the game scene;
[0049] Correspondingly, the establishment module is specifically used to establish parameter mapping information of the model resource according to the sorting parameter and the type parameter.
[0050] Furthermore, the device also includes:
[0051] A generating unit, configured to generate a model resource file required for running the game in advance before establishing parameter mapping information of the model resource according to the game logic information in response to the loading instruction of the model resource, wherein the model resource file includes at least a low-precision model resource and a parameter configuration file associated with the low-precision model resource;
[0052] Accordingly, the rendering unit is specifically used for:
[0053] When it is determined according to the parameter mapping information that the model resource is of a low-poly type, loading a parameter configuration file associated with the low-precision model resource into a memory;
[0054] Construct array data of low-precision model resources according to the parameter configuration file;
[0055] The array data of the low-precision model resource is submitted to the graphics processor in an instantiated form for rendering.
[0056] Furthermore, the rendering unit is further configured to:
[0057] Get the action currently played by the model resource in the game scene;
[0058] The action parameters of the model resource are read from the parameter configuration file according to the action currently played by the model resource, and are constructed as array data of the low-precision model resource.
[0059] Furthermore, the rendering unit is further configured to:
[0060] When it is determined that the model resource is a high-poly model type according to the parameter mapping information, the high-precision model resource required for running the game is loaded into the memory for rendering through the central processing unit;
[0061] The loaded high-precision model resources are placed into the cache pool so that the corresponding high-precision model resources in the cache pool can be reused when they are loaded again.
[0062] Furthermore, the device also includes:
[0063] an acquisition unit, configured to update the parameter mapping information of the model resource when there is a performance imbalance between different resource processors, so as to acquire a flag bit set for the model resource to enter the current loading cycle before controlling the model resource to switch the precision type through the updated parameter mapping information, wherein the flag bit triggers a change when there is a performance imbalance between different resource processors;
[0064] Accordingly, the switching unit is used for:
[0065] When the model resource is triggered to enter the next loading cycle, detecting whether the flag bit is changed;
[0066] If the flag bit is changed, the parameter mapping information of the model resource is updated according to the performance pressure corresponding to the different resource processors, so as to control the precision type switching of the model resource through the updated parameter mapping information;
[0067] The switching unit is further specifically used for:
[0068] If the performance pressure corresponding to the central processing unit is greater than the performance pressure corresponding to the graphics processing unit, some model resources in the parameter mapping information of the updated model resources are switched from high-precision type to low-precision type, and the array data of the low-precision model resources are submitted to the graphics processing unit for rendering in an instantiated form accordingly;
[0069] If the performance pressure corresponding to the central processing unit is less than or equal to the performance pressure corresponding to the graphics processing unit, some model resources in the parameter mapping information of the model resources are updated and switched from low-precision type to high-precision type. Accordingly, the high-precision model resources required for the game operation are loaded into the memory for rendering through the central processing unit.
[0070] According to a third aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in the first aspect when executing the computer program.
[0071] According to a fourth aspect of the present application, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0072] By means of the above technical scheme, the present application provides a rendering method, device and equipment for model resources. Compared with the current prior art that uses instantiation rendering to realize the rendering method of model resources, the present application responds to the loading instruction of the model resources, establishes parameter mapping information of the model resources, and the parameter mapping information records the precision type allocated to the model resources in the game scene; constructs model data of different precision types according to the parameter mapping information, so as to render the model data of the corresponding precision type through different resource processors; when there is a performance imbalance between different resource processors, updates the parameter mapping information of the model resources, so as to control the precision type switching of the model resources through the updated parameter mapping information. The whole process realizes the switching allocation of model resources between different precision types by establishing parameter mapping information, so as to dynamically adjust the model resources of different precision types during the game operation, so that the allocation of model resources can be adjusted between different resource processors according to performance requirements, which can give full play to the resource advantages of different resource processors in the model rendering process, effectively balance the performance pressure between different resource processors, and realize the fast and smooth switching of model resources between different resource processors, thereby improving the game performance effect.
[0073] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0075] Figure 1 It is a flowchart of a rendering method of a model resource provided in an embodiment of the present application;
[0076] Figure 2 yes Figure 1 A schematic flow chart of a specific implementation of step 101;
[0077] Figure 3 yes Figure 2 Another specific implementation flow diagram of step 101;
[0078] Figure 4 It is a flowchart of another method for rendering model resources provided in an embodiment of the present application;
[0079] Figure 5 yes Figure 4 A schematic flow chart of a specific implementation of step 102;
[0080] Figure 6 It is a flowchart of another method for rendering model resources provided in an embodiment of the present application;
[0081] Figure 7 It is a flowchart of a rendering method of a model resource provided in an embodiment of the present application;
[0082] Figure 8 It is a structural schematic diagram of a rendering device for a model resource provided in an embodiment of the present application;
[0083] Fig. 9 It is a schematic diagram of the device structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0084] Now the content of the present invention will be discussed with reference to several exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and thus implement the content of the present invention, rather than implying any limitation on the scope of the present invention.
[0085] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including but not limited to." The term "based on" is to be interpreted as "based, at least in part, on." The terms "one embodiment" and "an embodiment" are to be interpreted as "at least one embodiment." The term "another embodiment" is to be interpreted as "at least one other embodiment."
[0086] Related technologies can realize the rendering process of model resources through animation compression, LOD, instanced rendering, multi-threaded animation processing, etc. Animation compression can reduce data to drive animation through keyframe compression or animation merging. However, it still faces performance bottlenecks in high-density scenes. LOD can reduce the rendering burden by reducing the details of distant models, but LOD switching will cause visual discontinuity and affect the in-game effect. Instanced rendering can reduce the number of rendering instructions, but complex actions still need to ensure the independence of each instance animation, and there is still a CPU burden.
[0087] Among them, instanced rendering is a more commonly used rendering method, which mainly passes animation data to the GPU for processing, for example, by sampling animation maps or directly modifying vertex data in fixed-point shaders to simulate animation effects. Although relying entirely on the GPU for rendering can better simulate the appearance and actions of characters, this method requires writing shaders separately for models when there are many types of models, which causes a lot of workload and makes it difficult to complete some highly interactive gameplay in the game, resulting in a lack of gameplay in the game and affecting the game performance.
[0088] In order to solve this problem, this embodiment provides a rendering method for model resources, such as Figure 1 As shown, the method comprises the following steps:
[0089] 101. In response to a loading instruction of a model resource, establish parameter mapping information of the model resource.
[0090] Among them, the parameter mapping information records the precision type of the model resources allocated in the game scene, and the precision type here can include at least high-precision models, medium-precision models, and low-precision models. High-precision models usually have very complex details and geometric shapes, requiring extremely high model expression precision, and can show realistic and delicate appearance effects. Medium-precision models usually have complex details and geometric shapes, requiring higher model expression precision, which can take into account the visual effects and production costs, performance consumption, etc. of the model to a certain extent. Low-precision models usually have simpler details and geometric shapes, and do not require high-precision model expression, which can be achieved by simplifying geometric shapes, reducing the number of patches, and reducing texture resolution. How to allocate the precision type of model resources in the game scene can be determined according to the gameplay logic and the game scene model restrictions. Under normal circumstances, the gameplay logic requires high-precision display for the same team model. If the game scene model limits 3 high-precision models, and there are 3 same team models in the current scene, then the high-precision type is allocated to the 3 same team models in the current scene accordingly.
[0091] In this embodiment, the loading instruction of the model resource is an instruction used to notify the game system to obtain the model resource from the storage medium (such as a hard disk, server, etc.) and transfer it into the memory during the game development and operation process, so as to perform subsequent rendering, use, and other operations in the game scene. The loading instruction can be triggered at any stage during the game operation process. For example, in the game startup phase, the system executes a series of initialization loading instructions to load the core model resources into the memory. For example, when the game scene is switched, when the player enters another game scene from one game scene, the loading instruction for the model resource in the new scene will be triggered. For example, in the game interaction scene, when the player obtains a new prop, there will be a corresponding loading instruction to load the model resource corresponding to the prop, or when the character changes or changes clothes, the loading instruction can be used to realize the functions of changing clothes and changing body.
[0092] Specifically, the selected model of the game can be analyzed through offline baking to determine the model resources and action configuration. The selected model can be a character model in a 3D game, a prop model in a scene, etc., for example, the character model of the protagonist in a role-playing game. Since the selected model may have a complex appearance structure, the pre-baked model resources here are usually low-precision models, including but not limited to the geometric faces corresponding to the selected model, textures of different materials and other information. For the selected model, it is necessary to determine the relevant resource configuration, such as resource file references, real-time configuration, shader action and other parameter configurations. The action parameters may include action length, action frequency, and action mapping parameters. These actions can be conventional movements such as walking, running, attacking, jumping, etc., or special actions required by the plot, such as magic postures.
[0093] The above-mentioned offline baking is a common preprocessing technology in the fields of graphics processing, game development, etc. It is usually operated in the early preparation of the project or the non-real-time operation stage, with the purpose of calculating and storing some data with high computational cost in the real-time rendering process in advance, so as to improve the efficiency of subsequent real-time rendering. The specific offline baking analysis process may include geometric topology analysis, action data analysis, and material and texture association analysis. In the process of geometric topology analysis, the geometric shape of the target model can be analyzed to determine the distribution and connection relationship of its vertices, edges, faces and other elements to obtain the complexity and spatial form of the target model, so as to optimize the generation of action resources according to its characteristics in the future. In the process of action data analysis, key data such as the motion trajectory of the bones, the rotation angle of the joints, and the displacement changes of the model vertices with the action in the specified action information can be deeply analyzed. In the process of material and texture association analysis, the performance of the material and the change of the texture of the target model during the execution of the action are taken into account. For example, some actions may cause the light reflection effect on the surface of the model to change, or some textures may be stretched or distorted according to the action. Analyzing these associations can ensure that the generated resources can correctly present the effect at runtime.
[0094] 102. Construct model data of different precision types according to the parameter mapping information, so as to render the model data of corresponding precision types through different resource processors.
[0095] In this embodiment, the resource mapping relationship of different models is set in the parameter mapping information, and the precision type of each model resource loaded in the game scene can be determined through the resource association relationship, and the model data of the corresponding precision type is constructed to send the model data of the corresponding precision type to the resource processor for rendering. For example, the resource mapping relationship of 5 models is recorded in the parameter mapping information, and the resource mapping relationship can be used to determine that two models are loaded as high-precision models in the game scene, and the remaining three models are loaded as low-precision models in the game scene.
[0096] Specifically, in the process of constructing model data of different precision types, the model data required for the game can be obtained from the model resources according to the precision type. Here, the model data is usually low-precision model data. Based on the low-precision model data, the corresponding precision adjustment is adopted to roughly generate medium- and high-precision model data. It can be understood that low-precision model data usually has a simple geometric structure and can be directly loaded through pre-baked model resources, while high-precision model data requires rich details, numerous nodes, faces, high-resolution textures and other information, which can be loaded from the resource processor through the resource management mechanism.
[0097] Considering the functional characteristics of different resource processors in the game, the CPU is mainly responsible for logical operations, data preparation, and sending rendering instructions to the GPU, while the GPU is good at processing graphics data in parallel, and then efficiently rendering calculations, converting model data into visual images and presenting them on the screen. For example, when processing complex lighting calculations, the CPU will first prepare the relevant data, and then submit it to the GPU for large-scale parallel lighting rendering. For high-precision models, due to their large data volume and rich details, they need to be loaded through the CPU, while low-precision model data is simple and can be simply and efficiently rendered through the GPU.
[0098] 103. When there is a performance imbalance between different resource processors, update the parameter mapping information of the model resource, so as to control the model resource to switch the precision type through the updated parameter mapping information.
[0099] During the running of the game, in order to track the usage of hardware resources in real time (such as the usage rate of the CPU, the load of the GPU, and the memory usage, etc.) and the actual effect of model rendering in the game scene (such as whether there is lag, screen tearing, accuracy not meeting expectations, etc.), a performance monitoring mechanism can be established. Performance indicators can be obtained through special performance detection tools or the system's own hardware detection software to determine whether there is a performance imbalance between different resource processors.
[0100] Specifically, when there is a performance imbalance between different resource processors, the allocation of model resources corresponding to the precision type in the parameter mapping information can be dynamically adjusted according to the results of performance monitoring, so as to adjust the task allocation of different resource processors accordingly and control the model resources to switch the precision type. If the hardware resources are tight, the performance pressure corresponding to the central processor will increase at this time. The number of high-precision models allocated in the parameter mapping information can be appropriately reduced, so that the number of high-precision models loaded by the central processor can be correspondingly reduced in the next loading cycle, and the high-precision models with greater performance pressure can be converted into low-precision models for rendering by the graphics processor to ensure the smooth operation of the game. On the contrary, if the hardware resources are sufficient and the picture effect needs to be optimized, the performance pressure corresponding to the central processor is relatively small at this time. The number of high-precision models allocated in the parameter mapping information can be appropriately increased, so that the number of high-precision models rendered by the graphics processor can be correspondingly increased in the next loading cycle to enhance the gaming experience.
[0101] The rendering method of model resources provided in the embodiment of the present application is compared with the rendering method of model resources using instantiation rendering in the current prior art. In response to the loading instruction of the model resources, the present application establishes parameter mapping information of the model resources, and the parameter mapping information records the precision type allocated to the model resources in the game scene; constructs model data of different precision types according to the parameter mapping information, so that the model data of the corresponding precision type can be rendered by different resource processors; when there is a performance imbalance between different resource processors, the parameter mapping information of the model resources is updated, so as to control the precision type switching of the model resources through the updated parameter mapping information. The whole process realizes the switching allocation of model resources between different precision types by establishing parameter mapping information, so as to dynamically adjust the model resources of different precision types during the game operation, so that the allocation of model resources can be adjusted between different resource processors according to performance requirements, which can give full play to the resource advantages of different resource processors in the model rendering process, effectively balance the performance pressure between different resource processors, and realize the fast and smooth switching of model resources between different resource processors, thereby improving the game performance effect.
[0102] In actual application scenarios, considering the impact on game performance, model loading in game scenarios has certain restrictions, including restrictions on high-precision models and low-precision models. Specifically, Figure 2 As shown, step 101 includes the following steps:
[0103] 201. In response to a loading instruction of a model resource, obtain parameter restriction information for model loading.
[0104] 202. Allocate type parameters for the model resource according to the parameter restriction information.
[0105] 203. Establish parameter mapping information of the model resource according to the type parameter.
[0106] Among them, the parameter restriction information at least includes the quantity limit of model resources of different precision types in the game scene, such as the loading quantity range of high-precision models and low-precision models in the game scene under different hardware conditions and scene complexity.
[0107] In an application scenario, parameter restriction information can be determined by viewing the setting interface of the game engine or tool. In the scene management window of the game engine, there are usually settings and information related to model loading to view the number of high-poly models and low-poly models loaded. When changing the scene complexity settings, observe the changes in the number of high-precision models and low-precision models loaded in different situations to determine the number limit of model resources of different precision types in the game scene.
[0108] In another application scenario, parameter restriction information can be determined by analyzing codes and scripts. After obtaining the source code of the game engine, the code logic of the model loading process is deeply analyzed, and then the variable definitions, judgment conditions and restriction logic regarding the number of high-precision and low-precision models loaded are queried in the code logic, so as to determine the number limit of model resources of different precision types in the game scene.
[0109] In this embodiment, the type parameter is the precision type of the model resource loaded in the game scene, that is, the model resource loaded in the game scene is a high-precision model, a medium-precision model, or a low-precision model. The number limit of model resources of different precision types can be determined through parameter restriction information, and the type parameter is allocated to the model resource accordingly according to the quantity limit. For example, the limited number of high-precision models is 2, and the limited number of low-precision models is 3, and the type parameter allocated to 2 model resources is high-precision, and the type parameter allocated to 3 model resources is low-precision. The type parameter allocated to each resource model is further recorded according to the type parameter, and the parameter mapping information of the model resource is established accordingly.
[0110] In actual application scenarios, in order to ensure that model resources that players are more likely to pay attention to are rendered first under limited hardware resources, further, such as Figure 3 As shown, before step 203, the method further includes the following steps:
[0111] 301. Collect game logic information for model loading in advance.
[0112] 302. Allocate sorting parameters for the model resources according to the game logic information.
[0113] Among them, the game logic information at least includes the position transformation information of the model resource in the game scene, and the position transformation information can specifically be matrix transformation information, current playback action, etc. The matrix transformation information can be used to determine the model's translation, rotation, and scaling in three-dimensional space. For example, the translation matrix records the position movement information of the model resource in the x, y, and z axis directions, determines the specific coordinate position of the model resource in the game scene, and can indicate that the model resource has moved from the initial point of the scene to a specific task location. The dynamic behavior of the model resource can be obtained through the current playback action. For model resources with animation effects, such as character model walking, running, and attacking actions, or dynamic actions such as door opening and closing and mechanism operation in the building model, it is necessary to clearly record the specific action currently being performed, which not only includes the name of the action, but also involves the stage of the action and some related parameters, such as the progress of the action, the playback speed of the action, etc., which helps to accurately present the dynamic effect of the model resource.
[0114] Considering that different game scenes have different display requirements and importance rankings for models, usually, in the key scenes of the game's main storyline, model resources such as character models and important props that are directly related to the advancement of the plot may need to be displayed first, and the corresponding sorting parameters will be relatively high; while for some model resources such as plants and ornaments used as background decorations, they are relatively less important and have a relatively low sorting parameter. Similarly, in complex battle scenes, the model resources of the characters of both sides of the battle and the model resources of battle special effects will receive more attention than the model resources of distant scene decorations, and the sorting parameters will also be relatively high, so as to give priority to the display effect of the model in resource allocation and rendering order, so that players can focus on important elements during the game and improve the gaming experience.
[0115] In this embodiment, the sorting parameter can be used as an initial value. When the model resources are loaded, an initial sorting parameter will be set according to the position change of the model resources in the game scene. Considering the spatial layout of the model resources in the game scene, in order to provide players with better visual presentation, the sorting parameters can also be allocated based on the position transformation information of the model resources, according to visibility and player interactivity, so as to prioritize the loading of model content that players can pay more attention to. For example, in an indoor scene, the furniture and object model resources close to the center of the player's perspective may have a higher sorting parameter than the model resources located in the corner and difficult to see.
[0116] Correspondingly, in step 203, parameter mapping information of the model resource is established according to the sorting parameter and the type parameter.
[0117] In this embodiment, the model list and sorting parameters will be updated accordingly based on specific game logic information, such as whether they are on the same mount, on the same team, in the same family or union, etc., combined with the restrictions on low-precision models and high-precision models in the game scene. For example, the current game scene limits the number of low-precision models to only two, and the current game scene includes five role models, of which three are on the same team. Then the sorting parameters assigned to the five role models can be 11, 12, 13, 01, and 02. Then, based on the number of low-precision models, the type parameters of the corresponding role models with sorting parameters of 11, 12, and 13 are high-precision, and the type parameters of the corresponding role models with sorting parameters of 01 and 02 are low-precision.
[0118] In actual application scenarios, in order to improve the model loading speed, the model resources in the game scene can be baked offline to generate the resource parts and configuration files required for the game to run. Figure 4 As shown, before step 101, the method further includes the following steps:
[0119] 401. Generate model resource files required for running the game in advance.
[0120] In this embodiment, the model resource file includes at least a low-precision model resource and a parameter configuration file associated with the low-precision model resource, where the low-precision model resource may include a low-precision model network, material, action map, etc. The corresponding parameter configuration file includes a resource file reference, implementation configuration, and shader action parameter configuration, and the action parameter includes: action length L, action frame rate F, and action mapping parameter A. Generally speaking, a model resource file is associated with a configuration file. Here, the resource file reference can clearly define the specific location of various resource files related to the low-precision model associated with the configuration file, ensuring that the model resource can accurately find and use these resources during loading and rendering. For example, the configuration file records the storage path information of the texture file, material file, etc. of the model resource. In order to provide reference information of the corresponding texture and material of the model resource, through these reference information, the game engine and other systems can accurately load the corresponding resources according to the path, so that the model can be presented with the expected appearance and texture. The real-time configuration here can focus on some dynamically adjustable parameter settings of the model in the game operation. These parameters will change flexibly according to the real-time situation in the game (such as the player's operation, the change of the game scene, etc.), so as to optimize the performance of the model or adapt to different operating conditions. The shader action parameter configuration here is the parameter setting area for the model action at the shader level. Considering that the shader is responsible for processing the calculation of the model's lighting, color and other visual effects in graphics rendering, the action parameters of the corresponding shader configuration will affect how the model's surface lighting, texture and other presentation methods change with the action when the action is performed. Therefore, through the configuration of the above different parts and the cooperation of related action parameters, the performance of low-precision models in the game can be fully set and regulated from multiple dimensions, ensuring that the model resources can present the expected visual and interactive effects in various scenes and action states.
[0121] Correspondingly, for the low-poly model type, the model resource loading process, step 102 includes the following steps:
[0122] 1021. When it is determined that the model resource is a low-poly type according to the parameter mapping information, a parameter configuration file associated with the low-precision model resource is loaded into a memory.
[0123] 1022. Construct array data of low-precision model resources according to the parameter configuration file.
[0124] 1023. Submit the array data of the low-precision model resource to a graphics processor for rendering in an instantiated form.
[0125] In this embodiment, since the parameter configuration file associated with the low-precision model resource is obtained through offline baking, various resource data related to the low-precision model can be collected and integrated according to the resource reference information obtained from the parameter configuration file to make it a part of the array. For example, if the parameter configuration file indicates that the model resource needs to use a specific texture resource, its texture data, such as the color information and pattern of the texture, will be extracted from the corresponding texture file, and then these texture data will be organized into array elements together with the model's geometric shape data. Similarly, material-related data, such as the material's glossiness, transparency and other attribute information, are also organized according to the guidance of the parameter configuration file to ensure that each array element completely contains all types of data required for low-precision model rendering.
[0126] It is understandable that the instantiation process is based on the existing model resource data to create multiple object instances that can actually be rendered by the graphics processor. For example, there are multiple identical low-precision tree models in the game scene. Through the instantiation operation, multiple specific tree model instances can be generated using the array data of a tree model. They may differ in position, posture, etc., but share the basic model resource data, which can efficiently utilize resources and facilitate management. After submitting the array data in the form of instantiation to the graphics processor, the graphics processor will use its powerful parallel computing capabilities to perform a series of complex rendering calculations based on the geometric shape, texture, rendering parameters and other information contained in the data. For example, it calculates how the lighting effect is presented on the model surface and how the texture is accurately mapped to the model. Finally, these low-precision models are displayed on the screen in a visual form, allowing players to see the corresponding pictures in the game scene.
[0127] Usually in the resource system of game development, the parameter configuration file corresponding to each model resource will store different types of parameters in some organized form (such as objects, arrays, key-value pairs, etc. in JSON files). For action-related objects or arrays, the action currently played by the model resource in the game scene can be obtained; the action parameters of the model resource are read from the parameter configuration file according to the action currently played by the model resource, and the array data of the low-precision model resource is constructed. Specifically, the action parameters corresponding to the specific action name or identifier currently being played by the model resource can be filtered out from the parameter configuration file. For example, the model is performing the action of "walking". In the action parameter area of the configuration file, there will be a series of values corresponding to the key name of "walking". These values may include key parameter information such as the skeletal motion trajectory, joint angle change range, action speed setting, loop mode (whether to play in a loop, number of loops, etc.) during the walking action, and then these parameters closely related to the current "walking" action are accurately extracted. The current action parameters that have been filtered and extracted are then integrated into the array data in a certain order and format. For example, the bone motion trajectory data is arranged in sequence at specific positions in the array, followed by the joint angle change range data, etc., to ensure that these action parameters are combined with other data of the model resources in the array in an orderly manner to form a low-precision model resource array data that fully reflects the current action state.
[0128] For high-poly model types, the model resource loading process is as follows: Figure 5 As shown, step 102 also includes the following steps:
[0129] 501. When it is determined according to the parameter mapping information that the model resource is a high-poly type, the high-precision model resource required for running the game is loaded into the memory for rendering through the central processing unit.
[0130] 502. Put the loaded high-precision model resources into a cache pool, so that the corresponding high-precision model resources in the cache pool can be reused when they are loaded again.
[0131] In this embodiment, the CPU needs to clearly identify the specific location of the high-precision model resource in the storage medium, which can be determined based on the file path and naming rules set in the game resource management system. Then the CPU calls the corresponding file reading function or library to open and read the high-precision model resource according to the file format. These model resources contain rich details, such as a large amount of vertex data, high-resolution texture coordinates, and complex bone binding information.
[0132] It is understandable that, considering that the high-precision model resources are loaded from the central processing unit to the memory, in order to facilitate subsequent reuse, the loaded high-precision model resources can be stored in the cache pool. If the model resources are used again in the future, they do not need to be loaded from the central processing unit again, but can be directly obtained from the cache pool. Here, the cache pool is essentially a specific area in the memory, and efficient resource configuration can be achieved through specific data structures and algorithms.
[0133] Furthermore, in order to facilitate operations such as searching, inserting, and deleting model resources, the model resources can be stored through a hash table combined with a linked list structure. The unique identifier of the model resource is used as the key of the hash table, and the corresponding model resource data and its related metadata are stored in the linked list as values. When it is necessary to determine whether a high-precision model resource is already in the cache pool, the hash value of the corresponding identifier of the high-precision model can be calculated to quickly locate the corresponding linked list position for search. When a new high-precision model resource is added to the cache pool or a high-precision model resource that has not been used for a long time needs to be removed, the corresponding operation can also be implemented through the hash value of the corresponding identifier of the high-precision model resource.
[0134] Specifically, when the same high-precision model resource needs to be loaded multiple times during the game, the system will first search in the cache pool to see if the high-precision model resource already exists. Through the above-mentioned identification-based search mechanism, the storage location of the corresponding high-precision model resource in the cache pool can be quickly located, and then the data of the resource can be obtained from the cache pool without having to re-read it from the hard disk or other storage media, which greatly saves loading time and improves the running efficiency of the game.
[0135] In actual application scenarios, considering that the state of the model loading process in different game scenarios will change, further, such as Figure 6 As shown, before step 103, the method further includes the following steps:
[0136] 601. Obtain the flag bit set for the model resource to enter the current loading cycle.
[0137] It is understandable that the loading cycle of model resources will be triggered only when certain specific situations occur. For example, when a player performs a certain operation in the game, such as clicking the button to enter the next level, or walking into a new map area, the game system needs to start the next round of resource loading to obtain the model resources required for the new scene.
[0138] In this embodiment, the flag bit triggers a change when there is a performance imbalance between different resource processors. If there is a performance imbalance between different resource processors, it will trigger changes in the sorting parameters and type parameters of the model resources, and the flag bit of the corresponding model resource will change. When the next loading cycle is triggered, it is determined whether to reload the model resource based on this flag bit. In other words, the flag determines whether the precision type of the model resource corresponding to the loading is a high-precision model or a low-precision model, thereby ensuring a dynamic balance of performance pressure between different resource processors.
[0139] Accordingly, step 103 includes the following steps:
[0140] 1031. When the model resource is triggered to enter the next loading cycle, detect whether the flag bit is changed.
[0141] 1032. If the flag bit is changed, the parameter mapping information of the model resource is updated according to the performance pressure corresponding to different resource processors, so as to control the precision type switching of the model resource through the updated parameter mapping information.
[0142] It is understandable that the entire model loading process is dynamic, considering the performance pressure of different resource processors. Once the next loading cycle is triggered, checking whether the flag is updated allows the system to more clearly grasp the dynamic changes of model resources, so as to reasonably arrange the processing flow of model resources and ensure the accuracy of model resource display in the game.
[0143] Specifically, if the model resource does not trigger the flag update, it means that the model resource is in a relatively stable state, and the parameter mapping information of the model resource does not need to be updated temporarily. When entering the next loading cycle, the model resource can be controlled to maintain the precision type corresponding to the previous loading cycle according to the parameter mapping information of the previous loading cycle. If the model resource triggers the flag update, it means that the state of the model resource needs to change, and the parameter mapping information of the model resource is updated accordingly. When entering the next loading cycle, the model resource needs to be controlled to change the precision type according to the updated parameter mapping information.
[0144] Accordingly, in the process of updating the parameter mapping information of the model resource according to the performance pressure corresponding to different resource processors, so as to control the precision type switching of the model resource through the updated parameter mapping information, the following steps are included:
[0145] If the performance pressure corresponding to the CPU is greater than the performance pressure corresponding to the GPU, some model resources in the parameter mapping information of the updated model resources are switched from high-precision type to low-precision type, and the array data of the low-precision model resources are submitted to the GPU for rendering in the form of instantiation.
[0146] If the performance pressure corresponding to the CPU is less than or equal to the performance pressure corresponding to the GPU, some model resources in the parameter mapping information of the model resources are updated and switched from low-precision type to high-precision type. Accordingly, the high-precision model resources required for the game to run are loaded into the memory for rendering through the CPU.
[0147] Specifically, in the process of switching some model resources from high-precision type to low-precision type in the parameter mapping information of the updated model resources, the high-precision model is first recycled. Since the high-precision model will occupy more system resources, when the model no longer needs the high-precision details provided by the high-precision model, recycling the high-precision model can release these valuable resources, avoid resource waste, and make room for subsequent loading and rendering of low-precision models. Then the array data of the low-precision model resource is submitted to the graphics processor for rendering in the form of instantiation. Here, the action parameters mapped by the low-precision model resource, including the action length L, the action frame rate F, and the action mapping parameter A, can be submitted to the graphics processor in the form of a data array. Since the action length L specifies the time span required for the low-precision model to complete a complete action, the action length L can be used as part of the action-related parameter set and packaged with other data of the low-precision model and submitted to the graphics processor. Since the action frame rate M determines the number of frames of the low-precision model action change per unit time, the graphics processor will determine how many frames need to be updated and rendered in each second to present the action based on the action frame rate M. Similarly, the action frame rate M is also included in the action parameter set sent to the graphics processor. Since the action mapping parameter A is used to determine how the low-polygon action corresponds to external operations, logic and other elements, the graphics processor can organize the action mapping parameter A and other action parameters into a data structure and pass it to the graphics processor.
[0148] The above process of recycling high-precision models can be achieved in the following way: first locate the specific area where the high-precision model data is stored in the memory, such as the memory block where the vertex coordinate array, texture data, material data, etc. of the high-precision model are located, and then release the memory according to the rules when allocating memory, and return the memory space to the system so that other programs or resources can use it.
[0149] In actual application scenarios, the rendering process of model resources is as follows: Figure 7As shown, firstly, low-precision model resources are baked offline, and resources and configuration files are generated according to the low-precision models baked offline for use in the real-time environment. Then, during the real-time processing, when it is detected that model resources need to be loaded, model information is collected, parameter mapping information of the model resources is established, and a resource list is constructed through the parameter mapping information of the model resources. The resource list allocates different precision types for all model resources, and then the model resources are constructed according to the allocated precision type. For the constructed low-precision model, the low-precision model is rendered by the graphics processor, and for the constructed high-precision model, the high-precision model is loaded by the central processing unit. At the same time, the above-mentioned model resource loading process is repeated in each loading cycle, and the precision type allocation of the model resources is dynamically adjusted according to the performance pressure between the central processing unit and the graphics processing unit.
[0150] Further, as Figure 1-Figure 6 The specific implementation of the method, the embodiment of the present application provides a rendering device for model resources, such as Figure 8 As shown, the device includes: an establishing unit 71, a rendering unit 72, and a switching unit 73.
[0151] An establishing unit 71, configured to establish parameter mapping information of the model resource in response to a loading instruction of the model resource, wherein the parameter mapping information records the precision type allocated to the model resource in the game scene;
[0152] A rendering unit 72, configured to construct model data of different precision types according to the parameter mapping information, so as to render the model data of corresponding precision types through different resource processors;
[0153] The switching unit 73 is used to update the parameter mapping information of the model resource when there is a performance imbalance between different resource processors, so as to control the model resource to switch the precision type through the updated parameter mapping information.
[0154] Compared with the rendering method of model resources implemented by instantiation rendering in the prior art, the rendering device of model resources provided by the embodiment of the present invention establishes parameter mapping information of model resources in response to the loading instruction of model resources, and the parameter mapping information records the precision type allocated to the model resources in the game scene; constructs model data of different precision types according to the parameter mapping information, so as to render the model data of corresponding precision types through different resource processors; when there is a performance imbalance between different resource processors, updates the parameter mapping information of model resources, so as to control the precision type switching of model resources through the updated parameter mapping information. The whole process realizes the switching allocation of model resources between different precision types by establishing parameter mapping information, so as to dynamically adjust the model resources of different precision types during the game operation, so that the allocation of model resources can be adjusted between different resource processors according to performance requirements, which can give full play to the resource advantages of different resource processors in the model rendering process, effectively balance the performance pressure between different resource processors, realize the fast and smooth switching of model resources between different resource processors, and improve the game performance effect.
[0155] In an actual application scenario, the establishing unit includes:
[0156] An acquisition module, configured to acquire parameter restriction information of model loading in response to a loading instruction of a model resource, wherein the parameter restriction information at least includes a quantity restriction of model resources of different precision types in a game scene;
[0157] A first allocation module, configured to allocate a type parameter to the model resource according to the parameter restriction information, wherein the type parameter is a precision type of the model resource loaded in the game scene;
[0158] The establishment module is used to establish parameter mapping information of the model resource according to the type parameter.
[0159] In an actual application scenario, the establishing unit further includes:
[0160] A collection module, used for pre-collecting game logic information loaded by the model before establishing parameter mapping information of the model resource according to the type parameter, wherein the game logic information at least includes position transformation information of the model resource in the game scene;
[0161] A second allocation module, configured to allocate a sorting parameter to the model resource according to the game logic information, wherein the sorting parameter is the order in which the model resource is loaded in the game scene;
[0162] Correspondingly, the establishment module is specifically used to establish parameter mapping information of the model resource according to the sorting parameter and the type parameter.
[0163] In an actual application scenario, the device further includes:
[0164] A generating unit, configured to generate a model resource file required for running the game in advance before establishing parameter mapping information of the model resource according to the game logic information in response to the loading instruction of the model resource, wherein the model resource file includes at least a low-precision model resource and a parameter configuration file associated with the low-precision model resource;
[0165] Accordingly, the rendering unit is specifically used for:
[0166] When it is determined according to the parameter mapping information that the model resource is of a low-poly type, loading a parameter configuration file associated with the low-precision model resource into a memory;
[0167] Construct array data of low-precision model resources according to the parameter configuration file;
[0168] The array data of the low-precision model resource is submitted to the graphics processor in an instantiated form for rendering.
[0169] In actual application scenarios, the rendering unit is further used for:
[0170] Get the action currently played by the model resource in the game scene;
[0171] The action parameters of the model resource are read from the parameter configuration file according to the action currently played by the model resource, and are constructed as array data of the low-precision model resource.
[0172] In actual application scenarios, the rendering unit is further used for:
[0173] When it is determined that the model resource is a high-poly model type according to the parameter mapping information, the high-precision model resource required for running the game is loaded into the memory for rendering through the central processing unit;
[0174] The loaded high-precision model resources are placed into the cache pool so that the corresponding high-precision model resources in the cache pool can be reused when they are loaded again.
[0175] In an actual application scenario, the device further includes:
[0176] an acquisition unit, configured to update the parameter mapping information of the model resource when there is a performance imbalance between different resource processors, so as to acquire a flag bit set for the model resource to enter the current loading cycle before controlling the model resource to switch the precision type through the updated parameter mapping information, wherein the flag bit triggers a change when there is a performance imbalance between different resource processors;
[0177] Accordingly, the switching unit is used for:
[0178] When the model resource is triggered to enter the next loading cycle, detecting whether the flag bit is changed;
[0179] If the flag bit is changed, the parameter mapping information of the model resource is updated according to the performance pressure corresponding to the different resource processors, so as to control the precision type switching of the model resource through the updated parameter mapping information;
[0180] The switching unit is further specifically used for:
[0181] If the performance pressure corresponding to the central processing unit is greater than the performance pressure corresponding to the graphics processing unit, some model resources in the parameter mapping information of the updated model resources are switched from high-precision type to low-precision type, and the array data of the low-precision model resources are submitted to the graphics processing unit for rendering in an instantiated form accordingly;
[0182] If the performance pressure corresponding to the central processing unit is less than or equal to the performance pressure corresponding to the graphics processing unit, some model resources in the parameter mapping information of the model resources are updated and switched from low-precision type to high-precision type. Accordingly, the high-precision model resources required for the game operation are loaded into the memory for rendering through the central processing unit.
[0183] It should be noted that for other corresponding descriptions of the functional units involved in the rendering device of a model resource provided in this embodiment, reference can be made to Figure 1-Figure 6 The corresponding description in will not be repeated here.
[0184] Based on the above Figure 1-Figure 6 The method shown in the embodiment of the present application accordingly provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Figure 1-Figure 6 The rendering method of the model resource shown.
[0185] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0186] Based on the above Figure 1-Figure 6 The method shown, and Figure 8In order to achieve the above-mentioned purpose, the embodiment of the present application also provides a physical device for rendering model resources, which can be a computer, a smart phone, a tablet computer, a smart watch, a server, or a network device, etc. The physical device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1-Figure 6 The rendering method of the model resource shown.
[0187] Optionally, the physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0188] In an exemplary embodiment, see Fig. 9 The physical device includes a communication bus, a processor, a memory and a communication interface, and may also include an input / output interface and a display device, wherein each functional unit can communicate with each other through the bus. The memory stores a computer program, and the processor is used to execute the program stored in the memory and execute the rendering method of the model resource in the above embodiment.
[0189] Those skilled in the art will appreciate that the physical device structure of a model resource rendering provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.
[0190] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the physical device for rendering the above-mentioned model resources, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing physical device.
[0191] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware. By applying the technical solution of the present application, compared with the current existing methods, the present application implements the switching allocation of model resources between different precision types by establishing parameter mapping information, so as to dynamically adjust model resources of different precision types during the game operation, so that the allocation of model resources can be adjusted between different resource processors according to performance requirements, and the resource advantages of different resource processors in the model rendering process can be fully utilized, and the performance pressure between different resource processors can be effectively balanced, so as to realize the fast and smooth switching of model resources between different resource processors and improve the game performance.
[0192] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0193] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.
Claims
1. A rendering method for a model resource, characterized in that: include: In response to a loading instruction of a model resource, parameter mapping information of the model resource is established, wherein the parameter mapping information records the type of precision allocated to the model resource in the game scene; constructing model data of different precision types according to the parameter mapping information, so as to render the model data of corresponding precision types through different resource processors; When there is a performance imbalance between different resource processors, the parameter mapping information of the model resource is updated to control the model resource to switch the precision type through the updated parameter mapping information.
2. The method according to claim 1, characterized in that The step of establishing parameter mapping information of the model resource in response to the loading instruction of the model resource includes: In response to a model resource loading instruction, obtaining parameter restriction information for model loading, wherein the parameter restriction information at least includes a quantity restriction of model resources of different precision types in a game scene; Allocate a type parameter for the model resource according to the parameter restriction information, the type parameter being the precision type of the model resource loaded in the game scene; According to the type parameters, parameter mapping information of the model resource is established.
3. The method according to claim 2, characterized in that Before establishing parameter mapping information of the model resource according to the type parameter, the method further includes: Pre-collecting game logic information loaded by the model, wherein the game logic information at least includes position transformation information of the model resources in the game scene; Allocating a sorting parameter to the model resource according to the game logic information, the sorting parameter being the order in which the model resource is loaded in the game scene; Correspondingly, the parameter mapping information of the model resource is established according to the type parameter, including: Parameter mapping information of the model resource is established according to the sorting parameter and the type parameter.
4. The method according to claim 1, characterized in that: Before establishing parameter mapping information of the model resource according to the game logic information in response to the loading instruction of the model resource, the method further includes: Pre-generate a model resource file required for running the game, wherein the model resource file at least includes a low-precision model resource and a parameter configuration file associated with the low-precision model resource; Correspondingly, constructing model data of different precision types according to the parameter mapping information so as to render the model data of corresponding precision types through different resource processors includes: When it is determined according to the parameter mapping information that the model resource is of a low-poly type, loading a parameter configuration file associated with the low-precision model resource into a memory; Construct array data of low-precision model resources according to the parameter configuration file; The array data of the low-precision model resource is submitted to the graphics processor in an instantiated form for rendering.
5. The method according to claim 4, characterized in that The step of constructing the array data of the low-precision model resource according to the parameter configuration file includes: Get the action currently played by the model resource in the game scene; The action parameters of the model resource are read from the parameter configuration file according to the action currently played by the model resource, and are constructed as array data of the low-precision model resource.
6. The method according to any one of claims 1 to 5, characterized in that The constructing model data of different precision types according to the parameter mapping information so as to render the model data of corresponding precision types through different resource processors also includes: When it is determined that the model resource is a high-poly model type according to the parameter mapping information, the high-precision model resource required for running the game is loaded into the memory for rendering through the central processing unit; The loaded high-precision model resources are placed into the cache pool so that the corresponding high-precision model resources in the cache pool can be reused when they are loaded again.
7. The method according to any one of claims 1 to 5, characterized in that Before updating the parameter mapping information of the model resource when there is a performance imbalance between different resource processors to control the model resource to switch the precision type through the updated parameter mapping information, the method further includes: Obtaining a flag bit set when a model resource enters a current loading cycle, wherein the flag bit triggers a change when there is a performance imbalance between different resource processors; Accordingly, when there is a performance imbalance between different resource processors, updating the parameter mapping information of the model resource to control the model resource to switch the precision type through the updated parameter mapping information includes: When the model resource is triggered to enter the next loading cycle, detecting whether the flag bit is changed; If the flag bit is changed, the parameter mapping information of the model resource is updated according to the performance pressure corresponding to the different resource processors, so as to control the precision type switching of the model resource through the updated parameter mapping information; The updating of the parameter mapping information of the model resource according to the performance pressures corresponding to the different resource processors, so as to control the precision type switching of the model resource through the updated parameter mapping information, includes: If the performance pressure corresponding to the central processing unit is greater than the performance pressure corresponding to the graphics processing unit, some model resources in the parameter mapping information of the updated model resources are switched from high-precision type to low-precision type, and the array data of the low-precision model resources are submitted to the graphics processing unit for rendering in an instantiated form accordingly; If the performance pressure corresponding to the central processing unit is less than or equal to the performance pressure corresponding to the graphics processing unit, some model resources in the parameter mapping information of the model resources are updated and switched from low-precision type to high-precision type. Accordingly, the high-precision model resources required for the game operation are loaded into the memory for rendering through the central processing unit.
8. A rendering device for model resources, characterized in that: include: An establishing unit, configured to establish parameter mapping information of the model resource in response to a loading instruction of the model resource, wherein the parameter mapping information records the precision type allocated to the model resource in the game scene; A rendering unit, used for constructing model data of different precision types according to the parameter mapping information, so as to render the model data of corresponding precision types through different resource processors; The switching unit is used to update the parameter mapping information of the model resource when there is a performance imbalance between different resource processors, so as to control the model resource to switch the precision type through the updated parameter mapping information.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for rendering the model resource according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for rendering model resources described in any one of claims 1 to 7 are implemented.
