Rendering method and device and computing equipment
By using cached mesh data with a lower precision than required during GPU rendering, and dynamically managing hierarchical details, the memory overflow problem is solved, improving rendering quality and the realism of object models.
Patent Information
- Application Number
- CN202511282728.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-09
- Publication Date
- 2025-11-14
AI Technical Summary
In existing rendering technologies, GPUs need to load high-precision mesh data of multiple levels of detail of the object model into memory completely, which leads to memory overflow and limits the improvement of rendering quality and accuracy.
When the required high-precision grid data is not cached in memory, cached grid data with lower precision is used for rendering. Grid data with varying levels of detail is dynamically loaded and deleted to avoid excessive memory usage.
It achieves smooth rendering while avoiding memory overflow, improving rendering quality and the realism of object models, and avoiding memory waste.
Smart Images

Figure CN120953467A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of rendering technology, and particularly to rendering methods. This application also relates to a rendering apparatus, a computing device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] With the development of computer technology, applications such as games, virtual simulation, virtual reality, and augmented reality have increasingly higher requirements for the realism of the visuals and the interactive experience. These applications usually rely on efficient rendering technology to achieve high-quality visual presentation, especially in special effects scenes containing a large number of three-dimensional object models or dynamic scene changes, where the efficiency of rendering technology is required to be even higher.
[0003] Currently, to improve rendering efficiency, object models (such as buildings, trees, and virtual game characters) are typically rendered in graphics processing units (GPUs) with powerful data parallel processing capabilities. However, current rendering techniques require the GPU to load high-precision mesh data of multiple levels of detail (LOD) corresponding to the object model completely into memory. Since the amount of high-precision mesh data across multiple levels of detail is large, and memory capacity is limited, memory overflow is highly likely. This also limits the accuracy of the object model and the quality of the rendered special effects scenes. Summary of the Invention
[0004] In view of this, embodiments of this application provide a rendering method. This application also relates to a rendering apparatus, a computing device, a computer-readable storage medium, and a computer program product, to solve the aforementioned problems existing in the prior art.
[0005] According to a first aspect of the embodiments of this application, a rendering method is provided, including: Receive rendering instructions for a target virtual scene, wherein the target virtual scene includes at least one object to be rendered; For the current frame in the target virtual scene, determine the rendering region corresponding to the object to be rendered in the current frame; From multiple pre-built layers of detail, determine the current layer of detail corresponding to each region to be rendered in the current frame; If the first grid data is not cached, each region to be rendered in the current frame is rendered based on the cached second grid data. The first grid data is the grid data of the current level of detail corresponding to the region to be rendered, and the data precision of the second grid data is lower than that of the first grid data.
[0006] According to a second aspect of the embodiments of this application, a rendering apparatus is provided, comprising: The receiving module is configured to receive rendering instructions for a target virtual scene, wherein the target virtual scene includes at least one object to be rendered; The first determining module is configured to determine the rendering region corresponding to the object to be rendered in the current frame of the target virtual scene. The second determining module is configured to determine the current level detail corresponding to each region to be rendered in the current frame from a pre-built set of multiple level details. The rendering module is configured to render each region to be rendered in the current frame based on the cached second grid data when the first grid data is not cached. The first grid data is the grid data of the current level detail corresponding to the region to be rendered, and the data precision of the second grid data is lower than that of the first grid data.
[0007] According to a third aspect of the embodiments of this application, a computing device is provided, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the above-described rendering method.
[0008] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided that stores a computer program / instructions that, when executed by a processor, implement the steps of the rendering method described above.
[0009] According to a fifth aspect of the embodiments of this application, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the rendering method described above.
[0010] The rendering method provided in this application receives a rendering instruction for a target virtual scene, wherein the target virtual scene includes at least one object to be rendered; for the current frame in the target virtual scene, determines the region to be rendered corresponding to the object to be rendered in the current frame; determines the current level detail corresponding to each region to be rendered in the current frame from a pre-constructed plurality of level details; and renders each region to be rendered in the current frame according to the cached second grid data when the first grid data is not cached, wherein the first grid data is the grid data of the current level detail corresponding to the region to be rendered, and the data precision of the second grid data is lower than the data precision of the first grid data.
[0011] One embodiment of this application realizes that when rendering a target virtual scene, if the first grid data of the current level of detail that is currently needed is not cached in memory, the second grid data with a data precision lower than that of the first grid data that has been cached can be used to render the area to be rendered. This ensures smooth execution of rendering while avoiding problems such as excessive memory usage or even overflow. Attached Figure Description
[0012] Figure 1 This is a flowchart of a rendering method provided in an embodiment of this application; Figure 2 This is a flowchart of determining a rendering area provided in one embodiment of this application; Figure 3 This is a flowchart illustrating the details of a construction hierarchy provided in one embodiment of this application; Figure 4 This is a flowchart illustrating the partitioning of grid data groups according to an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a rendering apparatus provided in an embodiment of this application; Figure 6 This is a structural block diagram of a computing device provided in one embodiment of this application. Detailed Implementation
[0013] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0014] The terminology used in one or more embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this application. The singular forms “a,” “the,” and “the” used in one or more embodiments of this application and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of this application refers to and includes any or all possible combinations of one or more associated listed items.
[0015] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this application, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0016] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0017] In the field of scene rendering, high-precision mesh data and hierarchical details are crucial for achieving realistic visual effects. Typically, engineers pre-build high-precision mesh data for object models using modeling tools. Based on this high-precision mesh data, they then pre-build multiple levels of detail, or hierarchical detail levels, for each object model. In other words, multiple levels of detail mesh data need to be prepared in advance for each object model. Different levels of detail represent different data precisions in the mesh data; that is, each level of detail represents a specific data precision, and the mesh data corresponding to a specific level of detail is mesh data with a specific data precision. There is a one-to-one correspondence between levels of detail and data precision.
[0018] However, in current mainstream scene rendering methods, to ensure data availability during rendering, the multi-layered detailed mesh data corresponding to the object model needs to be fully loaded into memory. However, each object model often contains tens of thousands or even millions of triangles, and each vertex of a triangle typically includes numerous attributes such as position, normal, coordinates, and color. This results in the mesh data of each object model reaching tens or even hundreds of megabytes, making it highly susceptible to memory overflow issues. Given limited memory capacity, some methods simplify the object model, such as reducing the number of triangles or lowering texture resolution, sacrificing realism and detail to avoid memory overload. In summary, current scene rendering methods are prone to excessive memory usage and even overflow, limiting the quality of the scene's visuals.
[0019] Based on this, when performing scene rendering, this application can receive rendering instructions for a target virtual scene, wherein the target virtual scene includes at least one object to be rendered; for the current frame in the target virtual scene, determine the region to be rendered corresponding to the object to be rendered in the current frame; determine the current level detail corresponding to each region to be rendered in the current frame from a pre-constructed multiple level details; and render each region to be rendered in the current frame according to the cached second grid data if the first grid data is not cached, wherein the first grid data is the grid data of the current level detail corresponding to the region to be rendered, and the data precision of the second grid data is lower than that of the first grid data.
[0020] If the required first grid data is not cached in memory, the second grid data with a lower precision than the first grid data can be used to render the area to be rendered. This ensures smooth rendering. During the rendering process, only the grid data of the current level of detail corresponding to the area to be rendered in the current frame needs to be loaded, instead of loading all the grid data of all levels of detail into memory, thus avoiding excessive memory usage or even overflow.
[0021] Furthermore, to avoid excessive memory usage, it is not necessary to sacrifice the realism and detail of the object model. That is, there is no need to sacrifice the number of layers of detail or the accuracy of the mesh data. By streaming the required layer of detail mesh data through this application, several layers of detail mesh data can be divided according to actual needs, and high-precision mesh data can be generated according to actual needs. This can ensure that memory does not overflow and that the accuracy of the object model is guaranteed, that is, the realism and detail of the object model are guaranteed.
[0022] In addition, since memory can load mesh data of all levels of detail, and not every level of detail mesh data is used during rendering, the method in this application that does not need to load all level of detail mesh data into memory can also avoid memory waste.
[0023] This application provides a rendering method, and also relates to a rendering apparatus, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.
[0024] Figure 1 A flowchart of a rendering method according to an embodiment of this application is shown, which specifically includes the following steps: Step 102: Receive rendering instructions for a target virtual scene, wherein the target virtual scene includes at least one object to be rendered.
[0025] Specifically, the target virtual scene refers to the virtual scene that needs to be rendered within a virtual environment. In practical applications, the target virtual scene can be a scene in a game that needs rendering, a scene in a video that needs rendering, and so on. The virtual scene typically includes at least one object to be rendered, which refers to the object model that needs to be rendered in the target virtual scene. For example, the target virtual scene may include building models, character models, animal models, plant models, etc. In practical applications, the target virtual scene usually includes more than one object to be rendered.
[0026] In one embodiment of this specification, the target virtual scene typically includes multiple objects to be rendered. When a target virtual scene needs to be constructed, high-precision mesh data corresponding to each object to be rendered in the target virtual scene can be pre-constructed, and mesh data of multiple levels of detail can be pre-constructed based on the high-precision mesh data. Of course, the pre-constructed high-precision mesh data corresponding to the objects to be rendered can also be considered as a level of detail, and the high-precision mesh data often has the highest precision.
[0027] It should be noted that the executing entity for the technical solution in this specification can be a terminal. Of course, in some rendering scenarios where real-time requirements are not high, the executing entity can also be a server.
[0028] In one or more embodiments of this specification, the entire rendering process is performed on the terminal's GPU. In one embodiment of this specification, a user can run an application (such as a game application or video player) on the terminal, thereby enabling the terminal to receive rendering instructions for a target virtual scene, which includes multiple objects to be rendered. Simultaneously, the rendering instructions typically include rendering information corresponding to each model to be rendered, such as material information, texture information, lighting information, etc. Then, based on the received rendering instructions, the terminal can complete the rendering of the target virtual scene using the GPU.
[0029] In practical applications, pre-built mesh data with multiple levels of detail is typically stored on the terminal's local storage medium, such as a hard drive. Due to the high latency of accessing data from the hard drive, data is usually loaded into memory, meaning all levels of detail mesh data are loaded into memory to improve access efficiency. As mentioned earlier, loading multiple levels of detail mesh data into memory can easily lead to excessive memory usage or even overflow. Therefore, in one or more embodiments of this specification, before rendering the target virtual scene, only mesh data with levels of detail less than a preset data volume threshold can be loaded into memory, such as mesh data with the lowest represented data precision. For example, if two levels of detail are pre-built, mesh data for level A and mesh data for level B, where level A represents dividing the mesh data into 1000 triangular faces and level B represents dividing the mesh data into 500 triangular faces, then before rendering the target virtual scene, the mesh data for level B can be loaded into memory.
[0030] It should be understood that during the execution of rendering instructions by the GPU, the GPU can communicate with the CPU to obtain the mesh data of the target level detail corresponding to the region to be rendered, which is required for the execution of the rendering instructions. Therefore, in one or more embodiments of this specification, during the execution of rendering instructions by the GPU, the terminal device determines the mesh data of the target level detail corresponding to the region to be rendered in the current frame, and then requests the CPU to load the mesh data of the target level detail corresponding to the region to be rendered. After responding to the GPU request, the CPU extracts the mesh data of the target level detail corresponding to the region to be rendered from a local storage medium such as a hard disk and loads it into memory. Subsequently, the GPU asynchronously uploads it to the video memory for rendering in the current frame or subsequent frames.
[0031] Step 104: For the current frame in the target virtual scene, determine the rendering area corresponding to the object to be rendered in the current frame.
[0032] The target virtual scene consists of multiple frames, typically a continuous animation sequence, with each frame representing the state of the scene at a specific moment. In this specification, upon receiving a rendering command, the current frame in the target virtual scene can be determined. The current frame refers to the frame being processed by the terminal, which performs frame-by-frame rendering of the target virtual scene using the GPU.
[0033] In one embodiment of this specification, the terminal can determine the rendering area corresponding to the object to be rendered in the current frame of the target virtual scene.
[0034] In this specification, the area to be rendered specifically refers to the part of the target virtual scene that needs to be rendered. For example, when the object to be rendered is a house, the house is surrounded by walls. The part of the house's interior that is obscured by opaque walls is not visually visible and therefore does not need to be rendered. However, the glass in the house is semi-transparent, allowing the interior layout to be seen through the glass. The part of the interior visible through the glass is the area to be rendered. In other words, the area to be rendered refers to the area of the object that is considered visible or needs to be rendered for each object in the current frame.
[0035] In one or more embodiments of this specification, the rendering area corresponding to each object to be rendered can be determined according to a preset algorithm. This preset algorithm can be a frustum culling algorithm, an occlusion culling algorithm, a material-based visibility analysis algorithm, or a gaze tracking algorithm, etc. The frustum culling algorithm aims to determine whether the object to be rendered is within the camera's field of view; if not, it is directly culled, and the area within the field of view is the rendering area. The occlusion culling algorithm aims to determine whether the object to be rendered is occluded by other objects; occluded areas are not rendered, and unoccluded areas are the rendering area. The material-based visibility analysis algorithm analyzes the material (e.g., transparent, semi-transparent) of the object to be rendered to determine whether there is a visible area behind the object, i.e., the rendering area. The gaze tracking algorithm determines which pixels of the object to be rendered will ultimately be displayed on the terminal's display screen. It should be noted that the aforementioned frustum culling algorithm, occlusion culling algorithm, material-based visibility analysis algorithm, and gaze tracking algorithm can all use current algorithms, which will not be described in detail in this specification.
[0036] Step 106: Determine the current level detail corresponding to each region to be rendered in the current frame from the pre-built multiple levels of detail.
[0037] It should be noted that this specification does not specifically limit the method used to determine the current level of detail for each region to be rendered. For example, for each region to be rendered, the pixel range covered when projected onto the display screen can be determined, and then the level of detail that should be used for that region can be determined based on the pixel range, i.e., the current level of detail corresponding to that region can be determined. Generally, the smaller the pixel range, the lower the precision of the corresponding level of detail representation data; that is, the pixel range is positively correlated with the precision of the level of detail representation data.
[0038] It should be understood that, in this specification, a single object to be rendered can correspond to multiple regions to be rendered, and a single object to be rendered can correspond to multiple levels of detail. The level of detail for each region to be rendered can be the same or different. Therefore, each frame can use multiple levels of detail. For example, the current frame includes object 1 and object 2 to be rendered. The regions to be rendered corresponding to object 1 are determined to be region 1 and region 2, and the region to be rendered corresponding to object 2 is determined to be region 3. Then, the regions to be rendered in the current frame are regions 1 to 3. Further, the level of detail corresponding to each region to be rendered can be determined, that is, the mesh data of the level of detail that each model to be rendered in the current frame should present. For example, the level of detail corresponding to region 1 to be rendered can be level of detail 1, the level of detail corresponding to region 2 to be rendered can be level of detail 2, and the level of detail corresponding to region 3 to be rendered can be level of detail 3. The data precision represented by level of detail 1 to 3 can increase or decrease sequentially.
[0039] See Figure 2 This document provides a flowchart for determining a rendering area, which specifically includes the following steps: Step 202: Obtain the first pose information of the object to be rendered in the world coordinate system in the previous frame, and obtain the update information used to update the first pose information.
[0040] Step 204: Based on the updated information and the first pose information, obtain the second pose information of the object to be rendered in the world coordinate system in the current frame.
[0041] Step 206: Based on the second pose information, determine the rendering region corresponding to the object to be rendered in the current frame.
[0042] In practical applications, the terminal can obtain the first pose information of each object to be rendered in the world coordinate system in the previous frame, and obtain update information for updating this first pose information. Subsequently, based on the update information, the first pose information of the object to be rendered is updated and transformed to calculate the new pose information and second pose information of each object to be rendered in the world coordinate system in the current frame. Thus, based on the second pose information, the rendering region corresponding to the object to be rendered in the current frame can be determined.
[0043] The attitude information may include the position and orientation of each triangular facet of the object to be rendered in a specified coordinate system. This update information can be preset and includes, but is not limited to, linear velocity, angular velocity, acceleration, and position transformation matrix.
[0044] Furthermore, when determining the rendering region corresponding to the object to be rendered in the current frame based on the second pose information, the third pose information of the object to be rendered in the current frame in the screen coordinate system can be determined based on the second pose information; the pixel range covered by the object to be rendered in the current frame when projected onto the display screen can be determined based on the third pose information; and the rendering region corresponding to the object to be rendered in the current frame can be determined based on the pixel range.
[0045] In practical applications, for each object to be rendered, the terminal can map it to the terminal's corresponding screen coordinate system based on its second pose information using view transformation and projection transformation algorithms, thereby obtaining the third pose information of the object in the current frame within the screen coordinate system. Next, based on the third pose information, the bounding box of the object can be determined, and the pixel range covered by the bounding box in screen space can be calculated. Finally, based on the pixel range, the rendering region corresponding to the object can be determined. Furthermore, the level of detail corresponding to the rendering region can be determined based on this pixel range; that is, based on the pixel range covered by the bounding box of the object in screen space, the level of detail to be used for each rendering region corresponding to the object—the current level of detail—can be determined.
[0046] In other words, in one or more embodiments of this specification, the rendering region corresponding to the object to be rendered and the current level of detail corresponding to the rendering region can be determined based on the pixel range covered by the bounding box of the object to be rendered in screen space. Of course, other methods can also be used to determine the rendering region and the current level of detail corresponding to the rendering region, such as the previously mentioned cone culling algorithm, occlusion culling algorithm, material-based visibility analysis algorithm, and gaze tracking algorithm, etc.
[0047] The bounding boxes include, but are not limited to, axis-aligned bounding boxes (AABB) and oriented bounding boxes (OBB). How to determine the bounding box based on the third pose information of the object to be rendered in the screen coordinate system can be done using current bounding box calculation algorithms such as AABB and OBB, which will not be elaborated upon in this manual.
[0048] Step 108: If the first grid data is not cached, render each region to be rendered in the current frame according to the cached second grid data, wherein the first grid data is the grid data of the current level detail corresponding to the region to be rendered, and the data precision of the second grid data is lower than that of the first grid data.
[0049] In practical applications, before the rendering task begins, mesh data with a specified level of detail is cached in memory. This cache contains mesh data representing the lowest level of detail, saving initial memory space. This approach is suitable for large-scale rendering scenarios and scenarios with large volumes of high-precision mesh data and numerous levels of detail in the object model. Then, during the rendering task, based on a pre-defined memory management method, some mesh data with varying levels of detail can be dynamically loaded and deleted, ensuring smooth execution of the rendering task and maintaining a healthy memory environment throughout the process.
[0050] In this specification, during the rendering task, steps 104-106 determine the rendering region corresponding to the object to be rendered in the current frame, and the current level of detail corresponding to each rendering region in the current frame. Therefore, for each rendering region, it is determined whether the first mesh data corresponding to that region is cached. The first mesh data corresponding to the rendering region is the mesh data of the current level of detail for that region. If it is determined that the first mesh data corresponding to the rendering region is not cached, the rendering region is rendered based on the cached second mesh data corresponding to that region. The data precision of the second mesh data corresponding to the rendering region is lower than the data precision of the first mesh data corresponding to the rendering region.
[0051] It should be noted that the data precision of the level detail representation corresponding to the first grid data is lower than that of the current level detail representation. Data precision can be represented by the number of triangular facets that divide the object model into segments of the same area. For example, for the same object model or the same region of the same object model, there are level detail 1 and level detail 2. Level detail 1 represents dividing the object model or a region of the object model into three triangular facets, while level detail 2 represents dividing the object model or a region of the object model into five triangular facets. Therefore, the data precision of the level detail representation divided into three triangular facets is lower than that of the level detail representation divided into five triangular facets.
[0052] In practical applications, there can be multiple cached levels of detail, meaning that mesh data for multiple levels of detail have been cached. If the first mesh data is not cached, among the cached levels of detail whose model accuracy is lower than the current level of detail, the level of detail whose difference in model accuracy is within a preset range can be identified as the target level of detail. The mesh data of this target level of detail is the second mesh data, and the area to be rendered can then be rendered based on the mesh data of this target level of detail.
[0053] It should be noted that the cached mesh data with multiple levels of detail can include mesh data with a specified level of detail corresponding to at least one object to be rendered in the target virtual scene cached in memory at the start of the rendering task. This specified level of detail can be set according to actual needs, and there can be one or more specified levels. It can also include cached mesh data with level of detail corresponding to the region to be rendered in historical frames preceding the current frame. Correspondingly, the second mesh data can include mesh data with a specified level of detail corresponding to at least one object to be rendered in the target virtual scene cached in memory at the start of the rendering task, or it can include cached mesh data with level of detail corresponding to the region to be rendered in historical frames preceding the current frame, as long as the precision of the second mesh data is lower than that of the first mesh data.
[0054] It should be understood that in practical applications, the GPU does not render each region one by one, but renders all regions simultaneously. The above description of each region is intended to make the processing of a single region clear.
[0055] In one or more embodiments of this specification, the remaining cache space of the terminal can also be monitored in real time. If the remaining cache space is less than a preset space threshold, the cached grid data of a specified level of detail can be deleted.
[0056] In practical applications, based on preset deletion rules, the cached mesh data of a specified level of detail to be deleted can be identified and removed. The preset deletion rules can be determined based on actual needs, and this manual does not impose specific limitations. For example, the amount of data to be deleted can be determined based on the amount of cached mesh data of a specific level of detail. Based on this amount, the specified level of detail mesh data to be deleted can be identified and removed from the cached mesh data. Alternatively, the usage frequency of each cached level of detail mesh data can be determined, and mesh data of levels of detail with usage frequencies below a preset frequency threshold can be deleted.
[0057] In one or more embodiments of this specification, after rendering each region to be rendered in the current frame, first grid data can be acquired and cached, and the rendering of the region to be rendered in the next frame can be performed based on the caching result. The caching result includes successful caching and unsuccessful caching. When continuing to render the region to be rendered in the next frame based on the caching result, if the caching result is successful, the rendering of the region to be rendered in the next frame can be performed based on the successfully cached first grid data. If the caching result is unsuccessful, that is, if the first grid data is not cached, the rendering of the region to be rendered in the next frame can continue based on the already cached grid data, thereby ensuring the continuity and stability of the generated image.
[0058] As mentioned earlier, current rendering techniques typically load all mesh data for each level of detail into memory. To avoid memory overflow, only a small number of levels of detail are often constructed, meaning the mesh data corresponding to the object model has a limited number of levels of detail, such as only three levels. Alternatively, the precision of the mesh data for each level of detail can be reduced, such as simplifying an object model containing 100,000 triangle facets to 50,000 triangle facets. This sacrifices the precision of the object model's mesh data and the number of levels of detail to prevent memory overflow. In this application, the mesh data for the current level of detail required by the current frame can be streamed based on the real-time determined level of detail needed for the current frame, and then rendered. The method in this application can effectively avoid the problem of excessive memory usage or even overflow caused by loading all the mesh data for all levels of detail at once, thereby achieving efficient rendering of high-precision and large-scale object models.
[0059] Furthermore, since this application can use cached mesh data representing the current level of detail (i.e., the first mesh data) when the required mesh data for the current frame is not cached (i.e., the mesh data of the current level of detail), which has a lower precision than the required mesh data representing the current level of detail (i.e., the second mesh data), in order to minimize the difference between the object model rendered using the second mesh data and the object model rendered using the first mesh data, that is, to minimize the difference in precision between the second mesh data and the first mesh data, so as not to affect the quality and expressiveness of the actual rendered image, thus improving the continuity and rendering quality, a larger number of level details with smaller precision differences can be pre-constructed, dividing the mesh data into a larger number of level details with smaller precision differences. Compared to traditional few level details, this application can achieve smoother switching of level details, improving the quality and expressiveness of the rendered image while ensuring smooth execution of the rendering task.
[0060] See Figure 3 , Figure 3 A flowchart illustrating the construction hierarchy details provided in one embodiment of this specification specifically includes the following steps: Step 302: Obtain the high-precision mesh data corresponding to the object to be rendered, and use the high-precision mesh data as the current mesh data.
[0061] Step 304: Divide the current grid data to obtain multiple grid data blocks.
[0062] Step 306: Group the multiple mesh data blocks to obtain multiple mesh data groups, perform edge locking and face reduction on each mesh data group to obtain the mesh data of the reference level details corresponding to the object to be rendered.
[0063] Step 308: Determine whether the mesh data of the reference level detail meets the preset stopping condition; if not, proceed to step 310; if yes, proceed to step 312.
[0064] Step 310: Use the reference level detail mesh data as the current mesh data and continue to step S304.
[0065] Step 312: Obtain grid data with details at multiple reference levels.
[0066] The preset stopping conditions include, but are not limited to, the data precision of the reference level detail grid data being lower than a preset precision threshold, the number of subdivided level details reaching a preset level number, and the number of subdivided grid data blocks reaching a preset data block number.
[0067] The multiple reference level detail mesh data includes high-precision mesh data and at least one reference level detail mesh data obtained based on the high-precision mesh data. In other words, the high-precision mesh data corresponding to the object to be rendered is a level detail mesh data, which can be used as a reference level detail mesh data. By dividing the high-precision mesh data and performing edge locking and polygon reduction, at least one reference level detail mesh data can be obtained, thus resulting in multiple reference level detail mesh data. In other words, the multiple reference level detail mesh data consists of high-precision mesh data and at least one reference level detail mesh data obtained by dividing the high-precision mesh data and performing edge locking and polygon reduction. The obtained multiple reference level detail mesh data constitutes the constructed multiple level detail mesh data, which can be used in subsequent rendering processes.
[0068] It should be noted that edge locking and polygon reduction aim to simplify the objects to be rendered corresponding to a mesh data set. Specifically, edge locking and polygon reduction refers to performing a polygon reduction operation on the objects to be rendered corresponding to a mesh data set, and locking certain edges during the polygon reduction operation so that they do not participate in the simplification process. This preserves the geometric features and boundary integrity of the regions formed by these specific edges, thereby ensuring that the important contours or features of the objects to be rendered are not deformed, and avoiding the phenomenon of tearing and overlapping of the objects to be rendered.
[0069] In practical applications, specific edge-locking and face reduction algorithms can be selected based on actual needs. These algorithms include, but are not limited to, simplified algorithms based on edge folding and triangulation algorithms.
[0070] In this specification, edge locking and polygon reduction are performed on each mesh data group to obtain the reference level detail mesh data corresponding to the object to be rendered, including: Determine the grid data group to be processed, and each grid data block to be processed corresponding to the grid data group to be processed, wherein the grid data group to be processed is any one of the grid data groups; The number of triangular faces corresponding to each grid data block to be processed is processed according to a preset face reduction rule to obtain the target grid data block after face reduction. Based on each target mesh data block, obtain the reference level detail mesh data corresponding to the object to be rendered.
[0071] The preset facet reduction rule refers to reducing the number of triangular faces corresponding to the grid data block to be processed to a preset number. This could be reduced to 10,000, 5,000, or 1,000, etc., and the specific value of the preset number can be determined according to actual needs. In one or more embodiments of this specification, the preset facet reduction rule can reduce the number of triangular faces corresponding to the grid data block to be processed to half of its original value. This ensures that the area difference between the coarsely divided grid data blocks is stable and not significantly different, and improves computational efficiency and the controllability of the data accuracy of the determined grid data at each level of detail during the determination process.
[0072] In this specification, multiple grid data blocks are grouped, including: Obtain the grid data information of the current grid data, and the grouping rules corresponding to the grid data information; The grid data blocks in the current grid data are grouped according to the grid data information and the grouping rules.
[0073] The grid data information includes the position information of each triangular facet in the current grid data, and the grouping rules include the number of consecutive data blocks in the grid data block.
[0074] Grouping the grid data blocks in the current grid data according to the grid data information and the grouping rules includes: Based on the facet position information of the triangular facets contained in each grid data block, determine the data block position information of each grid data block; Based on the consecutive number of data blocks and the location information of each data block, the multiple grid data blocks are grouped to obtain multiple grid data groups, wherein the area of the object to be rendered corresponding to each grid data group is within a preset area range.
[0075] In practical applications, the number of consecutive grid data blocks can be a series of consecutive grid data blocks, such as three consecutive grid data blocks or four consecutive grid data blocks, depending on the specific requirements. Multiple grid data blocks can be grouped into a grid data group, where the area of the object to be rendered corresponding to the grid data group consisting of this specified number of consecutive grid data blocks is within a preset area range.
[0076] like Figure 4 The diagram shown illustrates one method of dividing a grid data group as provided in this specification. As can be seen, the object to be rendered is divided into 3*3 grid data blocks, designated as grid data blocks 1 to 9. The number of consecutive data blocks, i.e., the specified number, can be 3. Assuming each grid data block has the same area of 1 square centimeter, and the preset area range is 3.5 square centimeters, then grid data blocks 1-3 can be divided into one grid data group, grid data blocks 4-6 into another, and grid data blocks 7-9 into yet another. Alternatively, grid data blocks 1, 2, and 5 can be divided into one grid data group, grid data blocks 4, 7, and 8 into another, and grid data blocks 3, 6, and 9 into yet another. Of course, other division methods can also be used, as long as the area of the divided grid data groups is within the preset area range, and the number of grid data blocks contained in the divided grid data groups is the specified number or consistent with the number of consecutive data blocks.
[0077] It should be noted that the preset area range, the area of each grid data group, the area of each grid data block, and the number of consecutive data blocks can all be set based on actual needs. Furthermore, in determining the grid data for each level of detail, the number of grid data groups, the area of each grid data group, and the area and number of grid data blocks corresponding to each level of detail are not specifically limited and can be determined based on actual needs. In one or more embodiments of this specification, to improve efficiency and convenience during the rendering process, the grid data can be evenly divided. Specifically, this can be achieved by ensuring that the number of grid data groups corresponding to each level of detail is the same, the area of the object to be rendered corresponding to each grid data group is the same, the number of grid data blocks contained in each grid data group is the same, and the area of the object to be rendered corresponding to each grid data block is the same.
[0078] Based on the aforementioned method for constructing hierarchical details, the number of generated hierarchical details and the data precision of each hierarchical detail can be controlled according to actual needs, improving the controllability of the number of hierarchical details and the data precision of their representation. Before rendering, multiple hierarchical detail mesh data can be constructed based on this method, and only the mesh data of the hierarchical detail with the lowest data precision is loaded, avoiding loading all data at once and reducing memory consumption. Furthermore, the difference in data precision between the mesh data of each hierarchical detail can be kept as small as possible, enabling a smoother and more natural visual transition when loading mesh data of specific hierarchical details on demand, thus enhancing the user experience.
[0079] Based on the above rendering method, if the required first grid data is not cached in memory, the second grid data with a lower precision than the first grid data can be used to render the area to be rendered. This ensures smooth rendering. During the rendering process, only the grid data of the current level of detail corresponding to the area to be rendered in the current frame needs to be loaded, instead of loading all the grid data of all levels of detail into memory, thus avoiding the problem of excessive memory usage or even overflow.
[0080] Furthermore, to avoid excessive memory usage, it is not necessary to sacrifice the realism and detail of the object model. That is, there is no need to sacrifice the number of layers of detail or the accuracy of the mesh data. By streaming the required layer of detail mesh data through this application, several layers of detail mesh data can be divided according to actual needs, and high-precision mesh data can be generated according to actual needs. This can ensure that memory does not overflow and that the accuracy of the object model is guaranteed, that is, the realism and detail of the object model are guaranteed.
[0081] In addition, since memory can load mesh data of all levels of detail, and not every level of detail mesh data is used during rendering, the method in this application that does not need to load all level of detail mesh data into memory can also avoid memory waste.
[0082] Overall, the rendering method proposed in this application solves the problems of excessive memory consumption or even overflow, insufficient layer details, low model accuracy corresponding to layer details, and low image quality in traditional rendering schemes, and achieves high-performance, high-quality, and low-memory-consumption real-time rendering.
[0083] Corresponding to the above method embodiments, this application also provides rendering apparatus embodiments. Figure 5 A schematic diagram of the structure of a rendering apparatus provided in one embodiment of this application is shown. Figure 5 As shown, the device includes: The receiving module 502 is configured to receive rendering instructions for a target virtual scene, wherein the target virtual scene includes at least one object to be rendered; The first determining module 504 is configured to determine the rendering region corresponding to the object to be rendered in the current frame of the target virtual scene. The second determining module 506 is configured to determine the current level details corresponding to each region to be rendered in the current frame from a pre-built set of multiple level details. The rendering module 508 is configured to render each region to be rendered in the current frame based on the cached second grid data when the first grid data is not cached. The first grid data is the grid data of the current level detail corresponding to the region to be rendered, and the data precision of the second grid data is lower than that of the first grid data.
[0084] Optionally, the rendering module 508 is further configured to: Obtain the first grid data and cache it; The rendering of the region to be rendered in the next frame is performed based on the cached results. Optionally, the second determining module 506 is further configured to: Obtain the high-precision mesh data corresponding to the object to be rendered, and use the high-precision mesh data as the current mesh data; Divide the current grid data to obtain multiple grid data blocks; The multiple mesh data blocks are grouped to obtain multiple mesh data groups. Edge locking and face reduction are performed on each mesh data group to obtain the mesh data of the reference level detail corresponding to the object to be rendered. Determine whether the reference level detail mesh data meets the preset stopping conditions; If not, the reference level detail grid data will be used as the current grid data, and the operation of dividing the current grid data to obtain multiple grid data blocks will continue. If so, then grid data with details at multiple reference levels is obtained.
[0085] Optionally, the second determining module 506 is further configured to: Obtain the grid data information of the current grid data, and the grouping rules corresponding to the grid data information; The grid data blocks in the current grid data are grouped according to the grid data information and the grouping rules. Optionally, the grid data information includes the facet position information of each triangular facet in the current grid data, and the grouping rule includes the number of consecutive data blocks in the grid data block; The second determining module 506 is further configured to: Based on the facet position information of the triangular facets contained in each grid data block, determine the data block position information of each grid data block; Based on the consecutive quantity information and position information of each data block, the multiple grid data blocks are grouped to obtain multiple grid data groups, wherein the area of the object to be rendered corresponding to each grid data group is within a preset area range. Optionally, the second determining module 506 is further configured to: Determine the grid data group to be processed, and each grid data block to be processed corresponding to the grid data group to be processed, wherein the grid data group to be processed is any one of the grid data groups; The number of triangular faces corresponding to each grid data block to be processed is processed according to a preset face reduction rule to obtain the target grid data block after face reduction. Based on each target mesh data block, obtain the reference level detail mesh data corresponding to the object to be rendered.
[0086] Optionally, the rendering module 508 is further configured to: If the caching result is successful, the rendering of the area to be rendered in the next frame is performed based on the first grid data that was successfully cached.
[0087] Optionally, the device further includes a deletion module; The deletion module is configured to delete cached grid data of a specified level of detail when the remaining cache space is less than a preset space threshold.
[0088] Optionally, the first determining module 504 is further configured to: Obtain the first pose information of the object to be rendered in the world coordinate system in the previous frame, and obtain the update information used to update the first pose information; Based on the updated information and the first pose information, the second pose information of the object to be rendered in the current frame in the world coordinate system is obtained; Based on the second pose information, the rendering region corresponding to the object to be rendered in the current frame is determined.
[0089] Optionally, the first determining module 504 is further configured to: Based on the second pose information, determine the third pose information of the object to be rendered in the current frame in the screen coordinate system; Based on the third pose information, determine the pixel range covered by the object to be rendered in the current frame when it is projected onto the display screen; Based on the pixel range, determine the rendering region corresponding to the object to be rendered in the current frame.
[0090] The apparatus provided in this application can receive rendering instructions for a target virtual scene, wherein the target virtual scene includes at least one object to be rendered; for the current frame in the target virtual scene, determine the region to be rendered corresponding to the object to be rendered in the current frame; determine the current level detail corresponding to each region to be rendered in the current frame from a pre-constructed plurality of level details; and render each region to be rendered in the current frame according to the cached second grid data if the first grid data is not cached, wherein the first grid data is the grid data of the current level detail corresponding to the region to be rendered, and the data precision of the second grid data is lower than the data precision of the first grid data.
[0091] If the required first grid data is not cached in memory, the second grid data with a lower precision than the first grid data can be used to render the area to be rendered. This ensures smooth rendering. During the rendering process, only the mesh data of the layer details corresponding to the area to be rendered in the current frame needs to be loaded, instead of loading all the mesh data of the layer details into memory, thus avoiding excessive memory usage or even overflow.
[0092] Furthermore, to avoid excessive memory usage, it is not necessary to sacrifice the realism and detail of the object model. That is, there is no need to sacrifice the number of layers of detail or the accuracy of the mesh data. By streaming the required layer of detail mesh data through this application, several layers of detail mesh data can be divided according to actual needs, and high-precision mesh data can be generated according to actual needs. This can ensure that memory does not overflow and that the accuracy of the object model is guaranteed, that is, the realism and detail of the object model are guaranteed.
[0093] In addition, since memory can load mesh data of all levels of detail, and not every level of detail mesh data is used during rendering, the method in this application that does not need to load all level of detail mesh data into memory can also avoid memory waste.
[0094] The above is a schematic representation of a rendering apparatus according to this embodiment. It should be noted that the technical solution of this rendering apparatus and the technical solution of the rendering method described above belong to the same concept. For details not described in detail in the technical solution of the rendering apparatus, please refer to the description of the technical solution of the rendering method described above.
[0095] Figure 6 A structural block diagram of a computing device 600 according to an embodiment of this application is shown. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and a database 650 is used to store data.
[0096] The computing device 600 also includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0097] In one embodiment of this application, the aforementioned components of the computing device 600 and Figure 6 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 6 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.
[0098] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 600 can also be a mobile or stationary server.
[0099] The processor 620 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the above-described rendering method.
[0100] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the rendering method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the rendering method described above.
[0101] An embodiment of this specification also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the rendering method described above.
[0102] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the rendering method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the rendering method described above.
[0103] An embodiment of this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the rendering method described above.
[0104] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the rendering method described above belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the rendering method described above.
[0105] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0106] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0107] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0108] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0109] The preferred embodiments disclosed above are merely illustrative of this application. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this application. These embodiments are selected and specifically described in this application to better explain the principles and practical applications of this application, thereby enabling those skilled in the art to better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.
Claims
1. A rendering method, characterized in that, include: Receive rendering instructions for a target virtual scene, wherein the target virtual scene includes at least one object to be rendered; For the current frame in the target virtual scene, determine the rendering region corresponding to the object to be rendered in the current frame; From multiple pre-built layers of detail, determine the current layer of detail corresponding to each region to be rendered in the current frame; If the first grid data is not cached, each region to be rendered in the current frame is rendered based on the cached second grid data. The first grid data is the grid data of the current level of detail corresponding to the region to be rendered, and the data precision of the second grid data is lower than that of the first grid data.
2. The method as described in claim 1, characterized in that, After rendering each region to be rendered in the current frame, the method further includes: Obtain the first grid data and cache it; The rendering of the area to be rendered in the next frame is based on the cached results.
3. The method as described in claim 1, characterized in that, Multiple layers of detail are pre-built, including: Obtain the high-precision mesh data corresponding to the object to be rendered; The high-precision grid data is used as the current grid data, and the current grid data is divided to obtain multiple grid data blocks; The multiple mesh data blocks are grouped to obtain multiple mesh data groups. Edge locking and face reduction are performed on each mesh data group to obtain the mesh data of the reference level detail corresponding to the object to be rendered. Determine whether the reference level detail mesh data meets the preset stopping conditions; If not, the reference level detail grid data will be used as the current grid data, and the operation of dividing the current grid data to obtain multiple grid data blocks will continue. If so, then grid data with details at multiple reference levels is obtained.
4. The method as described in claim 3, characterized in that, Grouping the plurality of grid data blocks includes: Obtain the grid data information of the current grid data, and the grouping rules corresponding to the grid data information; The grid data blocks in the current grid data are grouped according to the grid data information and the grouping rules.
5. The method as described in claim 4, characterized in that, The grid data information includes the position information of each triangular facet in the current grid data, and the grouping rule includes the number of consecutive data blocks in the grid data block; Grouping the grid data blocks in the current grid data according to the grid data information and the grouping rules includes: Based on the facet position information of the triangular facets contained in each grid data block, determine the data block position information of each grid data block; Based on the consecutive number of data blocks and the location information of each data block, the multiple grid data blocks are grouped to obtain multiple grid data groups, wherein the area of the object to be rendered corresponding to each grid data group is within a preset area range.
6. The method as described in claim 3, characterized in that, Edge locking and polygon reduction are performed on each mesh data group to obtain the reference level detail mesh data corresponding to the object to be rendered, including: Determine the grid data group to be processed, and each grid data block to be processed corresponding to the grid data group to be processed, wherein the grid data group to be processed is any one of the grid data groups; The number of triangular faces corresponding to each grid data block to be processed is processed according to a preset face reduction rule to obtain the target grid data block after face reduction. Based on each target mesh data block, obtain the reference level detail mesh data corresponding to the object to be rendered.
7. The method as described in claim 2, characterized in that, Rendering of the region to be rendered in the next frame based on the cached results includes: If the caching result is successful, the rendering of the area to be rendered in the next frame is performed based on the first grid data that was successfully cached.
8. The method as described in claim 1, characterized in that, The method further includes: If the remaining cache space is less than a preset space threshold, delete the cached grid data of the specified level of detail.
9. The method as described in claim 1, characterized in that, Determine the rendering region corresponding to the object to be rendered in the current frame, including: Get the first pose of the object to be rendered in the world coordinate system in the previous frame, and get the update information used to update the first pose; Based on the updated information and the first pose, the second pose of the object to be rendered in the world coordinate system in the current frame is obtained; Based on the second pose, determine the rendering region corresponding to the object to be rendered in the current frame.
10. The method as described in claim 9, characterized in that, Based on the second pose, determine the rendering region corresponding to the object to be rendered in the current frame, including: Based on the second pose, determine the third pose of the object to be rendered in the current frame in the screen coordinate system; Based on the third pose, determine the pixel range covered by the object to be rendered in the current frame when it is projected onto the display screen; Based on the pixel range, determine the rendering region corresponding to the object to be rendered in the current frame.
11. A rendering apparatus, characterized in that, include: The receiving module is configured to receive rendering instructions for a target virtual scene, wherein the target virtual scene includes at least one object to be rendered; The first determining module is configured to determine the rendering region corresponding to the object to be rendered in the current frame of the target virtual scene. The second determining module is configured to determine the current level detail corresponding to each region to be rendered in the current frame from a pre-built set of multiple level details. The rendering module is configured to render each region to be rendered in the current frame based on the cached second grid data when the first grid data is not cached. The first grid data is the grid data of the current level detail corresponding to the region to be rendered, and the data precision of the second grid data is lower than that of the first grid data.
12. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, It stores a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 10.
14. A computer program product, characterized in that, Includes a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 10.