A data storage management method, object rendering method and device
By associating and storing the index data of the LOD model and reusing the rendering data, the problems of large LOD model storage space and low rendering efficiency are solved, and efficient data management and rendering process are achieved.
Patent Information
- Application Number
- CN202011276117.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-13
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2040-11-13
AI Technical Summary
Existing LOD models in games and animations take up a lot of storage space and are slow to develop. They require a complex lighting baking process, which affects rendering efficiency.
By obtaining the index data of the first LOD model, determining the index data of the second LOD model according to the simplified ratio, and storing it in association with the first LOD model, only the index data is stored and the rendering data of the first LOD model is reused, reducing storage space and lighting baking time.
It saves storage space and lighting baking time, and improves rendering efficiency and development speed.
Smart Images

Figure CN114565709B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data storage management method, an object rendering method and a device. Background Art
[0002] In game scenes, the display of various characters is typically achieved by rendering their models. Therefore, the model's level of detail has a direct impact on the rendering effect. However, high-precision models require significant computational effort, reducing rendering efficiency. Consequently, multiple level-of-detail (LOD) models have emerged. The idea behind LOD is to utilize the varying prominence of characters within the game scene as the game progresses, creating multiple LOD models with varying precision. This allows the rendering of models with the appropriate precision to be selected based on the character's prominence within the scene, effectively improving rendering efficiency while preserving the rendering effect.
[0003] Game developers typically create multiple LOD models for a character separately. Each LOD model has its own set of vertex data, index data, texture data, and lightmaps. Lightmaps are particularly time-consuming to create. As can be seen, current LOD models not only slow down development but also require significant storage space to store these LOD model data. Summary of the Invention
[0004] The present invention provides a data storage management method for rapidly generating multiple level-of-detail (LOD) models and reducing the storage space occupied by multiple LOD models of an object. The present invention also provides corresponding object rendering methods, devices, computer-readable storage media, computer program products, and the like.
[0005] In a first aspect, the present application provides a data storage management method, which can be applied to a terminal device used for game development or animation development. The method includes: obtaining index data of a first multi-level-of-detail (LOD) model, the first LOD model being a preconfigured basic model for rendering a target object, and the index data being used to mark the vertices of the first LOD model; determining the index data of a second LOD model in response to a selection operation on a first simplification ratio, the second LOD model being the LOD model of the target object corresponding to the first simplification ratio, the first simplification ratio representing the ratio of the index data of the second LOD model relative to the index data of the first LOD model, and the vertices of the second LOD model being a subset of the vertices of the first LOD model; and storing the index data of the second LOD model.
[0006] It should be noted that the rendering data of the first LOD model is required in the rendering method provided in this application, but this embodiment does not limit where it comes from or where it is stored. The rendering data of a certain LOD model refers to the data used to render the object of the corresponding precision of the LOD model, and the index data is a type of data pointing to the rendering data. There can be overlap between the two types of data.
[0007] Through the above method, there is no need to store the rendering data of the second LOD model, that is, the simplified model, as in the prior art, only its index data needs to be stored, thereby saving storage space. Especially when there are multiple simplified models, there is no need to store the corresponding rendering data for each simplified model as in the prior art, thus saving storage space to a large extent.
[0008] In this first aspect, the target object can be a character, animal, building, plant, weapon, or other object in a game scene or animation scene. The target object can have multiple LOD models, each with different accuracy. In this application, "multiple" includes two or more, and can also be expressed as at least two.
[0009] The first LOD model is the basic model of the target object. The first LOD model is obtained through pre-configuration. Compared with other LOD models in the multiple LOD models of the target object, the first LOD model has the largest number of vertices. The other LOD models are simplified models obtained based on the first LOD model, and the second LOD model is a simplified model obtained according to the first simplification ratio. It can be understood that simplified models with different degrees of simplification are obtained by selecting different numbers of vertices from the vertices of the first LOD model. Usually, the LOD model is spliced together by triangular facets, wherein each triangular facet has 3 vertices, each vertex has an index value, and the set of index values of these three vertices is the index data of the triangular facet. The number of triangular facets contained in an LOD model is the number of index data of the LOD model.
[0010] In the present application, the simplification ratio represents the ratio of the number of index data in the simplified LOD model to the number of index data in the first LOD model. Because the first LOD model has the most vertices and the most triangles, the first LOD model has the most index data, so the simplification ratio in the present application is less than 1. The operating interface of the developer's terminal device may include multiple simplification ratio selection items or simplification ratio adjustment items. The developer can select the corresponding simplification ratio according to the needs, and the terminal device can determine the index data of the corresponding simplified model according to the simplification ratio. The process of determining the index data of the second LOD model in the present application can be obtained according to the simplification algorithm. The simplification algorithm refers to the topological structure of the reference base model, and reduces the number of triangles in the base model while ensuring that the edge lines and the overall outer surface of the simplified model are stable and without distortion. For example: based on a base model with 100 triangles, the process of obtaining a simplified model according to a simplification ratio of 0.5 can be to evenly hide some vertices based on the model, and then reorganize 50 triangles for the remaining vertices to obtain a simplified model with a simplification ratio of 0.5.
[0011] In this application, because the index data of the second LOD model is obtained through vertex combination, although the vertices in the second LOD model are a subset of the vertices of the first LOD model, the combination relationship of the vertices used to form the triangular facets can be different, so the index data of the second LOD model can be different from the index data of the first LOD model.
[0012] The rendering data of the first LOD model includes vertex data, normal data, texture (UV) coordinates, texture maps and light maps of the first LOD model. Among them, the light map needs to be obtained through light baking, and the light baking time generally takes tens of minutes to tens of hours.
[0013] In the present application, the vertices of the simplified LOD model are a subset of the vertices of the first LOD model. For example, if the first LOD model has 100 vertices and the second LOD model has 50 vertices, then the 50 vertices are selected from the 100 vertices of the first LOD model. Because the rendering data used to render the target object are all related to the vertices, the vertices of the second LOD model are a subset of the vertices of the first LOD model, that is, the second LOD model reuses some of the vertices of the first LOD model, so the rendering data related to the reused vertices can also be reused. In this way, there is no need to generate rendering data for the simplified second LOD model, and there is no need to obtain a light map for the second LOD model through light baking, which saves time for light baking and improves the efficiency of generating the simplified model. In addition, because the simplified LOD model can reuse the rendering data in the first LOD model, for multiple LOD models of a target object, it is only necessary to store the index data of the multiple LOD models in association and then store a copy of the rendering data in the first LOD model. In this way, there is no need to store a complete rendering data for each LOD model, thereby saving storage space.
[0014] In a possible implementation of the first aspect, the method of storing the index data of the second LOD model includes associating the index data of the second LOD model with the index data of the first LOD model, or storing them continuously to facilitate searching.
[0015] In one possible implementation of the first aspect, the step of associating and storing the index data of the second LOD model with the index data of the first LOD model includes storing the index data of the first LOD model in a first storage space and storing the index data of the second LOD model in a second storage space, wherein the last address of the first storage space is adjacent to the first address of the second storage space. In other implementations, the first address of the first storage space is adjacent to the last address of the second storage space.
[0016] In this possible implementation, the first and second storage spaces are contiguous. The index data between the two LOD models can be stored contiguously, with the index data for the second LOD model stored consecutively after the index data for the first LOD model. This simplifies the representation of LOD model index data by using a starting address offset and length.
[0017] In one possible implementation of the first aspect, the method includes: in response to a selection operation for a second simplification scale, determining index data of a third LOD model, where the third LOD model is an LOD model of the target object corresponding to the second simplification scale, the second simplification scale represents a ratio of the index data of the third LOD model relative to the index data of the first LOD model, the vertices of the third LOD model are a subset of the vertices of the first LOD model, and the second simplification scale is smaller than the first simplification scale; and storing the index data of the third LOD model in a third storage space, where the first address of the third storage space is adjacent to the last address of the second storage space. In other implementations, the last address of the third storage space is adjacent to the first address of the second storage space.
[0018] In this possible implementation, if the terminal device receives selection operations for different simplification ratios for the first LOD model, the terminal device will continuously store the index data of the successively generated LOD models in the order in which they are responded to. This simplifies the representation of the LOD model index data.
[0019] In a possible implementation of the first aspect, the method includes: generating a model switching strategy for a target object, the model switching strategy including a switching condition and a switching option, wherein the switching condition represents the relationship between a switching parameter and a switching threshold that triggers the switching of the LOD model of the target object, and the switching option includes a starting address offset value and a length of index data of each LOD model in at least two LOD models, and each LOD model in at least two LOD models is used to render target objects of different precisions; and storing the model switching strategy in association with the index data of each LOD model.
[0020] In this possible implementation, the model switching strategy is used to control the switching of LOD models of different precisions. Wherein, the switching condition can be a comparative relationship between a switching parameter and a switching threshold value. If the switching parameter is greater than the switching threshold value, the first LOD model can be selected. If the switching parameter is less than the switching threshold value, the second LOD model can be selected. Of course, when there are three or more LOD models, there can be multiple switching threshold values. In the present application, the corresponding LOD model can be determined based on the relationship between the switching parameter and the corresponding switching threshold value. This application adopts a continuous storage method when storing the index data of each LOD model, so the storage space of the index data of the LOD model can be indicated by the starting address offset value and length of the index data of each LOD model. Storing the model switching strategy and the index data of each LOD model in association can be beneficial for quickly finding the index data of the corresponding LOD model through the model switching strategy when rendering the target object.
[0021] In a possible implementation of the first aspect, the method includes: encapsulating the model switching strategy, the index data of each associated stored LOD model, and the rendering data of the first LOD model into an application data packet of the target object, and the rendering data of the first LOD model is used to render the target object with the accuracy corresponding to the first LOD model.
[0022] In this possible implementation, the rendering data of the first LOD model is typically the data in the first LOD model excluding the index data of the first LOD model. The target-specific model switching strategy, the associated stored index data of each LOD model, and the rendering data of the first LOD model are encapsulated in an application data package. This allows for rapid installation by downloading the application data package when running a game or animation.
[0023] In a possible implementation of the first aspect, the switching parameters include a screen-to-body ratio or an observation distance; the screen-to-body ratio indicates the ratio of the height of the target object on the screen to the height of the screen; the observation distance indicates the distance from the virtual camera in the application scene to the target object, and the application scene can specifically be a video scene, which includes a game scene or an animation scene.
[0024] In this possible implementation, the screen-to-body ratio can represent the importance of the target object on the screen by the height of the target object on the screen. If the screen-to-body ratio is small, it means that the target object is not important on the screen, and a low-precision LOD model can be used to render the target object. If the screen-to-body ratio is large, it means that the target object is important on the screen, and a high-precision LOD model can be used to render the target object. The observation distance representation can represent the importance of the target object on the screen by the distance between the target object and the virtual camera. If the observation distance is large, it means that the target object is far from the virtual camera, which means that the target object is not important on the screen, and a low-precision LOD model can be used to render the target object. If the observation distance is small, it means that the target object is close to the virtual camera, which means that the target object is important on the screen, and a high-precision LOD model can be used to render the target object. In this way, the requirements for rendering quality can be guaranteed and the rendering efficiency can be improved.
[0025] The second aspect of the present application provides a method for object rendering, which is applied to a terminal device of a game scene or an animation scene. The method includes: obtaining a switching parameter that triggers the switching of a target object's multi-level of detail (LOD) model; determining index data of a target LOD model based on the switching parameter, wherein the target LOD model is one of at least two LOD models corresponding to the target object, and each of the at least two LOD models is used to render a target object of different precision; obtaining target rendering data corresponding to the index data of the target LOD model from the rendering data of the first LOD model, wherein the target rendering data is included in the rendering data of the first LOD model, and the first LOD model is a preconfigured basic model; and rendering the target object of the precision corresponding to the target LOD model based on the target rendering data.
[0026] During the running of an application scenario such as a game or animation, the application data packets of each object in the application scenario can be downloaded to a terminal device, or the application data packets of each object in the application scenario can be stored in a corresponding server. When running a game, for example, when it is necessary to render a target object, the index data of the target LOD model can be determined based on the switching parameters, and then the target rendering data corresponding to the index data of the target LOD model can be obtained from the rendering data of the first LOD model based on the index data of the target LOD model, and then the target object can be rendered based on the target rendering data.
[0027] In this application, other features that are the same as those in the first aspect or the possible implementation of the first aspect can be understood by referring to the definitions in the above-mentioned first aspect or the possible implementation of the first aspect, and will not be repeated here. From the above-mentioned second aspect, it can be seen that because the target LOD model can reuse the rendering data in the first LOD model, the terminal device or server only needs to store the index data of multiple LOD models for a target object, and then store a copy of the data for rendering the target object in the first LOD model. In this way, there is no need to store a complete copy of the rendering data for each LOD model, thereby saving storage space; at the same time, during the rendering process, the rendering data of the target model can reuse the rendering data of the first LOD model, so that there is no need to regenerate rendering data for the target model, such as the illumination map, thereby avoiding the need to re-execute the illumination baking process and other processes, thereby improving rendering efficiency.
[0028] In a possible implementation of the second aspect, the above steps: determining the index data of the target LOD model based on the switching parameters, include: determining the target switching options based on the relationship between the switching parameters and the switching threshold, the target switching options including the starting address offset value and length of the index data of the target LOD model; determining the target storage space of the index data of the target LOD model based on the starting address offset value and length of the index data of the target LOD model; and obtaining the index data of the target LOD model from the target storage space.
[0029] In this possible implementation, the index data for multiple LOD models of the target object is stored contiguously. Therefore, the starting address offset and length of each LOD model's index data can be used to indicate the storage space for that LOD model's index data. This allows for rapid retrieval of the corresponding LOD model's index data from the corresponding storage space, allowing rendering to be completed. Therefore, this possible implementation can improve the efficiency of target object rendering.
[0030] In a possible implementation of the second aspect, the above-mentioned step of: determining the target storage space of the index data of the target LOD model based on the starting address offset value and length of the index data of the target LOD model, includes: determining the starting position of the index data of the target LOD model from the index storage space used to store the index data of the at least two LOD models based on the starting address offset value of the index data of the target LOD model, and the index data of the at least two LOD models are continuously stored in the index storage space in the order obtained by each LOD model in the at least two LOD models; determining the target storage space of the index data of the target LOD model based on the starting position of the index data of the target LOD model and the length of the index data of the target LOD model.
[0031] In this possible implementation, because the index data of multiple LOD models of the target object is stored continuously, the starting position of the target LOD model's index data can be found based on the starting address offset value of the target LOD model's index data, and the storage space for storing the target LOD model's index data can be determined based on the length of the target LOD model's index data. As can be seen from this possible implementation, the index data of the target LOD model can be found using only the starting address offset value and length of the index data, which can improve the efficiency of target object rendering.
[0032] In a possible implementation of the second aspect, the above-mentioned step: after determining the target switching option based on the relationship between the switching parameter and the switching threshold, the method also includes: updating the data in the switching interface to the starting address offset value and length of the index data of the target LOD model, and the switching interface is used to configure the starting address offset value and length of the index data of the LOD model used to update the target object.
[0033] In this possible implementation, the LOD model used can be controlled by switching the interface. In this application, the starting address offset and length of the index data of the selected target LOD model need to be configured in the switching interface. Then, during the rendering process, the target LOD model can be executed. This method of controlling the LOD model used by switching the interface is conducive to accurately controlling the use of LOD models.
[0034] In a possible implementation of the second aspect, the switching parameter includes a screen-to-body ratio or an observation distance; the screen-to-body ratio represents the ratio of the height of the target object on the screen to the height of the screen; the observation distance represents the distance from the virtual camera in the application scene to the target object.
[0035] In this possible implementation, the screen-to-body ratio can represent the importance of the target object on the screen by the height of the target object on the screen. If the screen-to-body ratio is small, it means that the target object is not important on the screen, and a low-precision LOD model can be used to render the target object. If the screen-to-body ratio is large, it means that the target object is important on the screen, and a high-precision LOD model can be used to render the target object. The observation distance representation can represent the importance of the target object on the screen by the distance between the target object and the virtual camera. If the observation distance is large, it means that the target object is far from the virtual camera, which means that the target object is not important on the screen, and a low-precision LOD model can be used to render the target object. If the observation distance is small, it means that the target object is close to the virtual camera, which means that the target object is important on the screen, and a high-precision LOD model can be used to render the target object. In this way, the requirements for rendering quality can be guaranteed and the rendering efficiency can be improved.
[0036] In a possible implementation manner of the second aspect, the target object is a static object in an application scene, and the application scene includes a game scene or an animation scene.
[0037] A third aspect of the present application provides a data storage management device, which has the function of implementing the method of the first aspect or any possible implementation of the first aspect. This function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, such as: an acquisition unit, a response unit, and a storage management unit.
[0038] In a fourth aspect, the present application provides an object rendering device having the functionality to implement the method of the second aspect or any possible implementation of the second aspect. This functionality can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functionality, such as a first acquisition unit, a second acquisition unit, a determination unit, and a rendering unit.
[0039] In a fifth aspect, the present application provides a computer device comprising at least one processor, a memory, an input / output (I / O) interface, and computer-executable instructions stored in the memory and executable by the processor. When the computer-executable instructions are executed by the processor, the processor executes the method according to the first aspect or any possible implementation of the first aspect.
[0040] In a sixth aspect, the present application provides a computer device comprising at least one processor, a memory, an input / output (I / O) interface, and computer-executable instructions stored in the memory and executable by the processor. When the computer-executable instructions are executed by the processor, the processor executes the method according to the second aspect or any possible implementation of the second aspect.
[0041] In a seventh aspect, the present application provides a computer-readable storage medium storing one or more computer-executable instructions. When the computer-executable instructions are executed by a processor, the processor executes a method as described in the first aspect or any possible implementation of the first aspect.
[0042] In an eighth aspect, the present application provides a computer-readable storage medium storing one or more computer-executable instructions. When the computer-executable instructions are executed by a processor, the processor executes a method as described in the second aspect or any possible implementation of the second aspect.
[0043] In a ninth aspect, the present application provides a computer program product storing one or more computer-executable instructions. When the computer-executable instructions are executed by a processor, the processor executes a method as described in the first aspect or any possible implementation of the first aspect.
[0044] The tenth aspect of the present application provides a computer program product that stores one or more computer-executable instructions. When the computer-executable instructions are executed by a processor, the processor executes the method as described in the second aspect or any possible implementation of the second aspect.
[0045] In an eleventh aspect of the present application, a chip system is provided, comprising at least one processor configured to support a data storage management device in implementing the functions described in the first aspect or any one of the possible implementations of the first aspect. In one possible design, the chip system may further comprise a memory configured to store program instructions and data necessary for the data storage management device. The chip system may be comprised of a chip or may include a chip and other discrete components.
[0046] A twelfth aspect of the present application provides a chip system, comprising at least one processor, the at least one processor being used to support an object rendering device in implementing the functions described in the second aspect or any one of the possible implementations of the second aspect. In one possible design, the chip system may further include a memory for storing program instructions and data necessary for the object rendering device. The chip system may be composed of a chip or may include a chip and other discrete components.
[0047] In an embodiment of the present application, for multiple LOD models of the same target object, the vertices in the pre-configured first LOD model can be reused in the simplified LOD model, so the rendering data related to the reused vertices for rendering the target object can also be reused. In this way, there is no need to generate rendering data for the simplified second LOD model, that is, there is no need to obtain a light map for the second LOD model through light baking, which saves time for light baking and improves the efficiency of generating simplified models. In addition, because the simplified LOD model can reuse data other than index data in the first LOD model, for multiple LOD models of a target object, it is only necessary to store the index data of multiple LOD models in an associated manner and then store a copy of the rendering data other than the index data in the first LOD model. In this way, there is no need to store a complete copy of rendering data for each LOD model, thereby saving storage space. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 This is a schematic diagram of the structure of the rendering management system provided by an embodiment of the present application;
[0049] Figure 2 This is a schematic diagram of an embodiment of a data storage management method provided by an embodiment of the present application;
[0050] Figure 3 is a schematic diagram of an operation interface provided in an embodiment of the present application;
[0051] Figure 4A Schematic diagram of a triangular facet of an LOD model provided in an embodiment of the present application;
[0052] Figure 4B is a schematic diagram of a triangular facet of a simplified LOD model provided in an embodiment of the present application;
[0053] Figure 5 This is a storage structure diagram of the index data of the LOD model provided in an embodiment of the present application;
[0054] Figure 6 This is another storage structure diagram of the index data of the LOD model provided in an embodiment of the present application;
[0055] Figure 7 Schematic diagram of the storage structure of multiple LOD models of a target object provided in an embodiment of the present application;
[0056] Figure 8 This is a schematic diagram of an embodiment of object rendering provided by an embodiment of the present application;
[0057] Figure 9 1 is a schematic diagram of an embodiment of a data storage management device provided in an embodiment of the present application;
[0058] Figure 10 1 is a schematic diagram of an embodiment of an apparatus for object rendering provided by an embodiment of the present application;
[0059] Figure 11 This is a schematic diagram of an embodiment of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] The following describes the embodiments of the present application in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present application, rather than all the embodiments. Those skilled in the art will appreciate that with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0061] The terms "first," "second," and the like in the specification and claims of this application and in the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or apparatus.
[0062] Embodiments of the present application provide a data storage management method for rapidly generating multiple level-of-detail (LOD) models and reducing the storage space occupied by the data of multiple LOD models for an object. Embodiments of the present application also provide corresponding object rendering methods, devices, computer-readable storage media, computer program products, etc. These are described in detail below.
[0063] The data storage management method provided in the embodiments of this application can be applied in game development scenarios, and the object rendering method provided in the embodiments of this application can be applied in game running scenarios. Of course, the solution provided in this application is not limited to application in game scenarios, and can also be applied in animation scenarios or other scenarios that can be applied to the solution of this application.
[0064] Whether in a game scene, an animation scene, or other scenes applicable to the present application, developers are required to generate LOD models for objects in each scene in advance. The objects in the embodiments of the present application can be characters, animals, buildings, plants, or weapons in a game scene or an animation scene.
[0065] To facilitate understanding, some features involved in this application are described below.
[0066] Level of Observation (LOD) is a commonly used graphics optimization technique. Considering that objects don't require high-precision models in many scenarios, for example, when an object moves away from the virtual camera, its size decreases and many details gradually blur. Therefore, a low-precision model can be used instead of a high-precision model. In other words, LOD technology provides multiple LOD models of varying precision for a single object. The accuracy of the LOD model used is determined by the object's position and importance on the screen, thereby improving rendering efficiency.
[0067] Models refer to 3D models used in games and animations. Models can be divided into two parts: meshes and textures. The mesh is composed of a series of triangular facets, which is equivalent to the model's "skeleton." Textures include the model's own texture images and lightmaps, which are equivalent to the model's "skin." Based on the respective composition of the mesh and texture, the model's data mainly includes vertex data, index data, normal data, texture (UV) coordinates, texture maps, and lightmaps.
[0068] Mesh: It is a series of triangular facets, including vertex data, index data, normal data, and UV coordinates.
[0069] Vertex data stores the coordinates of the vertices (also called spatial points) required for the model, which are generally 3D.
[0070] Each vertex can be identified by an index value.
[0071] The index data of a triangle includes the index values of the three vertices forming the triangle.
[0072] Normal data specifies the normal direction of each vertex.
[0073] The UV coordinates specify where the texture should be "applied" to the mesh.
[0074] Texture Mapping: Wrap any type of image onto the surface of a 3D model, just like applying a print to a plane, to increase the surface details of the model.
[0075] Lightmap: Obtained by light baking, it stores the lighting results produced by the light source in the scene on the surface of the object, that is, the brightness information of each fragment on the model surface.
[0076] Lighting baking: To ensure realistic lighting in a scene, it's necessary to simulate various lighting conditions, such as the interaction of light sources and light reflections. These lighting calculations are extremely complex, and performing them in real time would significantly reduce system processing efficiency. Therefore, scene lighting results are typically calculated in advance and saved as lightmaps, which can be applied directly to object surfaces during runtime. Due to the complexity of these calculations, light baking typically takes anywhere from tens of minutes to dozens of hours.
[0077] Simplified models: This refers to reducing the number of triangles by changing the mesh information. This results in ignoring local details of the model, reducing model accuracy, but also reducing the amount of computation required by the rendering pipeline when processing vertex data. In this application, simplified models are synonymous with low-precision models.
[0078] Whether this application is applied to a game scene or an animation scene, it will include a development phase and an operation phase. Figure 1The rendering management system shown in the figure usually completes the development phase in the developer's terminal device, and then the application data package (APK) generated in the development phase can be stored in the server. The user can download the corresponding application data package from the server through the terminal device to run the corresponding application scenario, or the terminal device can interact with the server online to run the corresponding application scenario.
[0079] In the embodiment of the present application, the server refers to a physical machine. The terminal device (also referred to as user equipment (UE)) is a device with wireless transceiver function, which can be deployed on land, including indoors or outdoors, handheld or vehicle-mounted; it can also be deployed on the water surface (such as ships, etc.); it can also be deployed in the air (for example, on airplanes, balloons and satellites, etc.). The terminal can be a mobile phone, a tablet computer (pad), a computer with wireless transceiver function, a virtual reality (VR) terminal, an augmented reality (AR) terminal, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, etc.
[0080] As can be seen from the above introduction, LOD technology uses multiple LOD models of different precision to achieve rendering quality while improving rendering efficiency. Therefore, during the development phase, developers need to use a terminal device to generate multiple LOD models of different precision for an object in the application scene, and then store the data of multiple LOD models. The terminal device can be installed with the Unity platform and implemented based on the slim LOD operation interface. The following describes the data storage management method of the embodiment of the present application during the development phase in conjunction with the accompanying drawings.
[0081] like Figure 2 As shown, an embodiment of the present application provides an embodiment of a data storage management method including:
[0082] 101. Obtain index data of a first level-of-detail (LOD) model.
[0083] The first LOD model is a preconfigured basic model for rendering a target object, and the index data is used to mark vertices of the first LOD model.
[0084] The first LOD model is usually prepared in advance by the developer, and the first LOD model can be loaded onto the developer's terminal device.
[0085] 102. In response to a selection operation on the first simplification scale, determine index data of a second LOD model.
[0086] The second LOD model is an LOD model of the target object corresponding to the first simplified scale. The first simplified scale represents the ratio of the index data of the second LOD model relative to the index data of the first LOD model. The vertices of the second LOD model are a subset of the vertices of the first LOD model.
[0087] In the embodiments of the present application, the simplification ratio represents the ratio of the number of index data in the simplified LOD model to the number of index data in the first LOD model. Because the first LOD model has the most vertices and the largest number of triangles, the first LOD model has the most index data. Therefore, the simplification ratio in this application is always less than 1.
[0088] The operating interface of the developer's terminal device may include multiple simplification ratio selection items or simplification ratio adjustment items. The developer may select a corresponding simplification ratio according to needs, and the terminal device may determine the index data of the simplified LOD model according to the simplification ratio.
[0089] The contents displayed on the operation interface can be understood by referring to Table 1.
[0090] Table 1: Contents on the operation interface
[0091] LOD model of the target object Number of triangles Simplified proportions Graphics Preview LOD Model 1 200 1 Click to preview LOD Model 2 100 0.5 Click to preview LOD Model 3 50 0.25 Click to preview
[0092] As can be seen from Table 1 above, LOD model 1 is the basic model of the target object. This LOD model 1 has the largest number of vertices and the largest number of triangles. This LOD model 1 has not been simplified, and the image of the target object corresponding to this LOD model 1 can be viewed by clicking the corresponding preview link. LOD model 2 is a simplified model obtained by simplifying at a simplification ratio of 0.5. The number of triangles in this LOD model 2 is half that of LOD model 1, which is equivalent to only selecting some of the vertices in LOD model 1 to form LOD model 2. The image of the target object corresponding to this LOD model 2 can be viewed by clicking the corresponding preview link. LOD model 3 is a simplified model obtained by simplifying at a simplification ratio of 0.25. The number of triangles in this LOD model 3 is one-fourth that of LOD model 1, which is equivalent to only selecting some of the vertices in LOD model 1 to form LOD model 2. The image of the target object corresponding to this LOD model 3 can be viewed by clicking the corresponding preview link.
[0093] The data and format in this application form 1 are just an example, and the operation interface can also be displayed in other forms, such as Figure 3 As shown, the operation interface includes the basic models of multiple objects, and the number of triangles of each basic model is also displayed. Figure 3 The simplification ratio in is adjustable. You can adjust the simplification ratio through the simplification ratio adjustment item, that is, drag the "button" in the simplification ratio adjustment item to adjust the simplification ratio. Figure 3 The simplified ratio shown is 0.5, but is not limited to Figure 3 The 0.5 in the image can be adjusted to obtain different simplification ratios. After the developer determines the simplification ratio, they can click Preview to display the image of the adjusted target object at that simplification ratio at the bottom of the operation interface.
[0094] Whether it is the method shown in Table 1 or Figure 3 Once the simplification ratio is determined, the index data of the LOD model at that simplification ratio can be determined based on the base model of the target object. This is the set of index values of the three vertices in each triangle of the simplified model. Clicking the "Submit" button on the interface saves the index data of the LOD model at that simplification ratio.
[0095] 103. Store index data of the second LOD model.
[0096] Specifically, the index data of the second LOD model is associated with the index data of the first LOD model and stored.
[0097] The index data of the first LOD model and the index data of the second LOD model can be found in Figure 4A and Figure 4B Understand.
[0098] like Figure 4A As shown, the four vertices with index values of 1, 2, 3 and 4 in the first LOD model can form two triangles, and the index data of these two triangles are (1, 2, 3) and (2, 3, 4) respectively. Figure 4B As shown, the vertices of the second LOD model include three vertices with index values of 1, 3, and 4 belonging to the first LOD model. These three vertices form a triangle, and the index data of this triangle is (1, 3, 4). As can be seen from this example, the index data of the first LOD model is different from the index data of the second LOD model. Of course, the index data of the second LOD model may also partially overlap with the index data of the first LOD model, but they will not be completely the same.
[0099] Although the index data of the first LOD model is different from the index data of the second LOD model, the second LOD model uses the vertices of the first LOD model. Because the data used to render the target object is all vertex-related, the rendering data of the simplified model can be a subset of the rendering data of the base model. Therefore, only one copy of the rendering data of the base model needs to be stored. In addition, by associating and storing the index data of the first LOD model with the index data of the second LOD model, the rendering data corresponding to the first LOD model can be reused in the second LOD model during rendering.
[0100] In an embodiment of the present application, for multiple LOD models of the same target object, the vertices in the pre-configured first LOD model can be reused in the simplified LOD model, so the rendering data related to the reused vertices for rendering the target object can also be reused. In this way, there is no need to generate this rendering data for the simplified second LOD model, thereby improving the efficiency of generating the simplified model. In addition, because the simplified LOD model can reuse the data other than the index data in the first LOD model, for multiple LOD models of a target object, it is only necessary to store the index data of the multiple LOD models in association, and then store a copy of the rendering data other than the index data in the first LOD model. In this way, there is no need to store a complete copy of the rendering data for each LOD model, thereby saving storage space.
[0101] Optionally, the above-mentioned method of associating and storing the index data of the second LOD model with the index data of the first LOD model can be: storing the index data of the first LOD model in a first storage space, and storing the index data of the second LOD model in a second storage space, and the last address of the first storage space is adjacent to the first address of the second storage space.
[0102] In the embodiment of the present application, the first storage space and the second storage space are continuous, with the last address of the first storage space and the first address of the second storage space being two consecutive addresses. This solution allows the index data of the second LOD model to be stored consecutively after the index data of the first LOD model. In this way, the index data for each LOD model can be represented by a starting address offset value and length, which can simplify the representation of the LOD model index data.
[0103] The starting address offset value is a relative offset value. If the starting address of the first storage space where the first LOD model is located is 0, then the starting address offset value of the index data of the first LOD model is 0. If the starting address of the first storage space where the first LOD model is located is S, then the starting address offset value of the index data of the first LOD model is S. The length of the index data refers to the address length of all index data contained in a LOD model in the storage space.
[0104] When storing in association, the storage format of the index data of the first LOD model and the index data of the second LOD model can be referred to Figure 5 Understand. Figure 5 As shown, the starting address offset value of the index data of the first LOD model is S, and the length of the index data of the first LOD model is len1. The starting address offset value of the index data of the second LOD model is M, and the length of the index data of the first LOD model is len2. Because the index data of the first LOD model and the index data of the second LOD model are stored consecutively, M = S + len1.
[0105] In an embodiment of the present application, there may be multiple simplified models for the same target object. During the development phase, the terminal device responds to selection operations for different simplification ratios to obtain LOD models corresponding to different simplification ratios. For example, optionally, the terminal device responds to the selection operation for the second simplification ratio to determine the index data of the third LOD model, where the third LOD model is the LOD model of the target object corresponding to the second simplification ratio, the second simplification ratio represents the ratio of the index data of the third LOD model to the index data of the first LOD model, the vertices of the third LOD model are a subset of the vertices of the first LOD model, and the second simplification ratio is smaller than the first simplification ratio; the index data of the third LOD model is stored in a third storage space, where the first address of the third storage space is adjacent to the last address of the second storage space.
[0106] In the embodiment of the present application, the process of determining the index data of the third LOD model can be understood by referring to the process of obtaining the index data of the second LOD model. The index data of the third LOD model can be stored after the index data of the second LOD model, and the storage format can be referred to. Figure 6 Understand. Figure 6 As shown, the starting address offset value of the index data of the third LOD model is D, where D=S+len1+len2, and the length of the index data of the third LOD model is len3.
[0107] Optionally, the data storage management method provided in an embodiment of the present application also includes: generating a model switching strategy for the target object, the model switching strategy including a switching condition and a switching option, wherein the switching condition represents the relationship between the switching parameter and the switching threshold that triggers the LOD model switching of the target object, and the switching option includes the starting address offset value and length of the index data of each LOD model in at least two LOD models, and each LOD model in at least two LOD models is used to render target objects of different precisions; and the model switching strategy and the index data of each LOD model are associated and stored.
[0108] In an embodiment of the present application, a model switching strategy is used to control the switching of LOD models of different precisions. The switching condition can be a comparison relationship between a switching parameter and a switching threshold. If the switching parameter is greater than the switching threshold, the first LOD model can be selected. If the switching parameter is less than the switching threshold, the second LOD model can be selected. An example of the model switching strategy of an embodiment of the present application can be expressed as:
[0109]
[0110] Wherein, If(pixelsize<=R) represents the switching condition, pixelsize represents the switching parameter, and R represents the switching threshold. {sdp.indexCount=len2; sdp.indexStart=S+len1;}else{sdp.indexCount=len1; sdp.indexStart=} represents the switching option.
[0111] In an embodiment of the present application, the switching parameters include screen-to-body ratio or observation distance; the screen-to-body ratio represents the ratio of the height of the target object on the screen to the height of the screen; the observation distance represents the distance from the virtual camera in the application scene to the target object, and the application scene includes a game scene or an animation scene.
[0112] The screen-to-body ratio can represent the importance of the target object on the screen by the height of the target object on the screen. If the screen-to-body ratio is small, it means that the target object is not important on the screen, and a low-precision LOD model can be used to render the target object. If the screen-to-body ratio is large, it means that the target object is important on the screen, and a high-precision LOD model can be used to render the target object. The observation distance can represent the importance of the target object on the screen by the distance between the target object and the virtual camera. If the observation distance is large, it means that the target object is far from the virtual camera, which means that the target object is not important on the screen, and a low-precision LOD model can be used to render the target object. If the observation distance is small, it means that the target object is close to the virtual camera, which means that the target object is important on the screen, and a high-precision LOD model can be used to render the target object. In this way, the requirements for rendering quality can be guaranteed and the rendering efficiency can be improved.
[0113] Of course, the above description uses only one switching threshold and two LOD model start address offsets and lengths as examples. In practice, when there are three or more LOD models, multiple switching thresholds can be used. For each target object, the above model switching strategy can be stored as a component associated with the index data of the target object's multiple LOD models.
[0114] The representation of this storage relationship can be found in Figure 7Understand. Figure 7 As shown in the figure, for n target objects in a scene, each target object has three LOD models, represented by LOD model 1, LOD model 2, and LOD model 3 respectively. Among them, LOD model 1 is the basic model, and LOD model 2 and LOD model 3 are simplified models. When storing, all the data of LOD model 1 can be stored, and only the index data can be stored for LOD model 2 and LOD model 3. The switching control strategy of each target object is then stored in an associated manner. In this way, the vertex data, discovery data, UV data, texture data, and light map data of the two simplified models can be saved, saving a lot of storage space while ensuring that multiple LOD models can be used normally.
[0115] In an embodiment of the present application, the model switching strategy, the index data of each LOD model stored in association, and the rendering data of the first LOD model can also be encapsulated into an application data packet of the target object. The rendering data of the first LOD model is used to render the target object with the accuracy corresponding to the first LOD model. The rendering data of the first LOD model can also be understood as the data in the first LOD model other than the index data of the first LOD model.
[0116] After the application data package of the target object in the application scenario is generated in the above development phase, the application data package can be uploaded to Figure 1 The server in the application, and then when the user's terminal device uses the application, it can download a series of application data packets of the application scenario from the server, execute the running process, and switch different LOD models when the target object is at different levels of importance to render the target object. Figure 8 The object rendering process provided by the embodiment of the present application is introduced.
[0117] like Figure 8 As shown, an embodiment of the object rendering method provided by the embodiment of the present application includes:
[0118] 201. Obtain switching parameters for triggering switching of a target object's level of detail (LOD) model.
[0119] In an embodiment of the present application, the switching parameters include screen-to-body ratio or observation distance; the screen-to-body ratio represents the ratio of the height of the target object on the screen to the height of the screen; the observation distance represents the distance from the virtual camera in the application scene to the target object, and the application scene includes a game scene or an animation scene.
[0120] The screen-to-body ratio can be used to represent the importance of an object on the screen by its height on the screen. A small screen-to-body ratio indicates that the object is not important on the screen, so a low-precision LOD model can be used to render the object. A large screen-to-body ratio indicates that the object is important on the screen, so a high-precision LOD model can be used to render the object.
[0121] The observation distance can be used to represent the importance of the target object on the screen by its distance from the virtual camera. A large observation distance indicates that the target object is far from the virtual camera and is not important on the screen, so a low-precision LOD model can be used to render the target object. A small observation distance indicates that the target object is close to the virtual camera and is important on the screen, so a high-precision LOD model can be used to render the target object.
[0122] 202. Determine the index data of the target LOD model according to the switching parameters.
[0123] The target LOD model is one of at least two LOD models corresponding to the target object, and each LOD model of the at least two LOD models is used to render the target object with different precision.
[0124] 203. Obtain target rendering data corresponding to the index data of the target LOD model from the rendering data of the first LOD model. The target rendering data is included in the rendering data of the first LOD model, and the first LOD model is a preconfigured basic model.
[0125] 204. Render the target object with a precision corresponding to the target LOD model according to the target rendering data.
[0126] In an embodiment of the present application, because the target LOD model can reuse the data in the first LOD model except the index data, the terminal device or server only needs to store the index data of multiple LOD models in association with each other for multiple LOD models of a target object, and then store a copy of the data in the first LOD model except the index data for rendering the target object. In this way, there is no need to store a complete copy of rendering data for each LOD model, thereby saving storage space.
[0127] Optionally, the above step 202 may include: determining the target switching option based on the relationship between the switching parameter and the switching threshold, the target switching option including the starting address offset value and length of the index data of the target LOD model; determining the target storage space of the index data of the target LOD model based on the starting address offset value and length of the index data of the target LOD model; and obtaining the index data of the target LOD model from the target storage space.
[0128] Optionally, the above-mentioned determination of the target storage space of the index data of the target LOD model based on the starting address offset value and length of the index data of the target LOD model includes: determining the starting position of the index data of the target LOD model from the index storage space used to store the index data of the at least two LOD models according to the starting address offset value of the index data of the target LOD model, and the index data of the at least two LOD models are continuously stored in the index storage space in the order obtained by each LOD model in the at least two LOD models; determining the target storage space of the index data of the target LOD model according to the starting position of the index data of the target LOD model and the length of the index data of the target LOD model.
[0129] In the embodiment of the present application, the index data of multiple LOD models of the target object are stored in a continuous storage manner, for example: Figure 5 and Figure 6 The storage method shown, therefore, can indicate the storage space of the index data of each LOD model by the starting address offset value and length of the index data of the LOD model. For example: the first storage space can be found by S and len1, and the second storage space can be found by M and len2, thereby obtaining the index data of the target LOD model from the corresponding target storage space. Because the target storage space can be quickly determined by the starting address offset value and length of the index data of the LOD model, the index data of the corresponding LOD model can be quickly found from the corresponding storage space, and then the rendering is completed. Therefore, this possible implementation method can improve the efficiency of rendering the target object.
[0130] Optionally, an embodiment of the present application also includes: updating the data in the switching interface to the starting address offset value and length of the index data of the target LOD model, and the switching interface is used to configure the starting address offset value and length of the index data of the LOD model used to update the target object.
[0131] In the embodiment of the present application, the LOD model used can be controlled by switching the interface. In this application, the starting address offset value and length of the index data of the selected target LOD model need to be configured in the switching interface. Then, during the rendering process, the target LOD model can be executed. This method of controlling the LOD model used by switching the interface is conducive to accurately controlling the use of LOD models.
[0132] This process can be understood by referring to the example of the switching control strategy mentioned above. The switching interface can include SubMeshDescriptor and Mesh.SetSubMesh. The starting address offset value and length of the target LOD model's index data are written to the SubMeshDescriptor interface, and then the Mesh.SetSubMesh interface is used to take effect. In this way, when rendering is executed, the target LOD model will be used to render the target object.
[0133] During the testing phase, developers conducted a large number of experiments to verify the impact of this application's solution on the size and frame rate of application data packets.
[0134] During the testing process, a forest scene from a real game was selected for testing. The total number of objects in the scene was 209, and the total number of triangles was 745.2 thousand (k). The simplified model effect was analyzed when the simplification ratio of the objects and the screen-to-body ratio were fixed as the switching thresholds. Regarding the simplification ratio and screen-to-body ratio, for example, when the simplification ratio is set to 0.5, it means that the number of triangles in the model is expected to be simplified to 50% of the original number of triangles. The final effect may be somewhat different from the expected effect. When the screen-to-body ratio is used as the switching threshold, if the switching threshold is set to 0.35, it means that during operation, if the height of the pixels occupied by the object in the scene is less than 35% of the screen height, the simplified model is used; otherwise, the original model is used.
[0135] The simplification ratio is fixed at 0.5, and the screen-to-body ratio is adjusted. The experimental results are shown in Table 2.
[0136] Table 2: Experimental results
[0137] screen-to-body ratio APK(M) Tris(k) Frame rate Origin 58.57 745.2 37.23 0.35 60.71 374.4 41.93 0.3 60.71 381.0 41.16 0.25 60.71 386.6 41.28
[0138] According to the data in Table 2, when the screen-to-body ratio is set to the initial value, the LOD model's APK size is 58.57 megabytes (M), the number of triangles (Tris) is 745.2k, and the frame rate is 37.23. When the simplification ratio is 0.5, the data when the switching threshold is set to 0.35, 0.3, or 0.25 can be found in the last three rows of Table 2. In this scenario, a comparison of the last three rows with the data when the screen-to-body ratio is set to the initial value shows that using the LOD optimization method provided by this solution only increases the application data package (APK) size by approximately 2M. When the LOD switching threshold is set to 0.35, a 4-frame gain is achieved. As the screen-to-body ratio decreases, the frame rate decreases slightly, but not significantly.
[0139] The screen ratio of LOD switching is fixed to 0.35, and the simplification ratio is adjusted. The experimental results are shown in Table 3.
[0140] Table 3: Experimental results
[0141] Simplified proportions APK(M) Tris(k) Frame rate Origin 58.57 745.2 37.23 0.5 60.71 374.4 41.93 0.4 60.57 302.4 45.18 0.3 60.46 246.4 45.9
[0142] As shown in Table 3, increasing the model simplification ratio further reduces the APK package size and significantly improves the frame rate. When the simplification ratio is reduced to 0.3, the frame rate can be increased by approximately 8 frames.
[0143] The above describes the data storage management method in the development phase and the object rendering method in the runtime phase. The device provided in the embodiment of the present application is described below with reference to the accompanying drawings.
[0144] like Figure 9 As shown, an embodiment of the data storage management device 30 provided in an embodiment of the present application includes:
[0145] The acquisition unit 301 is configured to acquire index data of a first level-of-detail (LOD) model, where the first LOD model is a preconfigured basic model for rendering a target object, and the index data is used to mark vertices of the first LOD model.
[0146] The response unit 302 is used to determine the index data of the second LOD model in response to the selection operation of the first simplification ratio, where the second LOD model is the LOD model of the target object corresponding to the first simplification ratio, the first simplification ratio represents the ratio of the index data of the second LOD model relative to the index data of the first LOD model, and the vertices of the second LOD model are a subset of the vertices of the first LOD model.
[0147] The storage management unit 303 is configured to store the index data of the second LOD model. Specifically, the storage management unit 303 is configured to associate and store the index data of the second LOD model with the index data of the first LOD model.
[0148] In an embodiment of the present application, for multiple LOD models of the same target object, the vertices in the pre-configured first LOD model can be reused in the simplified LOD model, so the rendering data related to the reused vertices for rendering the target object can also be reused. In this way, there is no need to generate this rendering data for the simplified second LOD model, thereby improving the efficiency of generating the simplified model. In addition, because the simplified LOD model can reuse the data other than the index data in the first LOD model, for multiple LOD models of a target object, it is only necessary to store the index data of the multiple LOD models in association, and then store a copy of the rendering data other than the index data in the first LOD model. In this way, there is no need to store a complete copy of the rendering data for each LOD model, thereby saving storage space.
[0149] Optionally, the storage management unit 303 is configured to store the index data of the first LOD model in a first storage space and the index data of the second LOD model in a second storage space, and the last address of the first storage space is adjacent to the first address of the second storage space.
[0150] Optionally, the response unit 302 is further used to determine the index data of the third LOD model in response to the selection operation of the second simplification ratio, the third LOD model is the LOD model of the target object corresponding to the second simplification ratio, the second simplification ratio represents the ratio of the index data of the third LOD model relative to the index data of the first LOD model, the vertices of the third LOD model are a subset of the vertices of the first LOD model, and the second simplification ratio is smaller than the first simplification ratio.
[0151] The storage management unit 303 is further configured to store the index data of the third LOD model in a third storage space, where the first address of the third storage space is adjacent to the last address of the second storage space.
[0152] Optionally, the data storage management device 30 also includes a processing unit, which is used to generate a model switching strategy for the target object, the model switching strategy including a switching condition and a switching option, wherein the switching condition represents the relationship between the switching parameter and the switching threshold that triggers the LOD model switching of the target object, and the switching option includes the starting address offset value and length of the index data of each LOD model in at least two LOD models, and each LOD model in at least two LOD models is used to render target objects with different precision.
[0153] The storage management unit 303 is further configured to associate and store the model switching strategy with the index data of each LOD model.
[0154] Optionally, the processing unit is further configured to encapsulate the model switching strategy, the associated stored index data of each LOD model, and the rendering data of the first LOD model into an application data packet of the target object, wherein the rendering data of the first LOD model is used to render the target object with the accuracy corresponding to the first LOD model. It can also be understood that the rendering data of the first LOD model is the data in the first LOD model excluding the index data of the first LOD model.
[0155] Optionally, the switching parameters include screen ratio or observation distance; the screen ratio represents the ratio of the height of the target object on the screen to the height of the screen; the observation distance represents the distance from the virtual camera in the application scene to the target object, and the application scene includes a game scene or an animation scene.
[0156] The data storage management device 30 described above can be understood by referring to the corresponding description in the aforementioned method embodiment part, and will not be repeated here.
[0157] like Figure 10 As shown, an embodiment of the object rendering device 40 provided in the embodiment of the present application includes:
[0158] The first acquisition unit 401 is configured to acquire a switching parameter for triggering the switching of a level-of-detail (LOD) model of a target object.
[0159] The determination unit 402 is used to determine the index data of the target LOD model according to the switching parameter, where the target LOD model is one of at least two LOD models corresponding to the target object, and each of the at least two LOD models is used to render the target object with different precision.
[0160] The second acquiring unit 403 is further configured to acquire target rendering data corresponding to the index data of the target LOD model from the rendering data of the first LOD model, where the target rendering data is included in the rendering data of the first LOD model, and the first LOD model is a preconfigured basic model.
[0161] The rendering unit 404 is configured to render the target object with a precision corresponding to the target LOD model according to the target rendering data.
[0162] In an embodiment of the present application, because the target LOD model can reuse the data in the first LOD model except the index data, the terminal device or server only needs to store the index data of multiple LOD models in association with each other for multiple LOD models of a target object, and then store a copy of the data in the first LOD model except the index data for rendering the target object. In this way, there is no need to store a complete copy of rendering data for each LOD model, thereby saving storage space.
[0163] Optionally, the determination unit 402 is used to determine the target switching option based on the relationship between the switching parameter and the switching threshold, the target switching option including the starting address offset value and length of the index data of the target LOD model; determine the target storage space of the index data of the target LOD model based on the starting address offset value and length of the index data of the target LOD model; and obtain the index data of the target LOD model from the target storage space.
[0164] Optionally, the determination unit 402 is used to determine the starting position of the index data of the target LOD model from the index storage space used to store the index data of at least two LOD models based on the starting address offset value of the index data of the target LOD model, and the index data of the at least two LOD models are stored continuously in the index storage space in the order obtained by each LOD model in the at least two LOD models; based on the starting position of the index data of the target LOD model and the length of the index data of the target LOD model, the target storage space of the index data of the target LOD model is determined.
[0165] Optionally, the determination unit 402 is further used to update the data in the switching interface to the starting address offset value and length of the index data of the target LOD model, and the switching interface is used to configure the starting address offset value and length of the index data of the LOD model used to update the target object.
[0166] Optionally, the switching parameters include screen ratio or observation distance; the screen ratio represents the ratio of the height of the target object on the screen to the height of the screen; the observation distance represents the distance from the virtual camera in the application scene to the target object.
[0167] Optionally, the target object is a static object in an application scene, and the application scene includes a game scene or an animation scene.
[0168] The object rendering device 40 described above can be understood by referring to the corresponding description in the aforementioned method embodiment part, and will not be repeated here.
[0169] Figure 11 FIG. 5 is a diagram showing a possible logical structure of a computer device 50 provided in an embodiment of the present application. The computer device 50 may be the aforementioned data storage management device 30 or object rendering device 40, and the computer device 50 includes: a processor 501, a communication interface 502, a memory 503, and a bus 504. The processor 501, the communication interface 502, and the memory 503 are interconnected via the bus 504. In an embodiment of the present application, the processor 501 is used to control and manage the actions of the computer device 50, for example, the processor 501 is used to execute Figures 2 to 8 In steps 101 to 103 and 201 to 204 of the method embodiment, the communication interface 502 is used to support the computer device 50 to communicate. The memory 503 is used to store program codes and data of the computer device 50.
[0170] Among them, the processor 501 may include a central processing unit (CPU) and a graphics processing unit (GPU), and the CPU may also be replaced by a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute the various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 501 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and so on. The bus 504 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, and the like. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, Figure 11 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0171] In another embodiment of the present application, a computer-readable storage medium is further provided. The computer-readable storage medium stores computer-executable instructions. When the processor of the device executes the computer-executable instructions, the device executes the above-mentioned Figures 2 to 7 Methods of storing data in .
[0172] In another embodiment of the present application, a computer-readable storage medium is further provided. The computer-readable storage medium stores computer-executable instructions. When the processor of the device executes the computer-executable instructions, the device executes the above-mentioned Figure 8 Method for rendering objects in .
[0173] In another embodiment of the present application, a computer program product is further provided. The computer program product includes computer-executable instructions stored in a computer-readable storage medium. When the processor of the device executes the computer-executable instructions, the device executes the above-mentioned Figures 2 to 7 Methods for managing data storage in .
[0174] In another embodiment of the present application, a computer program product is further provided. The computer program product includes computer-executable instructions stored in a computer-readable storage medium. When the processor of the device executes the computer-executable instructions, the device executes the above-mentioned Figure 8 Method for rendering objects in .
[0175] In another embodiment of the present application, a chip system is further provided, the chip system including a processor, the processor being used to support the memory management device to implement the above Figures 2 to 7 In one possible design, the chip system may also include a memory for storing program instructions and data necessary for memory management. The chip system may consist of a chip alone or include a chip and other discrete components.
[0176] In another embodiment of the present application, a chip system is further provided, the chip system including a processor, the processor being used to support the memory management device to implement the above Figure 8 In one possible design, the chip system may also include a memory for storing program instructions and data necessary for memory management. The chip system may consist of a chip or may include a chip and other discrete components.
[0177] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of this application.
[0178] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0179] In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0180] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0181] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0182] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium 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 all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0183] The above is only a specific implementation of the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited to this.
Claims
1. A data storage management method, characterized in that: include: Obtaining index data of a first LOD model, where the first LOD model is a preconfigured base model for rendering a target object, and the index data of the first LOD model is used to mark vertices of the first LOD model; In response to a selection operation for a first simplification scale, index data of a second LOD model is determined, where the second LOD model is an LOD model of the target object corresponding to the first simplification scale, the first simplification scale represents a ratio of the index data of the second LOD model relative to the index data of the first LOD model, and vertices of the second LOD model are a subset of vertices of the first LOD model; The index data of the second LOD model is stored, wherein the rendering data of the second LOD model reuses the rendering data of the first LOD model.
2. The method according to claim 1, characterized in that The storing the index data of the second LOD model includes: storing the index data of the second LOD model in association with the index data of the first LOD model.
3. The method according to claim 2, characterized in that The associating and storing the index data of the second LOD model with the index data of the first LOD model includes: The index data of the first LOD model is stored in a first storage space, and the index data of the second LOD model is stored in a second storage space, wherein the last address of the first storage space is adjacent to the first address of the second storage space.
4. The method according to claim 3, characterized in that The method further comprises: In response to a selection operation for a second simplification scale, index data of a third LOD model is determined, where the third LOD model is an LOD model of the target object corresponding to the second simplification scale, the second simplification scale represents a ratio of the index data of the third LOD model relative to the index data of the first LOD model, vertices of the third LOD model are a subset of vertices of the first LOD model, and the second simplification scale is smaller than the first simplification scale; The index data of the third LOD model is stored in a third storage space, where a first address of the third storage space is adjacent to a last address of the second storage space.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Generating a model switching strategy for the target object, the model switching strategy including a switching condition and a switching option, wherein the switching condition represents a relationship between a switching parameter and a switching threshold that triggers the switching of the LOD model of the target object, and the switching option includes a starting address offset value and a length of index data of each LOD model in at least two LOD models, each of the at least two LOD models being used to render the target object with different precisions; The model switching strategy and the index data of each LOD model are associated and stored.
6. The method according to claim 5, characterized in that The method further comprises: The model switching strategy, the index data of each LOD model, and the rendering data of the first LOD model are encapsulated as an application data packet of the target object, and the rendering data of the first LOD model is used to render the target object with the accuracy corresponding to the first LOD model.
7. The method according to claim 5, characterized in that The switching parameters include screen ratio or viewing distance; The screen ratio represents the ratio of the height of the target object on the screen to the height of the screen; The observation distance represents the distance from a virtual camera in an application scene to the target object, and the application scene includes a game scene or an animation scene.
8. A method for object rendering, characterized in that: include: Get the switching parameters that trigger the target object's LOD model switching; Determining index data of a target LOD model according to the switching parameter, where the target LOD model is one of at least two LOD models corresponding to the target object, and each LOD model of the at least two LOD models is used to render the target object with different precision; Acquire target rendering data corresponding to the index data of the target LOD model from rendering data of a first LOD model, wherein the first LOD model is a preconfigured base model; The target object is rendered with a precision corresponding to the target LOD model according to the target rendering data.
9. The method according to claim 8, characterized in that Determining the index data of the target LOD model according to the switching parameter includes: Determining a target switching option according to a relationship between the switching parameter and the switching threshold, the target switching option including a starting address offset value and a length of index data of the target LOD model; Determining a target storage space for the index data of the target LOD model according to a starting address offset value and a length of the index data of the target LOD model; The index data of the target LOD model is obtained from the target storage space.
10. The method according to claim 9, characterized in that The determining, according to the starting address offset value and length of the index data of the target LOD model, a target storage space of the index data of the target LOD model comprises: determining, based on a starting address offset value of the index data of the target LOD model, a starting position of the index data of the target LOD model from an index storage space for storing the index data of the at least two LOD models, the index data of the at least two LOD models being consecutively stored in the index storage space in an order in which each of the at least two LOD models is obtained; A target storage space for the index data of the target LOD model is determined according to a starting position of the index data of the target LOD model and a length of the index data of the target LOD model.
11. The method according to claim 9, characterized in that After determining the target switching option according to the relationship between the switching parameter and the switching threshold, the method further includes: The data in the switching interface is updated to the starting address offset value and length of the index data of the target LOD model, and the switching interface is used to configure the starting address offset value and length of the index data of the LOD model used to update the target object.
12. The method according to any one of claims 8 to 11, characterized in that The switching parameters include screen ratio or viewing distance; The screen ratio represents the ratio of the height of the target object on the screen to the height of the screen; The observation distance represents the distance from a virtual camera in the application scene to the target object.
13. The method according to any one of claims 8 to 11, characterized in that: The target object is a static object in an application scene, and the application scene includes a game scene or an animation scene.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by one or more processors, the method according to any one of claims 1 to 7 is implemented.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by one or more processors, the method according to any one of claims 8 to 13 is implemented.
16. A computing device, characterized in that comprising one or more processors and a computer-readable storage medium storing a computer program; The one or more processors are coupled to the computer-readable storage medium, and when the computer program is executed by the one or more processors, the method according to any one of claims 1 to 7 is implemented.
17. A computing device, characterized in that comprising one or more processors and a computer-readable storage medium storing a computer program; The one or more processors are coupled to the computer-readable storage medium, and when the computer program is executed by the one or more processors, the method according to any one of claims 8 to 13 is implemented.
18. A chip system, characterized in that: The method comprises one or more processors, wherein the one or more processors are called to execute the method according to any one of claims 1 to 7.
19. A chip system, characterized in that: The method comprises one or more processors, wherein the one or more processors are called to execute the method according to any one of claims 8 to 13.
20. A computer program product, characterized in that The invention comprises a computer program for implementing the method according to any one of claims 1 to 7 when the computer program is executed by one or more processors.
21. A computer program product, characterized in that The invention comprises a computer program for implementing the method according to any one of claims 8 to 13 when the computer program is executed by one or more processors.
Citation Information
Patent Citations
A game detail level processing method and system
CN109887093A
Top color baking processing method and device, electronic equipment and storage medium
CN116681817A