WO2022100059A1 - 一种数据存储的管理方法、对象渲染的方法及设备 - Google Patents

一种数据存储的管理方法、对象渲染的方法及设备 Download PDF

Info

Publication number
WO2022100059A1
WO2022100059A1 PCT/CN2021/096294 CN2021096294W WO2022100059A1 WO 2022100059 A1 WO2022100059 A1 WO 2022100059A1 CN 2021096294 W CN2021096294 W CN 2021096294W WO 2022100059 A1 WO2022100059 A1 WO 2022100059A1
Authority
WO
WIPO (PCT)
Prior art keywords
lod
model
lod model
index data
target
Prior art date
Application number
PCT/CN2021/096294
Other languages
English (en)
French (fr)
Inventor
陈兴华
魏晨
李振鹏
张泽
周臻
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP21890590.9A priority Critical patent/EP4231243A4/en
Publication of WO2022100059A1 publication Critical patent/WO2022100059A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
    • A63F13/69Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor by enabling or updating specific game elements, e.g. unlocking hidden features, items, levels or versions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/20Finite element generation, e.g. wire-frame surface description, tesselation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/36Level of detail

Definitions

  • 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.
  • LOD multi-level of detail
  • LOD models for a character are usually made by game developers separately, and each LOD model has an independent set of vertex data, index data, texture data and lightmaps. Among them, the lightmaps are particularly time-consuming to obtain. It can be seen that the current LOD models not only affect the development speed, but also require a large storage space to store the data of these LOD models.
  • An embodiment of the present application provides a data storage management method, which is used to quickly obtain a multi-level of detail (level of detail, LOD) model, and reduce the occupation of storage space by data of multiple LOD models of an object.
  • Embodiments of the present application also provide a corresponding object rendering method, device, computer-readable storage medium, computer program product, and the like.
  • a first aspect of 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: acquiring index data of a first multi-level of detail LOD model, the first LOD model is a preconfigured basic model for rendering the target object, and the index data is used to mark the vertices of the first LOD model; in response to the selection operation on the first simplified scale, the index data of the second LOD model is determined, and the second LOD model is The target object corresponds to the LOD model of the first simplified scale, the first simplified scale represents the ratio of the index data of the second LOD model to the index data of the first LOD model, and the vertices of the second LOD model are the vertices of the first LOD model. Subset; stores the index data of the second LOD model.
  • the rendering data of the first LOD model is required in the rendering method provided by the present 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
  • the index data is a kind of data pointing to the rendering data, and there may be overlap between the two kinds of data.
  • the target object may be an object such as a character, an animal, a building, a plant or a weapon in a game scene or an animation scene.
  • the target object may have multiple LOD models, and the accuracy of each LOD model is different.
  • “multiple” includes two or more, and can also be expressed as at least two.
  • the first LOD model is the basic model of the target object, and the first LOD model is obtained by pre-configuration. Compared with other LODO types in the multiple LOD models of the target object, the first LOD model has the largest number of vertices. .
  • 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 simplified scale. It can be understood that different numbers of vertices are selected from the vertices of the first LOD model to obtain simplified models with different degrees of simplification.
  • the LOD model is spliced by triangular patches, in which each triangular patch has 3 vertices, each vertex has an index value, and the set composed of the index values of the three vertices is the triangular patch. index data.
  • the number of triangular patches included in an LOD model is the number of index data of the LOD model.
  • the simplified 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 largest number of vertices and the largest number of triangular patches, the first LOD model has the largest number of index data. Therefore, the simplification ratio in this application is all less than 1.
  • the operation interface of the developer's terminal device may include multiple simplified scale selection items or simplified scale adjustment items. The developer can select the corresponding simplified scale according to requirements, and the terminal device can determine the index data of the corresponding simplified model according to the simplified scale.
  • the process of determining the index data of the second LOD model in this application can be obtained according to a simplified algorithm
  • the simplified algorithm refers to the topology structure of the reference basic model, and the edge lines and the overall outer surface of the simplified model are guaranteed to be stable, and there is no Reduce the number of triangular patches in the base model without distorting it.
  • the process of obtaining a simplified model according to the simplified scale of 0.5 can be based on the model, evenly hiding some vertices, and then rebuilding 50 triangular patches for the remaining vertices, A simplified model at a reduced scale of 0.5 is obtained.
  • the index data of the second LOD model is obtained by combining vertices, although the vertices in the second LOD model are subsets of the vertices of the first LOD model, the combination relationship of the vertices used to form the triangular patch may be different, so the index data of the second LOD model may be different from the index data of the first LOD model.
  • the rendering data of the first LOD model includes vertex data, normal data, texture (UV) coordinates, texture maps, and lightmaps of the first LOD model.
  • the lightmap needs to be obtained by lighting baking. Generally, the lighting baking time takes several hours. Ten minutes to dozens of hours.
  • the vertices of the simplified LOD model are a subset of the vertices of the first LOD model.
  • the first LOD model has 100 vertices
  • the second LOD model has 50 vertices
  • the 50 vertices are selected from the 100 vertices of the first LOD model.
  • the vertices of the second LOD model are a subset of the vertices of the first LOD model, that is to say, the second LOD model reuses part of the vertices of the first LOD model , then the rendering data related to the multiplexed vertices can also be reused, so that there is no need to generate rendering data for the simplified second LOD model, and there is no need to obtain lightmaps for the second LOD model through lighting baking. , which saves time for lighting baking and improves the efficiency of generating simplified models.
  • the simplified LOD model can reuse the rendering data in the first LOD model, for multiple LOD models of a target object, as long as the index data of multiple LOD models are stored in association, and then a copy of the first LOD model is stored. In this way, it is not necessary to store a complete rendering data for each LOD model, thus saving storage space.
  • the manner of 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, or Say continuous storage for easy lookup.
  • the above step: storing the index data of the second LOD model in association with the index data of the first LOD model includes: storing the index data of the first LOD model in the first storage space, the index data of the second LOD model is stored in the second storage space, and the last address of the first storage space is adjacent to the first address of the second storage space.
  • the first address of the first storage space is adjacent to the last address of the second storage space.
  • the first storage space and the second storage space are continuous, and the associated storage of the index data between the two LOD models may be to continuously store the index data of the second LOD model in the first LOD model. After indexing the data.
  • the index data for each LOD model can be represented by the offset value and the length of the starting address, which can simplify the representation of the index data of the LOD model.
  • the method includes: in response to the selection operation on the second simplified scale, determining index data of a third LOD model, where the third LOD model is the target object corresponding to the second simplified scale
  • the LOD model, the second simplified scale 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 simplified scale is less than The first simplified scale
  • the index data of the third LOD model is stored in the third storage space, and 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.
  • the terminal device if the terminal device successively receives selection operations of different simplified scales for the first LOD model, the terminal device will sequentially generate the index data of the LOD model according to the sequence of responses to the different simplified scales. Continuous storage. This simplifies the representation of index data for LOD models.
  • the method includes: generating a model switching strategy for the target object, where the model switching strategy includes a switching condition and a switching option, wherein the switching condition represents a switching that triggers the switching of the LOD model of the target object
  • the switching condition represents a switching that triggers the switching of the LOD model of the target object
  • the switching options include the starting address offset value and length of the index data of each LOD model in the at least two LOD models, and each LOD model in the at least two LOD models is used for rendering with different precisions
  • the target object; the model switching strategy is stored in association with the index data of each LOD model.
  • the model switching strategy is used to control the switching of LOD models with different precisions.
  • the switching condition may be a comparison between the switching parameter and the switching threshold. If the switching parameter is greater than the switching threshold, the first LOD model can be selected, and if the switching parameter is less than the switching threshold, the second LOD model can be selected.
  • the corresponding LOD model may be determined according to the relationship between the handover parameter and the corresponding handover threshold.
  • the present application adopts a continuous storage method when storing the index data of each LOD model, so the storage space of the index data of each LOD model can be indicated by the offset value and length of the starting address of the index data of each LOD model .
  • Storing the model switching strategy in association with the index data of each LOD model can help to quickly find the index data of the corresponding LOD model through the model switching strategy when rendering the target object.
  • the method includes: encapsulating the model switching strategy, the index data of each LOD model stored in association, and the rendering data of the first LOD model into an application data package of the target object, The rendering data of the first LOD model is used to render the target object of the precision corresponding to the first LOD model.
  • the rendering data of the first LOD model is generally data other than the index data of the first LOD model in the first LOD model.
  • the model switching strategy corresponding to the target, the index data of each LOD model stored in association, and the rendering data of the first LOD model are encapsulated in an application data package, so that when running the game or animation, the application data package can be downloaded by Install quickly.
  • the switching parameter includes a screen ratio or a 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 viewing distance represents the virtual distance from the application scene.
  • the distance from the camera to the target object, the application scene may specifically be a video scene, and the video scene includes a game scene or an animation scene.
  • the screen ratio may represent the importance of the target object on the screen by the height of the target object on the screen. If the screen 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 ratio is large, it means that the target object is important in the screen, and a high-precision LOD model can be used to render the target object.
  • the viewing distance indicates that the importance of the target object in the screen can be represented by the distance of the target object from the virtual camera. If the observation distance is large, it means that the target object is far away from the virtual camera, which means that the target object is not important in the screen, and a low-precision LOD model can be used to render the target object.
  • 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 in the screen, and a high-precision LOD model can be used to render the target object. In this way, the demand for rendering quality can be guaranteed, and the rendering efficiency can also be improved.
  • a second aspect of the present application provides an object rendering method, which is applied to a terminal device of a game scene or an animation scene.
  • the method includes: acquiring switching parameters that trigger switching of multi-level-of-detail LOD models of a target object; determining index data of a target LOD model according to the switching parameters, where the target LOD model is one of at least two LOD models corresponding to the target object, at least two Each LOD model in the LOD models is used to render target objects of different precisions; target rendering data corresponding to the index data of the target LOD model is obtained from the rendering data of the first LOD model, and the target rendering data is included in the first LOD model Rendering data, the first LOD model is a pre-configured basic model; according to the target rendering data, the target object with the accuracy corresponding to the target LOD model is rendered.
  • the application data package of each object in the application scenario may be downloaded to the terminal device, or the application data package of each object in the application scenario may be stored in a corresponding server.
  • the index data of the target LOD model can be determined according to the switching parameters, and then the index of the target LOD model can be obtained from the rendering data of the first LOD model according to the index data of the target LOD model.
  • the target LOD model can reuse the rendering data in the first LOD model
  • the terminal device or server only needs to associate and store the index data of multiple LOD models for multiple LOD models of a target object, and then It is enough to store a copy of the data used to render the target object in the first LOD model.
  • the target The rendering data of the model can reuse the rendering data of the first LOD model, so there is no need to regenerate rendering data for the target model, such as a care map, which avoids re-execution of care baking and other processes, and improves rendering efficiency.
  • determining the index data of the target LOD model according to the handover parameter includes: determining the target handover option according to the relationship between the handover parameter and the handover threshold, so Described target switching option comprises the starting address offset value and length of the index data of described target LOD model; The target storage space of the index data; the index data of the target LOD model is obtained from the target storage space.
  • the index data of multiple LOD models of the target object is stored in a continuous manner, so the offset value and length of the start address of the index data of each LOD model can be used to indicate the index data of the target object.
  • the storage space of the index data of the LOD model so as to quickly find the index data of the corresponding LOD model from the corresponding storage space, and then complete the rendering. Therefore, this possible implementation can improve the rendering efficiency of the target object.
  • the above step determining the target storage space of the index data of the target LOD model according to the start address offset value and length of the index data of the target LOD model, including : 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 the at least two LOD models according to the starting address offset value of the index data of the target LOD model , the index data of the at least two LOD models are continuously stored in the index storage space according to the order obtained by each LOD model in the at least two LOD models; 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 to determine the target storage space of the index data of the target LOD model.
  • the target LOD can be found according to the offset value of the starting address of the index data of the target LOD model.
  • the starting position of the index data of the model, and then the storage space for storing the index data of the target LOD model is determined according to the length of the index data of the target LOD model. It can be known from this possible implementation that the index data of the target LOD model can be found only through the two parameters of the start address offset value and the length of the index data, which can improve the rendering efficiency of the target object.
  • the above step after determining the target handover option according to the relationship between the handover parameter and the handover threshold, the method further includes: updating the data in the handover interface to the target The starting address offset value and length of the index data of the LOD model, and the switching interface is configured to update the starting address offset value and length of the index data of the LOD model used by the target object.
  • the adopted LOD model can be controlled by switching the interface.
  • the start address offset value and length of the index data of the selected target LOD model need to be configured in the switching interface. , then in the rendering process, the target LOD model can be executed.
  • This method of controlling the adopted LOD model by switching the interface is beneficial to accurately control the use of the LOD model.
  • the switching parameter includes a screen ratio or a viewing distance; the screen ratio represents the ratio of the height of the target object in the screen to the height of the screen; the The observation distance represents the distance from the virtual camera in the application scene to the target object.
  • the screen ratio may represent the importance of the target object on the screen by the height of the target object on the screen. If the screen 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 ratio is large, it means that the target object is important in the screen, and a high-precision LOD model can be used to render the target object.
  • the viewing distance indicates that the importance of the target object in the screen can be represented by the distance of the target object from the virtual camera. If the observation distance is large, it means that the target object is far away from the virtual camera, which means that the target object is not important in the screen, and a low-precision LOD model can be used to render the target object.
  • the viewing 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 demand for rendering quality can be guaranteed, and the rendering efficiency can also be improved.
  • the target object is a static object in an application scene
  • the application scene includes a game scene or an animation scene.
  • a third aspect of the present application provides an apparatus for managing data storage, the apparatus for managing data storage having the function of implementing the method of the above-mentioned first aspect or any possible implementation manner of the first aspect.
  • This function can be implemented by hardware or by executing corresponding software by hardware.
  • 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.
  • a fourth aspect of the present application provides an object rendering apparatus, where the object rendering apparatus has the function of implementing the method of the second aspect or any possible implementation manner of the second aspect.
  • This function can be implemented by hardware or by executing corresponding software by hardware.
  • the hardware or software includes one or more modules corresponding to the above functions, such as: a first acquisition unit, a second acquisition unit, a determination unit, and a rendering unit.
  • a fifth aspect of the present application provides a computer device comprising at least one processor, a memory, an input/output (I/O) interface, and a computer executable stored in the memory and executable on the processor Instructions, when the computer-executed instructions are executed by the processor, the processor executes the method as described above in the first aspect or any possible implementation manner of the first aspect.
  • a sixth aspect of the present application provides a computer device comprising at least one processor, a memory, an input/output (I/O) interface, and a computer executable stored in the memory and executable on the processor Instructions, when the computer-executed instructions are executed by the processor, the processor executes the method of the second aspect or any of the possible implementations of the second aspect.
  • a seventh aspect of the present application provides a computer-readable storage medium storing one or more computer-executable instructions.
  • the processor executes the first aspect or any one of the possible first aspects. method of implementation.
  • An eighth aspect of the present application provides a computer-readable storage medium that stores one or more computer-executable instructions.
  • the processor executes the second aspect or any one of the possible operations of the second aspect. method of implementation.
  • a ninth aspect of the present application provides a computer program product that stores one or more computer-executable instructions.
  • the processor executes the first aspect or any possible implementation manner of the first aspect. Methods.
  • a tenth aspect of the present application provides a computer program product that stores one or more computer-executable instructions.
  • the processor executes the second aspect or any possible implementation manner of the second aspect. Methods.
  • An eleventh aspect of the present application provides a chip system, the chip system includes at least one processor, and the at least one processor is used to support the management apparatus for data storage to implement the first aspect or any possible implementation manner of the first aspect. the functions involved.
  • the chip system may further include a memory, which is used for saving necessary program instructions and data of the data storage management device.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • a twelfth aspect of the present application provides a chip system, the chip system includes at least one processor, and the at least one processor is used for supporting object rendering to implement the second aspect or any of the possible implementation manners of the second aspect. functions involved.
  • the chip system may further include a memory for storing necessary program instructions and data of the apparatus for rendering the object.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • the vertices in the pre-configured first LOD model can be reused in the simplified LOD model, then the vertices related to the reused vertices are used to render the target object.
  • the rendering data can also be reused, so that there is no need to generate rendering data for the second LOD model after simplified processing, that is, it is not necessary to obtain lightmaps for the second LOD model through lighting baking, which saves time for lighting baking. , which improves the efficiency of generating simplified models.
  • 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, as long as the index data of multiple LOD models are stored in association, and then a copy of the first LOD model is stored.
  • the rendering data other than the index data in one LOD model is sufficient. In this way, it is not necessary to store a complete rendering data for each LOD model, thereby saving storage space.
  • FIG. 1 is a schematic structural diagram of a rendering management system provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of an embodiment of a data storage management method provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of an operation interface provided by an embodiment of the present application.
  • 4A is a schematic diagram of a triangular patch of an LOD model provided by an embodiment of the present application.
  • 4B is a schematic diagram of a triangular patch of a simplified LOD model provided by an embodiment of the present application.
  • Fig. 5 is a storage structure diagram of the index data of the LOD model provided by the embodiment of the present application.
  • Fig. 6 is another storage structure diagram of the index data of the LOD model provided by the embodiment of the present application.
  • FIG. 7 is a schematic diagram of a storage structure of multiple LOD models of a target object provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of an embodiment of object rendering provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of an embodiment of a data storage management device provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of an embodiment of an apparatus for object rendering provided by an embodiment of the present application.
  • FIG. 11 is a schematic diagram of an embodiment of a computer device provided by an embodiment of the present application.
  • An embodiment of the present application provides a data storage management method, which is used to quickly obtain a multi-level of detail (level of detail, LOD) model, and reduce the occupation of storage space by data of multiple LOD models of an object.
  • Embodiments of the present application also provide a corresponding object rendering method, device, computer-readable storage medium, computer program product, and the like. Each of them will be described in detail below.
  • the data storage management method provided by the embodiment of the present application can be applied to the scene of game development, and the object rendering method provided by the embodiment of the present application can be applied to the scene of the game running.
  • the solutions provided in this application are not limited to be applied to game scenarios, and can also be applied to animation scenarios or other scenarios that can be applied to the solutions of this application.
  • the objects in this embodiment of the present application may be objects such as characters, animals, buildings, plants, or weapons in a game scene or an animation scene.
  • LOD is a commonly used graphics optimization technology. Considering that the object does not need to use a high-precision model in many scenes, for example, when the object is far from the virtual camera, the size of the object becomes smaller and many details are gradually blurred. Low-precision models can be used. The model replaces the high-precision model. That is to say, the LOD technology provides multiple LOD models with different precisions for an object, and determines the accuracy of the LOD model used according to the position and importance of the object on the screen, thereby improving rendering efficiency.
  • Models refer to 3D models used in games and animations.
  • the model can be divided into two parts: mesh and texture.
  • the mesh is composed of a series of triangular patches, which is equivalent to the "skeleton" of the model.
  • the map includes the texture image and light map that comes with the model, which is equivalent to the "skin” of the model.
  • the data of the model mainly includes vertex data, index data, normal data, texture (UV) coordinates, texture maps and light maps.
  • Mesh It is a splicing of a series of triangular patches, including vertex data, index data, normal data, and UV coordinates.
  • the vertex data stores the coordinates of the vertices (also called spatial points) required by the model, which are generally 3-dimensional.
  • Each vertex can be identified with an index value.
  • the index data of a triangular patch includes the index values of the three vertices forming the triangular patch.
  • the normal data specifies the normal direction of each vertex.
  • UV coordinates specify where the map "sticks" to the mesh.
  • Texture map Wrap any type of image on the surface of the 3D model, just like attaching a print to a flat surface, increasing the surface detail of the model.
  • Lightmap obtained by lighting baking, it stores the lighting results generated by the light source in the scene on the surface of the object, that is, the brightness information of each fragment on the surface of the model.
  • Lighting baking In order to make the lighting in the scene close to the real scene, it is necessary to simulate various lighting situations such as the interaction of light sources and the reflection of light. These lighting calculations are extremely complex, and if they are performed in real time, the system processing efficiency will be greatly reduced. Therefore, the scene lighting results are usually calculated in advance and saved to the lightmap, which can be directly attached to the surface of the object during runtime. Due to the complexity of lighting calculations, the general lighting baking time takes tens of minutes to tens of hours.
  • Simplifying the model It refers to reducing the number of triangular patches by changing the mesh information. As a result, the local details of the model are ignored, and the model accuracy is reduced, but at the same time, the calculation amount of the rendering pipeline when processing vertex data is reduced.
  • the simplified model is synonymous with the low-precision model.
  • the application solution is suitable for game scenes or animation scenes, it will include a development stage and a running stage.
  • the development phase is usually completed in the developer's terminal device, and then the application package (application package, APK) generated in the development phase can be stored in the server, and the user can use the terminal device from the server.
  • the corresponding application data package is downloaded to run the corresponding application scenario, or the terminal device can interact with the server online to run the corresponding application scenario.
  • the server refers to a physical machine.
  • Terminal equipment also known as user equipment (UE)
  • UE user equipment
  • UE user equipment
  • the server can also be deployed on land, including indoor or outdoor, handheld or vehicle-mounted; it can also be deployed on water (such as ships). etc.); can also be deployed in the air (eg on airplanes, balloons, satellites, etc.).
  • the terminal may be a mobile phone (mobile phone), a tablet computer (pad), a computer with a wireless transceiver function, a virtual reality (virtual reality, VR) terminal, an augmented reality (augmented reality, AR) terminal, an industrial control (industrial control) wireless terminals in self-driving, wireless terminals in remote medical, wireless terminals in smart grid, wireless terminals in transportation safety, Wireless terminals in smart cities, wireless terminals in smart homes, etc.
  • a virtual reality virtual reality, VR
  • AR augmented reality
  • industrial control industrial control
  • LOD technology uses multiple LOD models with different precisions to improve rendering efficiency while ensuring rendering quality. Therefore, in the development stage, the developer needs to generate multiple LOD models of different precisions for an object in the application scenario through the terminal device, and then store the data of the multiple LOD models.
  • the terminal device can be installed with the Unity platform, which is implemented based on the slim LOD operation interface.
  • an embodiment of a data storage management method provided by an embodiment of the present application includes:
  • the first LOD model is a preconfigured basic model for rendering the target object, and the index data is used to mark the vertices of the first LOD model.
  • the first LOD model is pre-made by the developer, and the first LOD model can be loaded on the developer's terminal device.
  • the second LOD model is the 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 to the index data of the first LOD model
  • the vertex of the second LOD model is the first LOD model.
  • the simplified 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 largest number of vertices and the largest number of triangular patches, the index data of the first LOD model is the largest. Therefore, the simplification ratio in this application is all less than 1.
  • the operation interface of the developer's terminal device may include multiple simplified scale selection items or simplified scale adjustment items.
  • the developer can select the corresponding simplified scale according to the requirements, and the terminal device can determine the index data of the simplified LOD model according to the simplified scale. .
  • LOD model of the target object number of triangles Simplified scale Graphical 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
  • LOD model 1 is the basic model of the target object.
  • the LOD model 1 has the largest number of vertices and the largest number of triangular patches.
  • the LOD model 1 has not been simplified, and can be viewed by clicking the corresponding preview link.
  • LOD model 2 is a simplified model obtained by simplifying at a simplified scale of 0.5.
  • the number of triangular patches in LOD model 2 is half that of LOD model 1, which means that only some vertices are selected from the vertices of LOD model 1.
  • LOD model 3 is a simplified model obtained by simplifying at a simplified scale of 0.25.
  • the number of triangular patches in LOD model 3 is one-fourth of that of LOD model 1, which is equivalent to only the selected part of the vertices of LOD model 1.
  • the vertices form LOD Model 2.
  • the image of the target object corresponding to the LOD model 3 can be viewed by clicking the corresponding preview link.
  • the operation interface can also be in other presentation forms.
  • the operation interface includes basic models of multiple objects, and the triangular facets of each basic model.
  • the quantity has also been shown that the simplified scale in Figure 3 is adjustable, and the simplified scale can be adjusted through the simplified scale adjustment item, that is, the simplified scale can be adjusted by dragging the "button" in the simplified scale adjustment item.
  • the simplified ratio shown in FIG. 3 is 0.5, it is not limited to 0.5 in FIG. 3 , and different simplified ratios can be obtained by adjusting.
  • the image of the adjusted target object in the simplified scale can be displayed at the bottom of the operation interface by clicking the preview.
  • the index data of the LOD model of the simplified scale can be determined according to the basic model of the target object, that is, each index data of the simplified model can be determined. A collection of index values for the three vertices in a triangular patch. Then click the "Submit" button on the interface to save the index data of the simplified scale LOD model.
  • the index data of the second LOD model is stored in association with the index data of the first LOD model.
  • the index data of the first LOD model and the index data of the second LOD model can be understood by referring to FIG. 4A and FIG. 4B .
  • the vertices of the second LOD model include three vertices with index values 1, 3, and 4 belonging to the first LOD model. These three vertices form a triangular patch, and the index data of this triangular patch is (1, 3, 4). It can be seen from this example that the index data of the first LOD model is different from the index data of the second LOD model. Certainly, some index data of the second LOD model may overlap with the index data of the first LOD model, but not all of them are the same.
  • the second LOD model uses the vertices of the first LOD model, because the data used for rendering the target object is related to the vertices, so , the rendering data of the simplified model can be a subset of the rendering data of the base model, so only one copy of the rendering data of the base model needs to be stored.
  • the index data of the first LOD model and the index data of the second LOD model are then stored in association to realize multiplexing of the rendering data of the second LOD model corresponding to the first LOD model during rendering.
  • the vertices in the pre-configured first LOD model can be reused in the simplified LOD model, then the vertices related to the reused vertices are used to render the target object.
  • the rendering data can also be reused, so that there is no need to generate the rendering data for the simplified second LOD model, which improves the efficiency of generating the simplified model.
  • 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, as long as the index data of multiple LOD models are stored in association, and then a copy of the first LOD model is stored.
  • the rendering data other than the index data in one LOD model is sufficient. In this way, it is not necessary to store a complete rendering data for each LOD model, thereby saving storage space.
  • the above-mentioned manner of storing the index data of the second LOD model in association with the index data of the first LOD model may be: storing the index data of the first LOD model in the first storage space, storing the index data of the second LOD model in the first storage space, and storing the index data of the second LOD model in the first storage space.
  • the data is stored in the second storage space, and the last address of the first storage space is adjacent to the first address of the second storage space.
  • the first storage space and the second storage space are continuous, and the last address of the first storage space and the first address of the second storage space are two consecutive addresses adjacent to each other.
  • the index data of the second LOD model can be continuously stored after the index data of the first LOD model.
  • the index data for each LOD model can be represented by the offset value and the length of the starting address, which can simplify the representation of the index data of the LOD model.
  • 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 offset value of the starting address of the index data of the first LOD model is S.
  • the length of index data refers to the address length of all index data included in an LOD model in the storage space.
  • the storage format of the index data of the first LOD model and the index data of the second LOD model can be understood by referring to FIG. 5 .
  • the starting address offset value of the index data of the first LOD model is S
  • 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
  • the terminal device can obtain LOD models corresponding to different simplified scales in response to the selection operation of different simplified scales.
  • the terminal device determines the index data of the third LOD model in response to the selection operation on the second simplified scale, the third LOD model is the LOD model of the target object corresponding to the second simplified scale, and the second simplified scale 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 simplified scale is smaller than the first simplified scale;
  • the index data of the model is stored in the third storage space, and the first address of the third storage space is adjacent to the last address of the second storage space.
  • 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 understood by referring to FIG. 6 .
  • the data storage management method provided by the embodiment of the present application further includes: generating a model switching strategy for the target object, where the model switching strategy includes switching conditions and switching options, wherein the switching conditions represent the triggering of the switching of the LOD model of the target object.
  • the relationship between the switching parameters and the switching threshold, the switching options include the starting address offset value and length of the index data of each LOD model in the at least two LOD models, and each LOD model in the at least two LOD models is used for rendering different The target object of precision; the model switching strategy is stored in association with the index data of each LOD model.
  • the model switching strategy is used to control the switching of LOD models with different precisions.
  • the switching condition may be a comparison between the switching parameter and the switching threshold. If the switching parameter is greater than the switching threshold, the first LOD model can be selected, and if the switching parameter is less than the switching threshold, the second LOD model can be selected.
  • An example of the model switching strategy in this embodiment of the present application may be expressed as:
  • pixelsize represents a switching parameter
  • R represents a switching threshold
  • the switching parameter includes the screen ratio or the 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 viewing distance represents the distance from the virtual camera in the application scene to the target object,
  • Application scenarios include game scenarios or animation scenarios.
  • the screen ratio can represent the importance of the target object in the screen by the height of the target object in the screen. If the screen 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 ratio is large, it means that the target object is important in the screen, and a high-precision LOD model can be used to render the target object.
  • the viewing distance indicates that the importance of the target object in the screen can be represented by the distance of the target object from the virtual camera. If the observation distance is large, it means that the target object is far away from the virtual camera, which means that the target object is not important in the screen, and a low-precision LOD model can be used to render the target object.
  • 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 in the screen, and a high-precision LOD model can be used to render the target object. In this way, the demand for rendering quality can be guaranteed, and the rendering efficiency can also be improved.
  • the above description is only given by taking one switching threshold and the starting address offset value and length of two LOD models as examples. In fact, when there are three or more LOD models, there can be multiple switching thresholds.
  • the above model switching strategy may be stored as a component after the index data of multiple LOD models of the target object.
  • each target object has three LOD models, which are represented by LOD model 1, LOD model 2 and LOD model 3 respectively, where LOD model 1 is the basic model , LOD Model 2 and LOD Model 3 are simplified models.
  • LOD model 1 is the basic model
  • LOD Model 2 and LOD Model 3 are simplified models.
  • all data of LOD model 1 can be stored.
  • index data can be stored, and then the switching control strategy of each target object can be stored in association, so that vertex data of two simplified models can be saved.
  • discovery data, UV data, texture data, lightmaps and other data on the premise that the multi-LOD model can be used normally, it saves a lot of storage space.
  • 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 the application data package of the target object, and the rendering data of the first LOD model is used to render 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.
  • the application data package of the target object in the application scenario can be uploaded to the server as shown in Figure 1, and then when the user's terminal device uses the application, a file of the application scenario can be downloaded from the server.
  • a series of application data packages execute the running process, switch different LOD models when the target object is at different levels of importance, and render the target object. The following describes the object rendering process provided by the embodiment of the present application with reference to FIG. 8 .
  • an embodiment of the object rendering method provided by the embodiment of the present application includes:
  • the switching parameter includes the screen ratio or the 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 viewing distance represents the distance from the virtual camera in the application scene to the target object,
  • Application scenarios include game scenarios or animation scenarios.
  • the screen ratio can represent the importance of the target object in the screen by the height of the target object in the screen. If the screen 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 ratio is large, it means that the target object is important in the screen, and a high-precision LOD model can be used to render the target object.
  • the viewing distance indicates that the importance of the target object in the screen can be represented by the distance of the target object from the virtual camera. If the observation distance is large, it means that the target object is far away from the virtual camera, which means that the target object is not important in 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 in the screen, and a high-precision LOD model can be used to render the target object.
  • the target LOD model is one of at least two LOD models corresponding to the target object, and each LOD model in the at least two LOD models is used to render target objects with different precisions.
  • the terminal device or server because the target LOD model can reuse data other than the index data in the first LOD model, the terminal device or server only needs to associate and store the indexes of the multiple LOD models for multiple LOD models of a target object. data, and then store a copy of the data used to render the target object except the index data in the first LOD model. In this way, there is no need to store a complete rendering data for each LOD model, thus saving storage space. .
  • the above step 202 may include: determining a target handover option according to the relationship between the handover parameter and the handover threshold, and the target handover option includes the start address offset value of the index data of the target LOD model and the Length; According to 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; Obtain the index data of the target LOD model from the target storage space .
  • determining the target storage space of the index data of the target LOD model according to the starting address offset value and the length of the index data of the target LOD model includes: according to the index data of the target LOD model.
  • the starting address offset value, the starting position of the index data of the target LOD model is determined from the 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 In the index storage space, it is continuously stored in the order obtained by each LOD model in the at least two LOD models; according to the starting position of the index data of the target LOD model, and the index data of the target LOD model Length, to determine the target storage space of the index data of the target LOD model.
  • the index data of the multiple LOD models of the target object is stored in a continuous storage manner, such as the storage methods shown in FIG. 5 and FIG. 6 , so the index data of each LOD model can be stored by The starting address offset value and length to indicate the storage space of the index data of the LOD model.
  • the first storage space can be found through S and len1
  • the second storage space can be found through M and len2, so that the index data of the target LOD model can be obtained from the corresponding target storage space.
  • the target storage space can be quickly determined by the starting address offset value and length of the index data of the LOD model, and then 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 can improve the rendering efficiency of the target object.
  • the embodiment of the present application further 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, where the switching interface is configured to update the The starting address offset and length of the index data of the LOD model used by the target object.
  • the LOD model used can be controlled by switching the interface.
  • it is necessary to configure the start address offset value and length of the index data of the selected target LOD model into the switching interface, and then connect the Down in the rendering process, the target LOD model can be executed.
  • This method of controlling the adopted LOD model by switching the interface is beneficial to accurately control the use of the LOD model.
  • the switching interface can include SubMeshDescriptor and Mesh.SetSubMesh, write the starting address offset value and length of the index data of the target LOD model into the SubMeshDescriptor interface, and then use the Mesh.SetSubMesh interface to take effect. In this way, when performing rendering, It will use the target LOD model to render the target object.
  • the forest scene in the real game was selected for testing.
  • the total number of objects in the scene was 209, and the total number of triangular faces was 745.2 thousand (k).
  • the simplified ratio and screen ratio of the objects were fixed as the switching threshold. Perform a simple model effect analysis.
  • the simplification ratio and screen ratio for example, when the simplification ratio is set to 0.5, it means that the number of triangular faces of the model is expected to be simplified to 50% of the original number of triangular faces, and the final effect may be different from the expected effect; the screen ratio as When switching the threshold, when the switching threshold is set to 0.35, it means that during the running process, 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.
  • the APK of the LOD model is 58.57 megabytes (M)
  • the number of triangles (Tris) is 745.2k
  • the frame rate is 37.23.
  • the simplified ratio is 0.5
  • the data when the switching threshold is set to 0.35, 0.3 or 0.25 can refer to the last three rows in Table 2.
  • the size of the application data package (APK) only increases by about 2M; when the LOD switching threshold is set to 0.35, 4 frames of income can be obtained, and the frame rate decreases with the decrease of the screen ratio. , but not obvious.
  • an embodiment of the data storage management apparatus 30 provided by the embodiment of the present application includes:
  • the obtaining unit 301 is configured to obtain index data of a first LOD model with multiple levels of detail, 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.
  • the response unit 302 is configured to determine the index data of the second LOD model in response to the selection operation on the first simplified scale, the second LOD model is the LOD model of the target object corresponding to the first simplified scale, and the first simplified scale represents the second LOD model
  • the ratio of the index data of the LOD model 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.
  • 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 store the index data of the second LOD model in association with the index data of the first LOD model.
  • the vertices in the pre-configured first LOD model can be reused in the simplified LOD model, then the vertices related to the reused vertices are used to render the target object.
  • the rendering data can also be reused, so that there is no need to generate the rendering data for the simplified second LOD model, which improves the efficiency of generating the simplified model.
  • 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, as long as the index data of multiple LOD models are stored in association, and then a copy of the first LOD model is stored.
  • the rendering data other than the index data in one LOD model is sufficient. In this way, it is not necessary to store a complete rendering data for each LOD model, thereby saving storage space.
  • the storage management unit 303 is configured to store the index data of the first LOD model in the first storage space, and store the index data of the second LOD model in the second storage space, where the last address of the first storage space is the same as that of the first storage space.
  • the first addresses of the second storage spaces are adjacent.
  • the response unit 302 is further configured to, in response to the selection operation on the second simplified scale, 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 simplified scale, the second The simplified scale 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 simplified scale is smaller than the first simplified scale.
  • the storage management unit 303 is further configured to store the index data of the third LOD model in the third storage space, where the first address of the third storage space is adjacent to the last address of the second storage space.
  • the data storage management device 30 further includes a processing unit, which is used to generate a model switching strategy for the target object, where the model switching strategy includes switching conditions and switching options, wherein the switching conditions represent triggering the LOD of the target object.
  • the relationship between the switching parameters of the model switching and the switching threshold, the switching options include the starting address offset value and length of the index data of each LOD model in the at least two LOD models, and each LOD model in the at least two LOD models uses for rendering target objects of different precisions.
  • the storage management unit 303 is further configured to associate and store the model switching strategy and the index data of each LOD model.
  • the processing unit is also used to encapsulate the model switching strategy, the index data of each LOD model stored in association, and the rendering data of the first LOD model as the application data package of the target object, and the rendering data of the first LOD model.
  • the rendering data of the first LOD model is data in the first LOD model other than the index data of the first LOD model.
  • the switching parameter includes the screen ratio or the viewing distance; the screen ratio represents the ratio of the height of the target object in the screen to the height of the screen; the viewing distance represents the distance from the virtual camera in the application scene to the target object, and the application scene Including game scenes or animation scenes.
  • an embodiment of the apparatus 40 for object rendering provided by the embodiment of the present application includes:
  • the first acquiring unit 401 is configured to acquire switching parameters that trigger switching of the multi-level of detail LOD model of the target object.
  • the determining unit 402 is configured to determine the index data of the target LOD model according to the switching parameter, the target LOD model is one of at least two LOD models corresponding to the target object, and each LOD model in the at least two LOD models is used for rendering different The precision of the target object.
  • the second obtaining unit 403 is further configured to obtain 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 Preconfigured base models.
  • the rendering unit 404 is configured to render the target object with the precision corresponding to the target LOD model according to the target rendering data.
  • the terminal device or server because the target LOD model can reuse data other than the index data in the first LOD model, the terminal device or server only needs to associate and store the indexes of the multiple LOD models for multiple LOD models of a target object. data, and then store a copy of the data used to render the target object except the index data in the first LOD model. In this way, there is no need to store a complete rendering data for each LOD model, thus saving storage space. .
  • the determining unit 402 is configured to determine the target switching option according to the relationship between the switching parameter and the switching threshold, and the target switching option includes the starting address offset value and the length of the index data of the target LOD model; according to the target LOD model The offset value and length of the starting address of the index data, determine the target storage space of the index data of the target LOD model; obtain the index data of the target LOD model from the target storage space.
  • the determining unit 402 is used to determine the index data of the target LOD model from the index storage space for storing the index data of at least two LOD models according to the starting address offset value of the index data of the target LOD model.
  • Starting position the index data of 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; according to the starting position of the index data of the target LOD model, and the target LOD model
  • the length of the index data determines the target storage space of the index data of the target LOD model.
  • the determining unit 402 is further configured 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 configured to update the LOD model used by the target object The starting address offset and length of the index data.
  • the switching parameter includes a screen ratio or a 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 viewing distance represents the distance from the virtual camera in the application scene to the target object.
  • the target object is a static object in an application scene
  • the application scene includes a game scene or an animation scene.
  • the apparatus 40 for object rendering described above can be understood by referring to the corresponding description in the foregoing method embodiment section, and details are not repeated here.
  • the computer device 50 may be the above-mentioned data storage management apparatus 30 or object rendering apparatus 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 connected to each other through a bus 504 .
  • the processor 501 is configured to control and manage the actions of the computer device 50.
  • the processor 501 is configured to execute steps 101 to 103 and 201 to 204 in the method embodiments of FIGS. 2 to 8 .
  • the communication interface 502 is used to support the computer device 50 to communicate.
  • the memory 503 is used for storing program codes and data of the computer device 50 .
  • 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, or a field programmable Gate arrays or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logical blocks, modules and circuits described in connection with this disclosure.
  • 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 the like.
  • the bus 504 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus or the like.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of presentation, only one thick line is used in FIG. 11, but it does not mean that there is only one bus or one type of bus.
  • a computer-readable storage medium is also provided, where computer-executable instructions are stored in the computer-readable storage medium.
  • the processor of the device executes the computer-executable instructions
  • the device executes the above-mentioned FIG. 2 to The method of data storage in FIG. 7 .
  • a computer-readable storage medium is also provided, where computer-executable instructions are stored in the computer-readable storage medium.
  • the processor of the device executes the computer-executable instructions
  • the device executes the above-mentioned FIG. 8 Object rendering method.
  • a computer program product includes computer-executable instructions, and the computer-executable instructions are stored in a computer-readable storage medium; when a processor of a device executes the computer-executable instructions , the device executes the above-mentioned data storage management methods in FIG. 2 to FIG. 7 .
  • a computer program product includes computer-executable instructions, and the computer-executable instructions are stored in a computer-readable storage medium; when a processor of a device executes the computer-executable instructions , the device executes the object rendering method in FIG. 8 above.
  • a chip system is further provided, the chip system includes a processor, and the processor is used to support the device for memory management to implement the above-mentioned management methods for internal data storage in FIG. 2 to FIG. 7 .
  • the chip system may further include a memory, which is used for saving necessary program instructions and data of the memory management device.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • a chip system is further provided, where the chip system includes a processor, and the processor is used for the apparatus for supporting memory management to implement the above-mentioned method for rendering an internal object in FIG. 8 .
  • the chip system may further include a memory, which is used for saving necessary program instructions and data of the memory management device.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • Units described as separate components may or may not be physically separated, and components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the embodiments of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the functions, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer-readable storage medium.
  • the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or the parts that make contributions to the prior art or the parts of the technical solutions, and the computer software products are stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in the embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • Computer Graphics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Processing Or Creating Images (AREA)

Abstract

一种数据存储的管理方法,可以应用于游戏场景或动画场景中。该方法包括获取第一LOD模型的索引数据,第一LOD模型为预配置的用于渲染目标对象的基础模型,索引数据用于标记第一LOD模型的顶点;响应于对第一简化比例的选择操作,确定第二LOD模型的索引数据,第二LOD模型为目标对象的简化模型,第二LOD模型的顶点为第一LOD模型的顶点的子集;存储第二LOD模型的索引数据,不需要存储第二LOD模型的渲染数据。针对同一目标对象的多个LOD模型,可以复用基础模型中的顶点,可以共用基础模型的渲染数据,因此可以节省用于存储LOD模型的数据的存储空间。

Description

一种数据存储的管理方法、对象渲染的方法及设备
本申请要求于2020年11月13日提交中国专利局、申请号为202011276117.4、发明名称为“一种数据存储的管理方法、对象渲染的方法及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,具体涉及一种数据存储的管理方法、对象渲染的方法及设备。
背景技术
在游戏场景中,各种角色的显示通常是通过对相应角色的模型进行渲染完成的。因此,模型的精细程度对渲染效果有直接影响,但高精度模型的计算量十分大,会降低渲染的效率,因此,出现了多细节层次(level of detail,LOD)模型。LOD的思想就是利用角色随着游戏进行,在游戏场景中的突出程度不同,给出多个不同的精度的LOD模型,这样,就可以根据角色在游戏场景中突出程度来选择相应精度的模型进行渲染,既不影响渲染效果,又可以提高渲染效率。
针对一个角色的多个LOD模型通常是游戏开发人员分别制作的,每个LOD模型有一套独立的顶点数据、索引数据、纹理数据和光照贴图,其中,光照贴图的得到尤其耗费时间。由此可见,目前的LOD模型不仅影响了开发速度,也需要较大的存储空间来存储这些LOD模型的数据。
发明内容
本申请实施例提供一种数据存储的管理方法,用于快速得到多细节层次(level of detail,LOD)模型,并降低一个对象的多个LOD模型的数据对存储空间的占用。本申请实施例还提供了相应的对象渲染的方法、设备、计算机可读存储介质、计算机程序产品等。
本申请第一方面提供一种数据存储的管理方法,该方法可以应用于用于游戏开发或者动画开发的终端设备.该方法包括:获取第一多细节层次LOD模型的索引数据,第一LOD模型为预配置的用于渲染目标对象的基础模型,索引数据用于标记第一LOD模型的顶点;响应于对第一简化比例的选择操作,确定第二LOD模型的索引数据,第二LOD模型为目标对象对应于第一简化比例的LOD模型,第一简化比例表示第二LOD模型的索引数据相对于第一LOD模型的索引数据的比例,第二LOD模型的顶点为第一LOD模型的顶点的子集;存储所述第二LOD模型的索引数据。
需要说明的是,第一LOD模型的渲染数据在本申请提供的渲染方法中是需要的,但本实施例并不限定它来源于哪里或存储在哪个位置。其中,某个LOD模型的渲染数据指的是用来渲染该LOD模型对应精度的对象的数据,而索引数据是指向该渲染数据的一种数据,两种数据之间可以有重叠。
通过以上方法,不需要像现有技术那样存储第二LOD模型既简化模型的渲染数据,只需要存储它的索引数据,因此节省了存储空间,尤其是在存在多个简化模型的情况下,不需要像现有技术那样每个简化模型都存储对应的渲染数据,较大程度地节省了存储空间。
该第一方面中,目标对象可以是游戏场景或动画场景中的人物、动物、建筑、植物或 武器等对象。目标对象可以有多个LOD模型,每个LOD模型的精度不同,本申请中,“多个”包括两个或两个以上,也可以表示为至少两个。
第一LOD模型是该目标对象的基础模型,该第一LOD模型是通过预先配置得到的,相比于该目标对象的多个LOD模型中的其他LODO型,该第一LOD模型的顶点数量最多。其他LOD模型都是基于该第一LOD模型得到的简化模型,第二LOD模型即是按照第一简化比例得到的简化模型。可以理解为,从第一LOD模型的顶点中选择不同数量的顶点得到不同简化程度的简化模型。通常LOD模型是通过三角面片拼接成的,其中,每个三角面片都有3个顶点,每个顶点都具有一个索引值,这三个顶点的索引值组成的集合为该三角面片的索引数据。一个LOD模型所包含的三角面片的数量即为该LOD模型的索引数据的数量。
本申请中,简化比例表示简化后的LOD模型中索引数据的数量相对于第一LOD模型的索引数据的数量的比值。因为第一LOD模型的顶点最多,三角面片的数量最多,所以第一LOD模型的索引数据最多,所以,本申请中简化比例都是小于1的。在开发人员的终端设备的操作界面上可以包括多个简化比例选择项或者简化比例调节项,开发人员可以根据需求选择相应的简化比例,终端设备可以根据该简化比例确定对应的简化模型的索引数据,本申请中确定第二LOD模型的索引数据的过程可以是根据简化算法得到的,该简化算法指的是参基础模型的拓扑结构,在保证简化模型的边缘线条和整体外表面稳定的,没有畸变的前提下减少基础模型中三角面片的数量。如:基于一个具有100个三角面片的基础模型,按照0.5的简化比例得到简化模型的过程,可以是借助基于模型,均匀隐藏一些顶点,然后针对剩余的顶点,重新组建50个三角面片,得到0.5简化比例的简化模型。
本申请中,因为第二LOD模型的索引数据是通过顶点组合得到的,虽然第二LOD模型中的顶点是第一LOD模型的顶点的子集,但用于组成三角面片的顶点的组合关系可以不同,所以,第二LOD模型的索引数据可以与第一LOD模型的索引数据不同。
第一LOD模型的渲染数据包括第一LOD模型的顶点数据、法线数据、纹理(UV)坐标、纹理贴图和光照贴图等,其中,光照贴图需要通过光照烘焙得到,一般光照烘焙的时间需要几十分钟到几十小时不等。
本申请中,简化的LOD模型的顶点是第一LOD模型的顶点的子集。如:第一LOD模型有100个顶点,第二LOD模型有50个顶点,那么该50个顶点是从第一LOD模型的100个顶点中选出的。因为用于渲染目标对象的渲染数据都是与顶点相关的,第二LOD模型的顶点是第一LOD模型的顶点的子集,也就是说第二LOD模型复用了第一LOD模型的部分顶点,那么与所复用的顶点相关的渲染数据也可以复用,这样就不需要再为简化处理后的第二LOD模型生成渲染数据,也就不需要为第二LOD模型通过光照烘焙得到光照贴图,节省了用于光照烘焙的时间,提高了生成简化模型的效率。另外,因为,简化的LOD模型可以复用第一LOD模型中的渲染数据,针对一个目标对象的多个LOD模型,只要关联存储多个LOD模型的索引数据,再存储一份第一LOD模型中的渲染数据即可,这样,不需要针对每个LOD模型都存储一份完整的渲染数据,从而节省了存储空间。
在第一方面的一种可能的实现方式中,存储所述第二LOD模型的索引数据的方式包括将所述第二LOD模型的索引数据与所述第一LOD模型的索引数据关联存储,或者说连续存储, 以方便查找。
在第一方面的一种可能的实现方式中,上述步骤:将第二LOD模型的索引数据与第一LOD模型的索引数据关联存储,包括:将第一LOD模型的索引数据存储到第一存储空间,将第二LOD模型的索引数据存储到第二存储空间,第一存储空间的最后一个地址与第二存储空间的首地址相邻。在其他实现方式中,第一存储空间的首地址与第二存储空间的最后一个地址相邻。
该种可能的实现方式中,第一存储空间与第二存储空间是连续的,两个LOD模型之间索引数据关联存储可以是将第二LOD模型的索引数据连续的存储在第一LOD模型的索引数据之后。这样针对每个LOD模型的索引数据都可以通过起始地址偏移值与长度来表示,可以简化LOD模型的索引数据的表示方式。
在第一方面的一种可能的实现方式中,该方法包括:响应于对第二简化比例的选择操作,确定第三LOD模型的索引数据,第三LOD模型为目标对象对应于第二简化比例的LOD模型,第二简化比例表示第三LOD模型的索引数据相对于第一LOD模型的索引数据的比例,第三LOD模型的顶点为第一LOD模型的顶点的子集,第二简化比例小于第一简化比例;将第三LOD模型的索引数据存储到第三存储空间,第三存储空间的首地址与第二存储空间的最后一个地址相邻。在其他实现方式中,第三存储空间的最后一个地址与第二存储空间的首地址相邻。
该种可能的实现方式中,若针对第一LOD模型,终端设备陆续收到不同简化比例的选择操作,那么该终端设备会按照对不同简化比例的响应顺序,将陆续生成的LOD模型的索引数据连续存储。这样可以简化LOD模型的索引数据的表示方式。
在第一方面的一种可能的实现方式中,该方法包括:为目标对象生成模型切换策略,模型切换策略包括切换条件和切换选择项,其中,切换条件表示触发目标对象的LOD模型切换的切换参数与切换阈值的关系,切换选择项包括至少两个LOD模型中每个LOD模型的索引数据的起始地址偏移值和长度,至少两个LOD模型中的每个LOD模型用于渲染不同精度的目标对象;将模型切换策略和每个LOD模型的索引数据关联存储。
该种可能的实现方式中,模型切换策略用于控制不同精度的LOD模型的切换。其中,切换条件可以是切换参数与切换阈值的比较关系,若切换参数大于切换阈值,则可以选择第一LOD模型,若切换参数小于切换阈值,则可以选择第二LOD模型。当然,在有三个或三个以上的LOD模型时,可以有多个切换阈值。本申请中,可以根据切换参数与对应切换阈值的关系来确定对应的LOD模型。本申请在存储每个LOD模型的索引数据时采用的是连续存储的方式,因此可以通过每个LOD模型的索引数据的起始地址偏移值和长度来指示该LOD模型的索引数据的存储空间。将模型切换策略和每个LOD模型的索引数据关联存储,可以有利于在渲染目标对象时,通过该模型切换策略快速查找到相应LOD模型的索引数据。
在第一方面的一种可能的实现方式中,该方法包括:将模型切换策略、关联存储的每个LOD模型的索引数据,以及第一LOD模型的渲染数据封装为目标对象的应用数据包,第一LOD模型的渲染数据用于渲染所述第一LOD模型所对应精度的目标对象。
该种可能的实现方式中,第一LOD模型的渲染数据通常为第一LOD模型中除第一LOD模型的索引数据之外的数据。将目标对应的模型切换策略、关联存储的每个LOD模型的索引数据, 以及第一LOD模型的渲染数据封装在一个应用数据包中,这样,在运行游戏或动画时,可以通过下载应用数据包快速完成安装。
在第一方面的一种可能的实现方式中,切换参数包括屏占比或观察距离;屏占比表示目标对象在屏幕中的高度与屏幕的高度的比例;观察距离表示从应用场景中的虚拟相机到目标对象的距离,应用场景具体可以为视频场景,所述视频场景包括游戏场景或动画场景。
该种可能的实现方式中,屏占比可以通过目标对象在屏幕中的高度来表示该目标对象在屏幕中的重要程度。屏占比小,则表示该目标对象在屏幕中不重要,则可以采用低精度的LOD模型来渲染该目标对象。若屏占比大,则表示该目标对象在屏幕中重要,则可以采用高精度的LOD模型来渲染该目标对象。观察距离表示可以通过目标对象距离虚拟相机的远近来表示该目标对象在屏幕中的重要程度。观察距离大,则表示该目标对象距离虚拟相机远,则表示该目标对象在屏幕中不重要,则可以采用低精度的LOD模型来渲染该目标对象。观察距离小,则表示该目标对象距离虚拟相机近,则表示该目标对象在屏幕中重要,则可以采用高精度的LOD模型来渲染该目标对象。这样,即可以保证对渲染质量的需求,也可以提高渲染效率。
本申请第二方面提供一种对象渲染的方法,该方法应用于游戏场景或动画场景的终端设备。该方法包括:获取触发目标对象的多细节层次LOD模型切换的切换参数;根据切换参数,确定目标LOD模型的索引数据,目标LOD模型为目标对象对应的至少两个LOD模型中的一个,至少两个LOD模型中的每个LOD模型用于渲染不同精度的目标对象;从第一LOD模型的渲染数据中获取与目标LOD模型的索引数据对应的目标渲染数据,目标渲染数据包含于第一LOD模型的渲染数据,第一LOD模型是预配置的基础模型;根据目标渲染数据渲染与目标LOD模型对应精度的目标对象。
在运行游戏或动画等应用场景过程中,可以将应用场景中各对象的应用数据包下载到终端设备,也可以是将应用场景中各对象的应用数据包存储在相应的服务器中。在运行例如游戏时,当需要渲染目标对象,就可以根据切换参数确定目标LOD模型的索引数据,进而根据该目标LOD模型的索引数据从第一LOD模型的渲染数据中获取与目标LOD模型的索引数据对应的目标渲染数据,然后根据该目标渲染数据渲染该目标对象。
本申请中,其他与第一方面或第一方面的可能的实现方式中相同的特征,可以参阅上述第一方面或第一方面的可能的实现方式中的定义进行理解,此处不再重复赘述。由上述第二方面可知,因为目标LOD模型可以复用第一LOD模型中的渲染数据,这样终端设备或服务器针对一个目标对象的多个LOD模型,只要关联存储多个LOD模型的索引数据,再存储一份第一LOD模型中用于渲染目标对象的数据即可,这样,不需要针对每个LOD模型都存储一份完整的渲染数据,从而节省了存储空间;同时在渲染的过程中,目标模型的渲染数据可以重用第一LOD模型的渲染数据,从而不需要为目标模型重新生成渲染数据,例如关照贴图,也就避免了重新执行关照烘焙等过程,提高了渲染效率。
在第二方面的一种可能的实现方式中,上述步骤:根据所述切换参数,确定目标LOD模型的索引数据,包括:根据所述切换参数与切换阈值的关系,确定目标切换选择项,所述目标切换选择项包括所述目标LOD模型的索引数据的起始地址偏移值和长度;根据所述目 标LOD模型的索引数据的起始地址偏移值和长度,确定所述目标LOD模型的索引数据的目标存储空间;从所述目标存储空间获取所述目标LOD模型的索引数据。
该种可能的实现方式中,在存储目标对象的多个LOD模型的索引数据采用的是连续存储的方式,因此可以通过每个LOD模型的索引数据的起始地址偏移值和长度来指示该LOD模型的索引数据的存储空间,从而从相应存储空间中快速查找到相应LOD模型的索引数据,进而完成渲染。因此,该种可能的实现方式可以提高目标对象渲染的效率。
在第二方面的一种可能的实现方式中,上述步骤:根据所述目标LOD模型的索引数据的起始地址偏移值和长度,确定所述目标LOD模型的索引数据的目标存储空间,包括:根据所述目标LOD模型的索引数据的起始地址偏移值,从用于存储所述至少两个LOD模型的索引数据的索引存储空间中确定所述目标LOD模型的索引数据的起始位置,所述至少两个LOD模型的索引数据在所述索引存储空间中按照所述至少两个LOD模型中每个LOD模型得到的顺序连续存储;根据所述目标LOD模型的索引数据的起始位置,以及所述目标LOD模型的索引数据的长度,确定所述目标LOD模型的索引数据的目标存储空间。
该种可能的实现方式中,因为目标对象的多个LOD模型的索引数据时采用的是连续存储的方式,所以,可以根据目标LOD模型的索引数据的起始地址偏移值查找到该目标LOD模型的索引数据的起始位置,进而再根据该目标LOD模型的索引数据的长度确定出存储该目标LOD模型的索引数据的存储空间。由该种可能的实现方式可知,只需要通过索引数据的起始地址偏移值和长度这两个参数就可以查找到该目标LOD模型的索引数据,可以提高目标对象渲染的效率。
在第二方面的一种可能的实现方式中,上述步骤:根据所述切换参数与切换阈值的关系,确定目标切换选择项之后,该方法还包括:将切换接口中的数据更新为所述目标LOD模型的索引数据的起始地址偏移值和长度,所述切换接口用于配置用于更新所述目标对象所使用的LOD模型的索引数据的起始地址偏移值和长度。
该种可能的实现方式中,可以通过切换接口来控制所采用的LOD模型,本申请中,需要将被选中的目标LOD模型的索引数据的起始地址偏移值和长度配置到该切换接口中,接下来在渲染过程中,该目标LOD模型才能被执行。这种通过切换接口来控制所采用的LOD模型的方式,有利于准确控制对LOD模型的使用。
在第二方面的一种可能的实现方式中,所述切换参数包括屏占比或观察距离;所述屏占比表示所述目标对象在屏幕中的高度与所述屏幕的高度的比例;所述观察距离表示从应用场景中的虚拟相机到所述目标对象的距离。
该种可能的实现方式中,屏占比可以通过目标对象在屏幕中的高度来表示该目标对象在屏幕中的重要程度。屏占比小,则表示该目标对象在屏幕中不重要,则可以采用低精度的LOD模型来渲染该目标对象。若屏占比大,则表示该目标对象在屏幕中重要,则可以采用高精度的LOD模型来渲染该目标对象。观察距离表示可以通过目标对象距离虚拟相机的远近来表示该目标对象在屏幕中的重要程度。观察距离大,则表示该目标对象距离虚拟相机远,则表示该目标对象在屏幕中不重要,则可以采用低精度的LOD模型来渲染该目标对象。观察距离小,则表示该目标对象距离虚拟相机近,则表示该目标对象在屏幕中重要,则可以采 用高精度的LOD模型来渲染该目标对象。这样,即可以保证对渲染质量的需求,也可以提高渲染效率。
在第二方面的一种可能的实现方式中,所述目标对象为应用场景中的静态对象,所述应用场景包括游戏场景或动画场景。
本申请第三方面提供一种数据存储的管理装置,该数据存储的管理装置具有实现上述第一方面或第一方面任意一种可能实现方式的方法的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块,例如:获取单元、响应单元和存储管理单元。
本申请第四方面提供一种对象渲染的装置,该对象渲染的装置具有实现上述第二方面或第二方面任意一种可能实现方式的方法的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块,例如:第一获取单元、第二获取单元、确定单元和渲染单元。
本申请第五方面提供一种计算机设备,该计算机设备包括至少一个处理器、存储器、输入/输出(input/output,I/O)接口以及存储在存储器中并可在处理器上运行的计算机执行指令,当计算机执行指令被处理器执行时,处理器执行如上述第一方面或第一方面任意一种可能的实现方式的方法。
本申请第六方面提供一种计算机设备,该计算机设备包括至少一个处理器、存储器、输入/输出(input/output,I/O)接口以及存储在存储器中并可在处理器上运行的计算机执行指令,当计算机执行指令被处理器执行时,处理器执行如上述第二方面或第二方面任意一种可能的实现方式的方法。
本申请第七方面提供一种存储一个或多个计算机执行指令的计算机可读存储介质,当计算机执行指令被处理器执行时,处理器执行如上述第一方面或第一方面任意一种可能的实现方式的方法。
本申请第八方面提供一种存储一个或多个计算机执行指令的计算机可读存储介质,当计算机执行指令被处理器执行时,处理器执行如上述第二方面或第二方面任意一种可能的实现方式的方法。
本申请第九方面提供一种存储一个或多个计算机执行指令的计算机程序产品,当计算机执行指令被处理器执行时,处理器执行如上述第一方面或第一方面任意一种可能的实现方式的方法。
本申请第十方面提供一种存储一个或多个计算机执行指令的计算机程序产品,当计算机执行指令被处理器执行时,处理器执行如上述第二方面或第二方面任意一种可能的实现方式的方法。
本申请第十一方面提供了一种芯片系统,该芯片系统包括至少一个处理器,至少一个处理器用于支持数据存储的管理装置实现上述第一方面或第一方面任意一种可能的实现方式中所涉及的功能。在一种可能的设计中,芯片系统还可以包括存储器,存储器,用于保存数据存储的管理装置必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
本申请第十二方面提供了一种芯片系统,该芯片系统包括至少一个处理器,至少一个处理器用于支持对象渲染的装置实现上述第二方面或第二方面任意一种可能的实现方式中所涉及的功能。在一种可能的设计中,芯片系统还可以包括存储器,存储器,用于保存对象渲染的装置必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
本申请实施例中,针对同一目标对象的多个LOD模型,预先配置的第一LOD模型中的顶点可以在简化的LOD模型中复用,那么与所复用的顶点相关的用于渲染目标对象的渲染数据也可以复用,这样就不需要再为简化处理后的第二LOD模型生成渲染数据,也就是不需要为第二LOD模型通过光照烘焙得到光照贴图,节省了用于光照烘焙的时间,提高了生成简化模型的效率。另外,因为,简化的LOD模型可以复用第一LOD模型中除索引数据之外的数据,针对一个目标对象的多个LOD模型,只要关联存储多个LOD模型的索引数据,再存储一份第一LOD模型中除索引数据之外的渲染数据即可,这样,不需要针对每个LOD模型都存储一份完整的渲染数据,从而节省了存储空间。
附图说明
图1是本申请实施例提供的渲染管理系统的一结构示意图;
图2是本申请实施例提供的数据存储的管理方法的一实施例示意图;
图3是本申请实施例提供的一操作界面的示意图;
图4A是本申请实施例提供的一LOD模型的三角面片的示意图;
图4B是本申请实施例提供的一简化的LOD模型的三角面片的示意图;
图5是本申请实施例提供的LOD模型的索引数据的一存储结构图;
图6是本申请实施例提供的LOD模型的索引数据的另一存储结构图;
图7是本申请实施例提供的目标对象的多个LOD模型的存储结构示意图;
图8是本申请实施例提供的对象渲染的一实施例示意图;
图9是本申请实施例提供的数据存储的管理装置的一实施例示意图;
图10是本申请实施例提供的对象渲染的装置的一实施例示意图;
图11是本申请实施例提供的计算机设备的一实施例示意图。
具体实施方式
下面结合附图,对本申请的实施例进行描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。本领域普通技术人员可知,随着技术发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
本申请实施例提供一种数据存储的管理方法,用于快速得到多细节层次(level of detail,LOD)模型,并降低一个对象的多个LOD模型的数据对存储空间的占用。本申请实施例还提供了相应的对象渲染的方法、设备、计算机可读存储介质、计算机程序产品等。以下分别进行详细说明。
本申请实施例所提供的种数据存储的管理方法可以应用于游戏开发的场景中,本申请实施例所提供的对象渲染的方法可以应用于游戏运行的场景中。当然,本申请所提供的方案也不限于应用于游戏场景,也可以应用于动画场景或者其他可以适用于本申请方案的场景。
无论是在游戏场景,还是在动画场景,或者,其他可以适用于本申请方案的场景,都需要开发人员预先为各场景中的对象生成LOD模型。本申请实施例中的对象可以是游戏场景或动画场景中的人物、动物、建筑、植物或武器等对象。
为了便于理解,下面先对本申请中涉及到的一些特征进行说明。
LOD是一项常用的图形优化技术,考虑到对象在很多场景并不需要使用高精度模型,比如对象远离虚拟相机时,此时对象的尺寸变小,很多细节也逐渐模糊,可以使用低精度的模型替代高精度的模型。也就是说LOD技术是针对一个对象提供多个不同精度的LOD模型,按照对象在屏幕中的位置及重要程度来确定所使用LOD模型的精确度,从而提升渲染效率。
模型指的是游戏、动画中使用到的3D模型。可以将模型分为网格和贴图两部分,网格由一系列三角面片拼接而成,相当于模型的“骨骼”。贴图包括模型自带的纹理图片以及光照贴图,相当于模型的“皮肤”。根据网格和贴图的各自构成,模型的数据主要包括顶点数据、索引数据、法线数据、纹理(UV)坐标、纹理贴图和光照贴图等。
网格(Mesh):是一系列三角面片的拼接,包括顶点数据、索引数据、法线数据以及UV坐标等组成。
顶点数据中存储了模型所需的顶点(也可以称为空间点)的坐标,一般是3维。
每个顶点都可以用一个索引值来标识。
一个三角面片的索引数据包括形成该三角面片的三个顶点的索引值。
法线数据规定了每个顶点的法线方向。
UV坐标指定了贴图“贴”到网格的位置。
纹理贴图:将任意一种类型的图片包裹到3D模型的表面上,如同将印花贴到一个平面上,增加模型的表面细节。
光照贴图:由光照烘焙得到,存储了场景中光源在对象表面产生的光照结果,即模型表面每个片段的亮度信息。
光照烘焙:为了使场景中的光照贴近真实场景,需要模拟出光源的互动以及光的反射等多种光照情况。这些光照计算是极为复杂的,若实时进行会极大的降低系统处理效率,因此通常会选择将场景光照结果事先计算好并保存到光照贴图,运行时可直接贴在物体表面。由于光照计算复杂,一般光照烘焙的时间需要几十分钟到几十小时不等。
简化模型:指的是通过改变网格信息,降低三角面片的数量,其结果是忽略了模型的局部细节,模型精度下降,但同时降低了渲染管道在处理顶点数据时的计算量。本申请中, 简化模型与低精度模型同义。
无论本申请方案适用于游戏场景,还是动画场景,都会包含开发阶段和运行阶段。如图1所示的渲染管理系统,开发阶段通常在开发人员的终端设备中完成,然后可以将开发阶段生成的应用数据包(application package,APK)存储到服务器中,用户可以通过终端设备从服务器下载相应的应用数据包来运行相应的应用场景,也可以是终端设备与服务器在线交互来运行相应的应用场景。
本申请实施例中,服务器指的是物理机。终端设备(也可以称为用户设备(user equipment,UE))是一种具有无线收发功能的设备,可以部署在陆地上,包括室内或室外、手持或车载;也可以部署在水面上(如轮船等);还可以部署在空中(例如飞机、气球和卫星上等)。所述终端可以是手机(mobile phone)、平板电脑(pad)、带无线收发功能的电脑、虚拟现实(virtual reality,VR)终端、增强现实(augmented reality,AR)终端、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端等。
由前述介绍可知LOD技术是通过多个不同精度的LOD模型来达到在保证渲染质量的同时,提高渲染效率的。所以,在开发阶段,开发人员需要通过终端设备为应用场景中的一个对象生成多个不同精度的LOD模型,然后存储多个LOD模型的数据。该终端设备可以安装有Unity平台,基于slim LOD操作界面来实现。下面结合附图介绍本申请实施例在开发阶段的数据存储的管理方法。
如图2所示,本申请实施例提供数据存储的管理方法的一实施例包括:
101、获取第一多细节层次LOD模型的索引数据。
第一LOD模型为预配置的用于渲染目标对象的基础模型,索引数据用于标记第一LOD模型的顶点。
第一LOD模型通过是开发人员预先制作好的,可以将该第一LOD模型加载到开发人员的终端设备上。
102、响应于对第一简化比例的选择操作,确定第二LOD模型的索引数据。
第二LOD模型为目标对象对应于第一简化比例的LOD模型,第一简化比例表示第二LOD模型的索引数据相对于第一LOD模型的索引数据的比例,第二LOD模型的顶点为第一LOD模型的顶点的子集。
本申请实施例中,简化比例表示简化后的LOD模型中索引数据的数量相对于第一LOD模型的索引数据的数量的比值。因为第一LOD模型的顶点最多,三角面片的数量最多,所以第一LOD模型的索引数据最多,所以,本申请中简化比例都是小于1的。
在开发人员的终端设备的操作界面上可以包括多个简化比例选择项或者简化比例调节项,开发人员可以根据需求选择相应的简化比例,终端设备可以根据该简化比例确定简化的LOD模型的索引数据。
该操作界面上所显示的内容可以参阅表1进行理解。
表1:操作界面上的内容
目标对象的LOD模型 三角面片的数量 简化比例 图形预览
LOD模型1 200 1 点击预览
LOD模型2 100 0.5 点击预览
LOD模型3 50 0.25 点击预览
由上表1可知,LOD模型1是目标对象的基础模型,该LOD模型1的顶点数量最多,三角面片的数量最多,该LOD模型1没有经过简化处理,可以通过对应的点击预览的链接查看该LOD模型1对应的目标对象的图像。LOD模型2是按照0.5的简化比例进行简化处理后得到的简化模型,该LOD模型2的三角面片的数量是LOD模型1的一半,相当于只有LOD模型1的顶点中选择了部分顶点形成了LOD模型2,可以通过对应的点击预览的链接查看该LOD模型2对应的目标对象的图像。LOD模型3是按照0.25的简化比例进行简化处理后得到的简化模型,该LOD模型3的三角面片的数量是LOD模型1的四分之一,相当于只有LOD模型1的顶点中选择了部分顶点形成了LOD模型2。可以通过对应的点击预览的链接查看该LOD模型3对应的目标对象的图像。
本申请表1中的数据和形式只是有一种示例,操作界面还可以是其他的展现形式,如图3所示,操作界面上包括多个对象的基础模型,每个基础模型的三角面片的数量也已展示出,图3中的简化比例是可调节的,可以通过该简化比例调节项来调节简化比例,即拖动简化比例调节项中的“按钮”就可以调节简化比例。虽然图3中示出的简化比例是0.5,但不限于图3中的0.5,可以通过调节来得到不同的简化比例。开发人员确定简化比例后,可以通过点击预览,在操作界面下方显示所调节的目标对象在该简化比例下的图像。
无论是表1所示的方式,还是图3所示的方式,简化比例一经确定,就可以根据该目标对象的基础模型确定出该简化比例的LOD模型的索引数据,也就是该简化模型的每个三角面片中三个顶点的索引值的集合。然后点击界面上的“提交”按钮,即可保存该简化比例的LOD模型的索引数据。
103、存储第二LOD模型的索引数据。
具体的,将第二LOD模型的索引数据与第一LOD模型的索引数据关联存储。
第一LOD模型的索引数据与第二LOD模型的索引数据可以参阅图4A和图4B进行理解。
如图4A所示,第一LOD模型中索引值分别为1、2、3和4的四个顶点,可以形成两个三角面片,这两个三角面片的索引数据分别为(1、2、3)和(2、3、4)。如图4B所示,第二LOD模型的顶点包括属于第一LOD模型的索引值为1、3、4的三个顶点,这三个顶点形成一个三角面片,这个三角面片的索引数据为(1、3、4)。由该示例可见,第一LOD模型的索引数据与第二LOD模型的索引数据不相同。当然,第二LOD模型的索引数据中也可以有部分索引数据与第一LOD模型的索引数据重叠,但不会全部相同。
虽然,第一LOD模型的索引数据与第二LOD模型的索引数据不相同,但第二LOD模型使用了第一LOD模型的顶点,因为用于渲染目标对象的数据都是与顶点相关的,所以,简化模型的渲染数据可以是基础模型的渲染数据的子集,所以,只需要存储一份基础模型的渲染数据即可。另外,再关联存储第一LOD模型的索引数据与第二LOD模型的索引数据就可以实现 在渲染时,第二LOD模型对应第一LOD模型的渲染数据的复用。
本申请实施例中,针对同一目标对象的多个LOD模型,预先配置的第一LOD模型中的顶点可以在简化的LOD模型中复用,那么与所复用的顶点相关的用于渲染目标对象的渲染数据也可以复用,这样就不需要再为简化处理后的第二LOD模型生成这渲染数据,提高了生成简化模型的效率。另外,因为,简化的LOD模型可以复用第一LOD模型中除索引数据之外的数据,针对一个目标对象的多个LOD模型,只要关联存储多个LOD模型的索引数据,再存储一份第一LOD模型中除索引数据之外的渲染数据即可,这样,不需要针对每个LOD模型都存储一份完整的渲染数据,从而节省了存储空间。
可选地,上述将第二LOD模型的索引数据与第一LOD模型的索引数据关联存储的方式可以是:将第一LOD模型的索引数据存储到第一存储空间,将第二LOD模型的索引数据存储到第二存储空间,第一存储空间的最后一个地址与第二存储空间的首地址相邻。
本申请实施例中,第一存储空间和第二存储空间是连续的,第一存储空间的最后一个地址与第二存储空间的首地址是前后相邻的两个连续的地址。该方案可以将第二LOD模型的索引数据连续的存储在第一LOD模型的索引数据之后。这样针对每个LOD模型的索引数据都可以通过起始地址偏移值与长度来表示,可以简化LOD模型的索引数据的表示方式。
起始地址偏移值是一个相对的偏移值,若第一LOD模型所在的第一存储空间的起始地址是0,那么该第一LOD模型的索引数据的起始地址偏移值即为0,若第一LOD模型所在的第一存储空间的起始地址是S,那么该第一LOD模型的索引数据的起始地址偏移值即为S。索引数据的长度指的是一个LOD模型所包含的所有索引数据在存储空间中的地址长度。
在关联存储时,第一LOD模型的索引数据与第二LOD模型的索引数据的存储格式可以参阅图5进行理解。如图5所示,第一LOD模型的索引数据的起始地址偏移值为S,第一LOD模型的索引数据的长度为len1,第二LOD模型的索引数据的起始地址偏移值为M,第一LOD模型的索引数据的长度为len2。因为第一LOD模型的索引数据与第二LOD模型的索引数据是连续存储的,所以,M=S+len1。
本申请实施例中,针对同一目标对象,可以有多个简化模型,在开发阶段,终端设备响应对不同简化比例的选择操作,即可得到不同简化比例对应的LOD模型。例如,可选地,终端设备响应于对第二简化比例的选择操作,确定第三LOD模型的索引数据,第三LOD模型为目标对象对应于第二简化比例的LOD模型,第二简化比例表示第三LOD模型的索引数据相对于第一LOD模型的索引数据的比例,第三LOD模型的顶点为第一LOD模型的顶点的子集,第二简化比例小于第一简化比例;将第三LOD模型的索引数据存储到第三存储空间,第三存储空间的首地址与第二存储空间的最后一个地址相邻。
本申请实施例中,该第三LOD模型的索引数据的确定过程可以参阅上述第二LOD模型的索引数据的得到过程进行理解。该第三LOD模型的索引数据可以存储在第二LOD模型的索引数据之后,存储的格式可以参阅图6进行理解。如图6所示,第三LOD模型的索引数据的起始地址偏移值为D,该D=S+len1+len2,该第三LOD模型的索引数据的长度为len3。
可选地,本申请实施例提供的数据存储的管理方法还包括:为目标对象生成模型切换策略,模型切换策略包括切换条件和切换选择项,其中,切换条件表示触发目标对象的LOD 模型切换的切换参数与切换阈值的关系,切换选择项包括至少两个LOD模型中每个LOD模型的索引数据的起始地址偏移值和长度,至少两个LOD模型中的每个LOD模型用于渲染不同精度的目标对象;将模型切换策略和每个LOD模型的索引数据关联存储。
本申请实施例中,模型切换策略用于控制不同精度的LOD模型的切换。其中,切换条件可以是切换参数与切换阈值的比较关系,若切换参数大于切换阈值,则可以选择第一LOD模型,若切换参数小于切换阈值,则可以选择第二LOD模型。本申请实施例的模型切换策略的一个示例可以表示为:
Figure PCTCN2021096294-appb-000001
其中,If(pixelsize<=R)表示切换条件,pixelsize表示切换参数,R表示切换阈值。{sdp.indexCount=len2;sdp.indexStart=S+len1;}else{sdp.indexCount=len1;sdp.indexStart=}表示切换选择项。
本申请实施例中,切换参数包括屏占比或观察距离;屏占比表示目标对象在屏幕中的高度与屏幕的高度的比例;观察距离表示从应用场景中的虚拟相机到目标对象的距离,应用场景包括游戏场景或动画场景。
屏占比可以通过目标对象在屏幕中的高度来表示该目标对象在屏幕中的重要程度。屏占比小,则表示该目标对象在屏幕中不重要,则可以采用低精度的LOD模型来渲染该目标对象。若屏占比大,则表示该目标对象在屏幕中重要,则可以采用高精度的LOD模型来渲染该目标对象。观察距离表示可以通过目标对象距离虚拟相机的远近来表示该目标对象在屏幕中的重要程度。观察距离大,则表示该目标对象距离虚拟相机远,则表示该目标对象在屏幕中不重要,则可以采用低精度的LOD模型来渲染该目标对象。观察距离小,则表示该目标对象距离虚拟相机近,则表示该目标对象在屏幕中重要,则可以采用高精度的LOD模型来渲染该目标对象。这样,即可以保证对渲染质量的需求,也可以提高渲染效率。
当然,上述只是以一个切换阈值和两个LOD模型的起始地址偏移值和长度为例进行的说 明,实际上,在有三个或三个以上的LOD模型时,可以有多个切换阈值。针对每个目标对象都可以将上述模型切换策略作为一个组件关联存储到该目标对象的多个LOD模型的索引数据之后。
该存储关系的表示形式可以参阅图7进行理解。如图7所示,针对一个场景中的n个目标对象,每个目标对象都有三个LOD模型,分别用LOD模型1、LOD模型2和LOD模型3来表示,其中,LOD模型1是基础模型,LOD模型2和LOD模型3是简化模型。在存储时,可以存储LOD模型1的全部数据,针对LOD模型2和LOD模型3可以只存储索引数据,再关联存储每个目标对象的切换控制策略,这样,可以节省两个简化模型的顶点数据、发现数据、UV数据、纹理数据和光照贴图等数据,在保证多LOD模型都可以正常使用的前提下,节省了很多存储空间。
本申请实施例还可以将模型切换策略、关联存储的每个LOD模型的索引数据,以及第一LOD模型的渲染数据封装为目标对象的应用数据包,第一LOD模型的渲染数据用于渲染第一LOD模型所对应精度的目标对象。该第一LOD模型的渲染数据也可以理解为第一LOD模型中除第一LOD模型的索引数据之外的数据。
以上开发阶段生成应用场景中目标对象的应用数据包后,可以将应用数据包上传到如图1中的服务器,然后用户的终端设备在使用该应用时,可以从该服务器下载该应用场景的一系列应用数据包,执行运行过程,在目标对象处于不同重要程度时,切换不同的LOD模型,渲染该目标对象。下面结合图8介绍本申请实施例提供的对象渲染的过程。
如图8所示,本申请实施例提供的对象渲染的方法的一实施例包括:
201、获取触发目标对象的多细节层次LOD模型切换的切换参数。
本申请实施例中,切换参数包括屏占比或观察距离;屏占比表示目标对象在屏幕中的高度与屏幕的高度的比例;观察距离表示从应用场景中的虚拟相机到目标对象的距离,应用场景包括游戏场景或动画场景。
屏占比可以通过目标对象在屏幕中的高度来表示该目标对象在屏幕中的重要程度。屏占比小,则表示该目标对象在屏幕中不重要,则可以采用低精度的LOD模型来渲染该目标对象。若屏占比大,则表示该目标对象在屏幕中重要,则可以采用高精度的LOD模型来渲染该目标对象。
观察距离表示可以通过目标对象距离虚拟相机的远近来表示该目标对象在屏幕中的重要程度。观察距离大,则表示该目标对象距离虚拟相机远,则表示该目标对象在屏幕中不重要,则可以采用低精度的LOD模型来渲染该目标对象。观察距离小,则表示该目标对象距离虚拟相机近,则表示该目标对象在屏幕中重要,则可以采用高精度的LOD模型来渲染该目标对象。
202、根据切换参数,确定目标LOD模型的索引数据。
目标LOD模型为目标对象对应的至少两个LOD模型中的一个,至少两个LOD模型中的每个LOD模型用于渲染不同精度的目标对象。
203、从第一LOD模型的渲染数据中获取与目标LOD模型的索引数据对应的目标渲染数据。目标渲染数据包含于第一LOD模型的渲染数据,第一LOD模型是预配置的基础模型。
204、根据目标渲染数据渲染与目标LOD模型对应精度的目标对象。
本申请实施例中,因为目标LOD模型可以复用第一LOD模型中除索引数据之外的数据,这样终端设备或服务器针对一个目标对象的多个LOD模型,只要关联存储多个LOD模型的索引数据,再存储一份第一LOD模型中除索引数据之外的用于渲染目标对象的数据即可,这样,不需要针对每个LOD模型都存储一份完整的渲染数据,从而节省了存储空间。
可选地,上述步骤202可以包括:根据所述切换参数与切换阈值的关系,确定目标切换选择项,所述目标切换选择项包括所述目标LOD模型的索引数据的起始地址偏移值和长度;根据所述目标LOD模型的索引数据的起始地址偏移值和长度,确定所述目标LOD模型的索引数据的目标存储空间;从所述目标存储空间获取所述目标LOD模型的索引数据。
可选地,上述根据所述目标LOD模型的索引数据的起始地址偏移值和长度,确定所述目标LOD模型的索引数据的目标存储空间,包括:根据所述目标LOD模型的索引数据的起始地址偏移值,从用于存储所述至少两个LOD模型的索引数据的索引存储空间中确定所述目标LOD模型的索引数据的起始位置,所述至少两个LOD模型的索引数据在所述索引存储空间中按照所述至少两个LOD模型中每个LOD模型得到的顺序连续存储;根据所述目标LOD模型的索引数据的起始位置,以及所述目标LOD模型的索引数据的长度,确定所述目标LOD模型的索引数据的目标存储空间。
本申请实施例中,在存储目标对象的多个LOD模型的索引数据采用的是连续存储的方式,例如:图5和图6所示的存储方式,因此可以通过每个LOD模型的索引数据的起始地址偏移值和长度来指示该LOD模型的索引数据的存储空间。例如:通过S和len1就可以查找到第一存储空间,通过M和len2就可以查找到第二存储空间,从而从相应的目标存储空间获取到目标LOD模型的索引数据。因为通过LOD模型的索引数据的起始地址偏移值和长度可以快速确定目标存储空间,再从相应存储空间中快速查找到相应LOD模型的索引数据,进而完成渲染。因此,该种可能的实现方式可以提高目标对象渲染的效率。
可选地,本申请实施例中还包括:将切换接口中的数据更新为所述目标LOD模型的索引数据的起始地址偏移值和长度,所述切换接口用于配置用于更新所述目标对象所使用的LOD模型的索引数据的起始地址偏移值和长度。
本申请实施例中,可以通过切换接口来控制所采用的LOD模型,本申请中,需要将被选中的目标LOD模型的索引数据的起始地址偏移值和长度配置到该切换接口中,接下来在渲染过程中,该目标LOD模型才能被执行。这种通过切换接口来控制所采用的LOD模型的方式,有利于准确控制对LOD模型的使用。
该过程可以参阅上述切换控制策略的示例进行理解。该切换接口可以包括SubMeshDescriptor和Mesh.SetSubMesh,将目标LOD模型的索引数据的起始地址偏移值和长度写入到SubMeshDescriptor接口中,再通过Mesh.SetSubMesh接口去生效,这样,在执行渲染时,就会使用该目标LOD模型的去渲染目标对象。
在测试阶段,开发人员做了大量的实验,来验证本申请的方案对应用数据包的体积和帧率方面的影响。
在测试过程中,选用真实游戏中的森林场景进行测试,场景中对象总个数209,总的三角面数目为745.2千(k)个,分别固定对象的简化比例和屏占比作为切换阈值时进行简模 效果分析。关于简化比例和屏占比,例如,简化比例设置为0.5时,表示期望将模型的三角面数目简化至原来三角面数目的50%,最终效果可能会与期望效果存在一定差距;屏占比作为切换阈值时,该切换阈值设置为0.35时,表示在运行过程中,若对象在场景中所占像素的高度小于屏幕高度的35%,使用简化模型,否则,使用原始模型。
固定简化比例为0.5,调整屏占比,实验结果如表2所示。
表2:实验结果
屏占比 APK(M) Tris(k) 帧率
初始(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
根据表2数据可以看出,屏占比为初始值时LOD模型的APK为58.57兆(M),三角面(Tris)的数量为745.2k个,帧率为37.23。在简化比例为0.5时,切换阈值设置为0.35、0.3或0.25时的数据可以参阅表2中的后面三行,在该场景中,通过后面三行与屏占比为初始值的数据对比可知,使用本方案提供的LOD优化方法后,应用数据包(APK)体积只增加2M左右;LOD将切换阈值设为0.35时,可以得到4帧收益,随着屏占比值的下降,帧率有所降低,但并不明显。
固定LOD切换的屏占比为0.35,调整简化比例,实验结果如表3所示。
表3:实验结果
简化比例 APK(M) Tris(k) 帧率
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
根据表3数据可以看出,增大模型简化比例的同时,APK的包体积会进一步减少,同时帧率也会得到更大的提升。简化比例降至0.3时,帧率可以提升8帧左右。
以上描述了开发阶段的数据存储的管理方法,以及运行阶段的对象渲染的方法,下面结合附图介绍本申请实施例提供的装置。
如图9所示,本申请实施例提供的数据存储的管理装置30的一实施例包括:
获取单元301,用于获取第一多细节层次LOD模型的索引数据,第一LOD模型为预配置的用于渲染目标对象的基础模型,索引数据用于标记第一LOD模型的顶点。
响应单元302,用于响应于对第一简化比例的选择操作,确定第二LOD模型的索引数据,第二LOD模型为目标对象对应于第一简化比例的LOD模型,第一简化比例表示第二LOD模型的索引数据相对于第一LOD模型的索引数据的比例,第二LOD模型的顶点为第一LOD模型的顶点的子集。
存储管理单元303,用于存储第二LOD模型的索引数据。具体的,存储管理单元303用于将第二LOD模型的索引数据与第一LOD模型的索引数据关联存储。
本申请实施例中,针对同一目标对象的多个LOD模型,预先配置的第一LOD模型中的顶点可以在简化的LOD模型中复用,那么与所复用的顶点相关的用于渲染目标对象的渲染数据也可以复用,这样就不需要再为简化处理后的第二LOD模型生成这渲染数据,提高了生成简化模型的效率。另外,因为,简化的LOD模型可以复用第一LOD模型中除索引数据之外的数据,针对一个目标对象的多个LOD模型,只要关联存储多个LOD模型的索引数据,再存储一份第一LOD模型中除索引数据之外的渲染数据即可,这样,不需要针对每个LOD模型都存储一份完整的渲染数据,从而节省了存储空间。
可选地,存储管理单元303,用于将第一LOD模型的索引数据存储到第一存储空间,将第二LOD模型的索引数据存储到第二存储空间,第一存储空间的最后一个地址与第二存储空间的首地址相邻。
可选地,响应单元302,还用于响应于对第二简化比例的选择操作,确定第三LOD模型的索引数据,第三LOD模型为目标对象对应于第二简化比例的LOD模型,第二简化比例表示第三LOD模型的索引数据相对于第一LOD模型的索引数据的比例,第三LOD模型的顶点为第一LOD模型的顶点的子集,第二简化比例小于第一简化比例。
存储管理单元303,还用于将第三LOD模型的索引数据存储到第三存储空间,第三存储空间的首地址与第二存储空间的最后一个地址相邻。
可选地,数据存储的管理装置30还包括处理单元,该处理单元,用于为目标对象生成模型切换策略,模型切换策略包括切换条件和切换选择项,其中,切换条件表示触发目标对象的LOD模型切换的切换参数与切换阈值的关系,切换选择项包括至少两个LOD模型中每个LOD模型的索引数据的起始地址偏移值和长度,至少两个LOD模型中的每个LOD模型用于渲染不同精度的目标对象。
存储管理单元303,还用于将模型切换策略和每个LOD模型的索引数据关联存储。
可选地,处理单元,还用于将模型切换策略、关联存储的每个LOD模型的索引数据,以及第一LOD模型的渲染数据封装为目标对象的应用数据包,第一LOD模型的渲染数据用于渲染第一LOD模型所对应精度的目标对象。也可以理解为第一LOD模型的渲染数据为第一LOD模型中除第一LOD模型的索引数据之外的数据。
可选地,切换参数包括屏占比或观察距离;屏占比表示目标对象在屏幕中的高度与屏幕的高度的比例;观察距离表示从应用场景中的虚拟相机到目标对象的距离,应用场景包括游戏场景或动画场景。
以上所描述的数据存储的管理装置30可以参阅前述方法实施例部分的相应描述进行理解,此处不做重复赘述。
如图10所示,本申请实施例提供的对象渲染的装置40的一实施例包括:
第一获取单元401,用于获取触发目标对象的多细节层次LOD模型切换的切换参数。
确定单元402,用于根据切换参数,确定目标LOD模型的索引数据,目标LOD模型为目标对象对应的至少两个LOD模型中的一个,至少两个LOD模型中的每个LOD模型用于渲染不同精度的目标对象。
第二获取单元403,还用于从第一LOD模型的渲染数据中获取与目标LOD模型的索引数据 对应的目标渲染数据,目标渲染数据包含于第一LOD模型的渲染数据,第一LOD模型是预配置的基础模型。
渲染单元404,用于根据目标渲染数据渲染与目标LOD模型对应精度的目标对象。
本申请实施例中,因为目标LOD模型可以复用第一LOD模型中除索引数据之外的数据,这样终端设备或服务器针对一个目标对象的多个LOD模型,只要关联存储多个LOD模型的索引数据,再存储一份第一LOD模型中除索引数据之外的用于渲染目标对象的数据即可,这样,不需要针对每个LOD模型都存储一份完整的渲染数据,从而节省了存储空间。
可选地,确定单元402,用于根据切换参数与切换阈值的关系,确定目标切换选择项,目标切换选择项包括目标LOD模型的索引数据的起始地址偏移值和长度;根据目标LOD模型的索引数据的起始地址偏移值和长度,确定目标LOD模型的索引数据的目标存储空间;从目标存储空间获取目标LOD模型的索引数据。
可选地,确定单元402,用于根据目标LOD模型的索引数据的起始地址偏移值,从用于存储至少两个LOD模型的索引数据的索引存储空间中确定目标LOD模型的索引数据的起始位置,至少两个LOD模型的索引数据在索引存储空间中按照至少两个LOD模型中每个LOD模型得到的顺序连续存储;根据目标LOD模型的索引数据的起始位置,以及目标LOD模型的索引数据的长度,确定目标LOD模型的索引数据的目标存储空间。
可选地,确定单元402,还用于将切换接口中的数据更新为目标LOD模型的索引数据的起始地址偏移值和长度,切换接口用于配置用于更新目标对象所使用的LOD模型的索引数据的起始地址偏移值和长度。
可选地,切换参数包括屏占比或观察距离;屏占比表示目标对象在屏幕中的高度与屏幕的高度的比例;观察距离表示从应用场景中的虚拟相机到目标对象的距离。
可选地,目标对象为应用场景中的静态对象,应用场景包括游戏场景或动画场景。
以上所描述的对象渲染的装置40可以参阅前述方法实施例部分的相应描述进行理解,此处不做重复赘述。
图11所示,为本申请的实施例提供的计算机设备50的一种可能的逻辑结构示意图。计算机设备50可以是上述的数据存储的管理装置30或者对象渲染的装置40,该计算机设备50包括:处理器501、通信接口502、存储器503以及总线504。处理器501、通信接口502以及存储器503通过总线504相互连接。在本申请的实施例中,处理器501用于对计算机设备50的动作进行控制管理,例如,处理器501用于执行图2至图8的方法实施例中101至103、201至204的步骤,通信接口502用于支持计算机设备50进行通信。存储器503,用于存储计算机设备50的程序代码和数据。
其中,处理器501可以包括中央处理器单元(central processing unit,CPU)和图形处理器(graphic processing unit GPU),CPU还可以替换为通用处理器,数字信号处理器,专用集成电路,现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器501也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理器和微处理器的组合等等。总线504可以是外设部件互连标准 (Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图11中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
在本申请的另一实施例中,还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,当设备的处理器执行该计算机执行指令时,设备执行上述图2至图7中数据存储的方法。
在本申请的另一实施例中,还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,当设备的处理器执行该计算机执行指令时,设备执行上述图8中对象渲染的方法。
在本申请的另一实施例中,还提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中;当设备的处理器执行该计算机执行指令时,设备执行上述图2至图7中数据存储的管理方法。
在本申请的另一实施例中,还提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中;当设备的处理器执行该计算机执行指令时,设备执行上述图8中对象渲染的方法。
在本申请的另一实施例中,还提供一种芯片系统,该芯片系统包括处理器,该处理器用于支持内存管理的装置实现上述图2至图7中内数据存储的管理方法。在一种可能的设计中,芯片系统还可以包括存储器,存储器,用于保存内存管理的装置必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
在本申请的另一实施例中,还提供一种芯片系统,该芯片系统包括处理器,该处理器用于支持内存管理的装置实现上述图8中内对象渲染的方法。在一种可能的设计中,芯片系统还可以包括存储器,存储器,用于保存内存管理的装置必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请实施例所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请实施例各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请实施例各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上,仅为本申请实施例的具体实施方式,但本申请实施例的保护范围并不局限于此。

Claims (21)

  1. 一种数据存储的管理方法,其特征在于,包括:
    获取第一多细节层次LOD模型的索引数据,所述第一LOD模型为预配置的用于渲染目标对象的基础模型,所述索引数据用于标记所述第一LOD模型的顶点;
    响应于对第一简化比例的选择操作,确定第二LOD模型的索引数据,所述第二LOD模型为所述目标对象对应于所述第一简化比例的LOD模型,所述第一简化比例表示所述第二LOD模型的索引数据相对于所述第一LOD模型的索引数据的比例,所述第二LOD模型的顶点为所述第一LOD模型的顶点的子集;
    存储所述第二LOD模型的索引数据。
  2. 根据权利要求1所述的方法,其特征在于,所述存储所述第二LOD模型的索引数据包括:将所述第二LOD模型的索引数据与所述第一LOD模型的索引数据关联存储。
  3. 根据权利要求2所述的方法,其特征在于,所述将所述第二LOD模型的索引数据与所述第一LOD模型的索引数据关联存储,包括:
    将所述第一LOD模型的索引数据存储到第一存储空间,将所述第二LOD模型的索引数据存储到第二存储空间,所述第一存储空间的最后一个地址与所述第二存储空间的首地址相邻。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    响应于对第二简化比例的选择操作,确定第三LOD模型的索引数据,所述第三LOD模型为所述目标对象对应于所述第二简化比例的LOD模型,所述第二简化比例表示所述第三LOD模型的索引数据相对于所述第一LOD模型的索引数据的比例,所述第三LOD模型的顶点为所述第一LOD模型的顶点的子集,所述第二简化比例小于所述第一简化比例;
    将所述第三LOD模型的索引数据存储到第三存储空间,所述第三存储空间的首地址与所述第二存储空间的最后一个地址相邻。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述方法还包括:
    为所述目标对象生成模型切换策略,所述模型切换策略包括切换条件和切换选择项,其中,所述切换条件表示触发所述目标对象的LOD模型切换的切换参数与切换阈值的关系,所述切换选择项包括至少两个LOD模型中每个LOD模型的索引数据的起始地址偏移值和长度,所述至少两个LOD模型中的每个LOD模型用于渲染不同精度的所述目标对象;
    将所述模型切换策略和所述每个LOD模型的索引数据关联存储。
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:
    将所述模型切换策略、所述每个LOD模型的索引数据,以及所述第一LOD模型的渲染数据封装为所述目标对象的应用数据包,所述第一LOD模型的渲染数据用于渲染所述第一LOD模型所对应精度的目标对象。
  7. 根据权利要求5或6所述的方法,其特征在于,所述切换参数包括屏占比或观察距离;
    所述屏占比表示所述目标对象在屏幕中的高度与所述屏幕的高度的比例;
    所述观察距离表示从应用场景中的虚拟相机到所述目标对象的距离,所述应用场景包括游戏场景或动画场景。
  8. 一种对象渲染的方法,其特征在于,包括:
    获取触发目标对象的多细节层次LOD模型切换的切换参数;
    根据所述切换参数,确定目标LOD模型的索引数据,所述目标LOD模型为所述目标对象对应的至少两个LOD模型中的一个,所述至少两个LOD模型中的每个LOD模型用于渲染不同精度的所述目标对象;
    从第一LOD模型的渲染数据中获取与所述目标LOD模型的索引数据对应的目标渲染数据,所述第一LOD模型是预配置的基础模型;
    根据所述目标渲染数据渲染与所述目标LOD模型对应精度的所述目标对象。
  9. 根据权利要求8所述的方法,其特征在于,所述根据所述切换参数,确定目标LOD模型的索引数据,包括:
    根据所述切换参数与切换阈值的关系,确定目标切换选择项,所述目标切换选择项包括所述目标LOD模型的索引数据的起始地址偏移值和长度;
    根据所述目标LOD模型的索引数据的起始地址偏移值和长度,确定所述目标LOD模型的索引数据的目标存储空间;
    从所述目标存储空间获取所述目标LOD模型的索引数据。
  10. 根据权利要求9所述的方法,其特征在于,所述根据所述目标LOD模型的索引数据的起始地址偏移值和长度,确定所述目标LOD模型的索引数据的目标存储空间,包括:
    根据所述目标LOD模型的索引数据的起始地址偏移值,从用于存储所述至少两个LOD模型的索引数据的索引存储空间中确定所述目标LOD模型的索引数据的起始位置,所述至少两个LOD模型的索引数据在所述索引存储空间中按照所述至少两个LOD模型中每个LOD模型得到的顺序连续存储;
    根据所述目标LOD模型的索引数据的起始位置,以及所述目标LOD模型的索引数据的长度,确定所述目标LOD模型的索引数据的目标存储空间。
  11. 根据权利要求9或10所述的方法,其特征在于,所述根据所述切换参数与切换阈值的关系,确定目标切换选择项之后,所述方法还包括:
    将切换接口中的数据更新为所述目标LOD模型的索引数据的起始地址偏移值和长度,所述切换接口用于配置用于更新所述目标对象所使用的LOD模型的索引数据的起始地址偏移值和长度。
  12. 根据权利要求8-11任一项所述的方法,其特征在于,所述切换参数包括屏占比或观察距离;
    所述屏占比表示所述目标对象在屏幕中的高度与所述屏幕的高度的比例;
    所述观察距离表示从应用场景中的虚拟相机到所述目标对象的距离。
  13. 根据权利要求8-12任一项所述的方法,其特征在于,所述目标对象为应用场景中的静态对象,所述应用场景包括游戏场景或动画场景。
  14. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被一个或多个处理器执行时实现如权利要求1-7任一项所述的方法。
  15. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序 被一个或多个处理器执行时实现如权利要求8-13任一项所述的方法。
  16. 一种计算设备,其特征在于,包括一个或多个处理器和存储有计算机程序的计算机可读存储介质;
    所述一个或多个处理器与所述计算机可读存储介质耦合,所述计算机程序被所述一个或多个处理器执行时实现如权利要求1-7任一项所述的方法。
  17. 一种计算设备,其特征在于,包括一个或多个处理器和存储有计算机程序的计算机可读存储介质;
    所述一个或多个处理器与所述计算机可读存储介质耦合,所述计算机程序被所述一个或多个处理器执行时实现如权利要求8-13任一项所述的方法。
  18. 一种芯片系统,其特征在于,包括一个或多个处理器,所述一个或多个处理器被调用用于执行如权利要求1-7任一项所述的方法。
  19. 一种芯片系统,其特征在于,包括一个或多个处理器,所述一个或多个处理器被调用用于执行如权利要求8-13任一项所述的方法。
  20. 一种计算机程序产品,其特征在于,包括计算机程序,所述计算机程序当被一个或多个处理器执行时用于实现如权利要求1-7任一项所述的方法。
  21. 一种计算机程序产品,其特征在于,包括计算机程序,所述计算机程序当被一个或多个处理器执行时用于实现如权利要求8-13任一项所述的方法。
PCT/CN2021/096294 2020-11-13 2021-05-27 一种数据存储的管理方法、对象渲染的方法及设备 WO2022100059A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
EP21890590.9A EP4231243A4 (en) 2020-11-13 2021-05-27 DATA STORAGE MANAGEMENT METHOD, OBJECT RENDERING METHOD AND DEVICE

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011276117.4A CN114565709A (zh) 2020-11-13 2020-11-13 一种数据存储的管理方法、对象渲染的方法及设备
CN202011276117.4 2020-11-13

Publications (1)

Publication Number Publication Date
WO2022100059A1 true WO2022100059A1 (zh) 2022-05-19

Family

ID=81600699

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/096294 WO2022100059A1 (zh) 2020-11-13 2021-05-27 一种数据存储的管理方法、对象渲染的方法及设备

Country Status (3)

Country Link
EP (1) EP4231243A4 (zh)
CN (1) CN114565709A (zh)
WO (1) WO2022100059A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115393524A (zh) * 2022-09-02 2022-11-25 广东国地规划科技股份有限公司 一种基于三维游戏引擎的三维模型渲染方法及系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110910505A (zh) * 2019-11-29 2020-03-24 西安建筑科技大学 一种场景模型的加速渲染方法
CN111199572A (zh) * 2019-12-20 2020-05-26 江苏原力动画制作股份有限公司 基于连续简化的超大几何体实时渲染方法
US10719994B2 (en) * 2016-03-31 2020-07-21 Intel Corporation Three-dimensional subject comparison with efficient processing
CN111462318A (zh) * 2020-05-26 2020-07-28 南京大学 一种基于视点互信息的三维树木模型实时简化方法

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9928643B2 (en) * 2015-09-28 2018-03-27 Douglas Rogers Hierarchical continuous level of detail for three-dimensional meshes

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10719994B2 (en) * 2016-03-31 2020-07-21 Intel Corporation Three-dimensional subject comparison with efficient processing
CN110910505A (zh) * 2019-11-29 2020-03-24 西安建筑科技大学 一种场景模型的加速渲染方法
CN111199572A (zh) * 2019-12-20 2020-05-26 江苏原力动画制作股份有限公司 基于连续简化的超大几何体实时渲染方法
CN111462318A (zh) * 2020-05-26 2020-07-28 南京大学 一种基于视点互信息的三维树木模型实时简化方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4231243A4

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115393524A (zh) * 2022-09-02 2022-11-25 广东国地规划科技股份有限公司 一种基于三维游戏引擎的三维模型渲染方法及系统

Also Published As

Publication number Publication date
EP4231243A4 (en) 2024-07-10
EP4231243A1 (en) 2023-08-23
CN114565709A (zh) 2022-05-31

Similar Documents

Publication Publication Date Title
US11024077B2 (en) Global illumination calculation method and apparatus
CN112652044B (zh) 粒子特效渲染方法、装置、设备及存储介质
CN109377546B (zh) 虚拟现实模型渲染方法及装置
CN107358649B (zh) 地形文件的处理方法和装置
US9589386B2 (en) System and method for display of a repeating texture stored in a texture atlas
CN112215934A (zh) 游戏模型的渲染方法、装置、存储介质及电子装置
US9275493B2 (en) Rendering vector maps in a geographic information system
US9224233B2 (en) Blending 3D model textures by image projection
CN108765520B (zh) 文本信息的渲染方法和装置、存储介质、电子装置
US20230120253A1 (en) Method and apparatus for generating virtual character, electronic device and readable storage medium
US11615575B2 (en) Methods and systems for constructing a shader
CN115147579B (zh) 一种扩展图块边界的分块渲染模式图形处理方法及系统
US9396515B2 (en) Rendering using multiple render target sample masks
US10134171B2 (en) Graphics processing systems
US10157498B2 (en) System and method for procedurally generated object distribution in regions of a three-dimensional virtual environment
CN111882631B (zh) 一种模型渲染方法、装置、设备及存储介质
WO2022100059A1 (zh) 一种数据存储的管理方法、对象渲染的方法及设备
CN114375464A (zh) 使用边界体积表示对虚拟空间中的动态单元进行光线追踪
CN110930484A (zh) 动画配置方法和装置、存储介质及电子装置
CN118043842A (zh) 一种渲染格式选择方法及其相关设备
WO2018175299A1 (en) System and method for rendering shadows for a virtual environment
EP4002289A1 (en) Picture processing method and device, storage medium, and electronic apparatus
CN114299202A (zh) 虚拟场景制作的处理方法及装置、存储介质、终端
CN112274934B (zh) 模型渲染方法、装置、设备及存储介质
CN117115382B (zh) 地图道路绘制方法、装置、计算机设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21890590

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2021890590

Country of ref document: EP

Effective date: 20230516

NENP Non-entry into the national phase

Ref country code: DE