3D virtual scene rendering method, device and equipment
By determining and optimizing the rendering order in 3D virtual scenes, the problem of model flickering caused by rendering order conflicts was solved, improving the stability and rendering accuracy of 3D virtual scenes.
Patent Information
- Application Number
- CN202411455814.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-25
AI Technical Summary
In ultra-large-scale digital twin scenarios, there is a problem of model flickering. Existing technologies are unable to effectively solve the model flickering problem caused by rendering order conflicts, which affects the stability of 3D virtual scenes.
By identifying multiple first grids with conflicting rendering order and non-conflicting second grids in a 3D virtual scene, the rendering order of the first grids is fixed, and the rendering order of the second grids is arranged based on their depth. Combined with depth level adjustment and grid offset, the rendering order is optimized to avoid model flickering.
It improves the stability of 3D virtual scenes, avoids model flickering when the rendering order is uncertain, and enhances rendering accuracy and resource utilization efficiency.
Smart Images

Figure CN119516147A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and is related to but not limited to a 3D virtual scene rendering method and device. Background Art
[0002] Digital Twin is a technology that uses digital models to simulate and analyze physical entities or systems in the real world in real time. It collects real-time data from physical entities, connects the real world with the digital world, and completes mapping in virtual space, thereby reflecting the entire life cycle of the corresponding physical equipment.
[0003] In virtual spaces such as digital twins, it is often necessary to render ultra-large model fields. In order to restore real business scenarios with high fidelity, it is necessary not only to render all spatial elements, but also to achieve high-precision model rendering to achieve the purpose of accurate digital twins. Figure 1 The substation twin scenario shown in the figure is Figure 2 The equipment storage twin scene shown in the figure. However, in ultra-large-scale digital scenes, there is a problem of model flickering. Summary of the invention
[0004] The present application provides a 3D virtual scene rendering method, device and equipment, and the solution of the present application improves the stability of the 3D virtual scene.
[0005] The technical solution of this application is implemented as follows:
[0006] The present application provides a 3D virtual scene rendering method, the method comprising:
[0007] Based on the depth of each mesh of the 3D virtual scene, determine a plurality of first meshes having conflicts in rendering order of the 3D virtual scene and a second mesh having no conflicts in rendering order; wherein the 3D virtual scene includes a plurality of 3D models, one of the 3D models includes one or more meshes, and the meshes represent spatial elements constituting the 3D model;
[0008] Fixing the rendering order of the plurality of first grids to obtain a first order, and arranging the rendering order of the plurality of second grids based on the depth of each second grid in the plurality of second grids to obtain a second order;
[0009] The 3D virtual scene is rendered based on the first order and the second order.
[0010] The present application provides a 3D virtual scene rendering device, which is deployed in an electronic device and includes:
[0011] A determination unit, configured to determine, based on the depths of the meshes of the 3D virtual scene, a plurality of first meshes having conflicts in rendering order of the 3D virtual scene and a second meshes having no conflicts in rendering order; wherein the 3D virtual scene includes a plurality of 3D models, one of the 3D models includes one or more meshes, and the meshes represent spatial elements constituting the 3D model;
[0012] A sorting unit, used for fixing the rendering order of the plurality of first grids to obtain a first order;
[0013] A sorting unit, configured to arrange the rendering order of the plurality of second grids based on the depth of each second grid in the plurality of second grids to obtain a second order;
[0014] A rendering unit is used to render the 3D virtual scene based on the first order and the second order.
[0015] The present application also provides an electronic device, including: a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor implements the above-mentioned 3D virtual scene rendering method when executing the program.
[0016] The present application also provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned 3D virtual scene rendering method is implemented.
[0017] The present application provides a 3D virtual scene rendering method, apparatus, device and storage medium, including: based on the depth of each grid of the 3D virtual scene, determining multiple first grids with conflicts in the rendering order of the 3D virtual scene, and second grids with no conflicts in the rendering order; wherein the 3D virtual scene includes multiple 3D models, and one of the 3D models includes one or more grids, and the grids represent the spatial elements constituting the 3D model; fixing the rendering order between the multiple first grids to obtain a first order, and arranging the rendering order of the multiple second grids based on the depth of each second grid in the multiple second grids to obtain a second order; and rendering the 3D virtual scene based on the first order and the second order.
[0018] It can be seen that for the scheme of the present application, for multiple first meshes with conflicting rendering orders, the rendering order between the multiple first meshes is fixed, and the rendering order of the multiple first meshes, i.e., the first order, is obtained, and the rendering order of multiple second meshes with no conflicting rendering orders in the 3D virtual network, i.e., the second order, is determined. The meshes in the 3D virtual network are rendered based on the first order and the second order, and the rendering order between the multiple first meshes with conflicting rendering orders is fixed. The rendering order of the meshes is agreed upon at the logical layer, and the model flickering problem when it is uncertain how to render when rendering multiple first meshes with conflicting rendering orders is avoided, thereby improving the stability of the 3D virtual scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A schematic diagram of an optional 3D virtual scene provided in an embodiment of the present application;
[0020] Figure 2 A schematic diagram of an optional 3D virtual scene provided in an embodiment of the present application;
[0021] Figure 3 An optional flowchart of a 3D virtual scene rendering method provided in an embodiment of the present application;
[0022] Figure 4 A schematic diagram of an optional division of a grid provided in an embodiment of the present application;
[0023] Figure 5 A schematic diagram of an optional division of a grid provided in an embodiment of the present application;
[0024] Figure 6 An optional flowchart of a 3D virtual scene rendering method provided in an embodiment of the present application;
[0025] Figure 7 An optional flowchart of a 3D virtual scene rendering method provided in an embodiment of the present application;
[0026] Figure 8 An optional schematic diagram of a grid offset provided in an embodiment of the present application;
[0027] Fig. 9 An optional flowchart of a 3D virtual scene rendering method provided in an embodiment of the present application;
[0028] Fig.10 An optional schematic diagram of the viewing distance and depth level provided in an embodiment of the present application;
[0029] Fig.11 An optional schematic diagram of depth conflict provided in an embodiment of the present application;
[0030] Fig.12 An optional flow chart of model flashing provided in an embodiment of the present application;
[0031] Fig.13 An optional flow chart of model flashing provided in an embodiment of the present application;
[0032] Fig.14 An optional flow chart of model flashing provided in an embodiment of the present application;
[0033] Fig.15 An optional schematic diagram of the viewing distance and depth level provided in an embodiment of the present application;
[0034] Fig.16 An optional schematic diagram of the viewing distance and depth level provided in an embodiment of the present application;
[0035] Fig.17 An optional schematic diagram of a grid offset provided in an embodiment of the present application;
[0036] Fig.18 An optional schematic diagram of a rendering queue provided in an embodiment of the present application;
[0037] Fig.19 An optional structural schematic diagram of a 3D virtual scene rendering device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.
[0039] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0040] In the following description, the terms "first\second\third" are used only as examples to distinguish different objects, and do not represent a specific order for the objects, nor do they have a limitation on the order of precedence. It is understandable that "first\second\third" can be interchanged with a specific order or order of precedence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0041] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0042] The embodiments of the present application can provide a 3D virtual scene rendering method, device, equipment and storage medium. In practical applications, the 3D virtual scene rendering method can be implemented by a 3D virtual scene rendering device, and each functional entity in the 3D virtual scene rendering device can be collaboratively implemented by hardware resources of electronic equipment, such as computing resources such as processors, and communication resources (such as for supporting various communication methods such as optical cables and cellular).
[0043] In a first aspect, an embodiment of the present application provides a 3D virtual scene rendering method, which is applied to a 3D virtual scene rendering device; wherein the 3D virtual scene rendering device can be deployed in an electronic device. Below, the 3D virtual scene rendering method provided by the embodiment of the present application is described with the electronic device as the execution subject.
[0044] Figure 3 A flowchart of an optional 3D virtual scene rendering method is shown. Figure 3 The process may include but is not limited to the following: Figure 3 S301 to S303 shown.
[0045] S301. Based on the depth of each grid of the 3D virtual scene, determine multiple first grids with conflicts in rendering order of the 3D virtual scene and second grids with no conflicts in rendering order; wherein the 3D virtual scene includes multiple 3D models, one of the 3D models includes one or more grids, and the grids represent spatial elements constituting the 3D model.
[0046] The electronic device performs mesh initialization on the 3D models in the 3D virtual scene and determines the meshes included in each 3D model. Mesh initialization can be understood as decomposing the 3D models based on the mesh for each 3D model in the 3D virtual scene. A 3D model can be divided into one or more meshes. Different meshes of a 3D model can be different spatial elements in the 3D model, and the depths of different meshes can be the same or different.
[0047] In the embodiment of the present application, the grid can be understood as a spatial element or unit that constitutes a 3D model.
[0048] In one example, if Figure 4 As shown, the 3D model of the rabbit is divided into a plurality of triangular meshes, wherein the rabbit is meshed with different precisions in 401 and 402 .
[0049] In one example, if Figure 5 As shown, the 3D model of the house is divided into the following grids: roof, wall, window, door, chimney.
[0050] In an embodiment of the present application, the 3D coordinates of each 3D model are determined. When a 3D model is determined to be an ultra-distant model based on its 3D coordinates, the ultra-distant model may not be meshed, that is, the ultra-distant model is treated as a mesh.
[0051] After the electronic device initializes the 3D model grid in the 3D virtual scene, it determines a plurality of first grids in the 3D virtual scene whose rendering order has conflicts. Among them, one or more first grids in which the rendering order has conflicts can be determined, and the rendering order of a group of first grids has conflicts.
[0052] In the embodiment of the present application, multiple first grids with conflicts in rendering order can be considered as the distance difference between the multiple first grids is less than the resolution accuracy, and the electronic device cannot determine which first grid is in front and which first grid is in the back among the multiple first grids, that is, it is impossible to determine the occlusion relationship between the multiple first grids.
[0053] For multiple first meshes with conflicts in rendering order, in the related art, there will be a model flickering problem during rendering, that is, the renderer does not know which mesh to render, and renders randomly, causing the model to flicker.
[0054] In an embodiment of the present application, the resolution accuracy is related to the depth level corresponding to the viewing distance of the grid. The viewing distance of a grid can be understood as the distance between the position where the 3D virtual scene is viewed and the grid. Here, it can be considered that there is a camera or a camera or a video camera at the position where the 3D virtual scene is viewed, and the viewing distance is the distance between the camera or the video camera and the grid. It is understandable that in a virtual space such as a digital twin, the position where the 3D virtual scene is viewed may change with the user's settings, wherein changes in the position where the 3D virtual scene is viewed may cause the angle and / or near plane distance of the 3D virtual scene to change. The near plane distance can be understood as the distance between the position where the 3D virtual scene is viewed and the starting value of the depth level.
[0055] As the near plane distance changes, the view distance of the mesh changes, so that the depth level of the mesh may change, wherein there is a corresponding relationship between the depth level and the view distance.
[0056] In the embodiment of the present application, there may be a nonlinear relationship between the viewing distance and the depth level. As the depth level increases, the corresponding viewing distance range increases, and the resolution accuracy decreases.
[0057] The electronic device determines a grid other than the first grid in the 3D virtual scene as a second grid.
[0058] S302: Fix the rendering order between the plurality of first grids to obtain a first order, and determine the rendering order of each second grid in the plurality of second grids based on the depth of each second grid in the plurality of second grids to obtain a second order.
[0059] For groups of first meshes with conflicting rendering orders, the electronic device fixes the rendering order between the multiple first meshes included in the group, so that the renderer does not perform rendering randomly.
[0060] In the embodiment of the present application, fixing the rendering order between the plurality of first meshes may include only fixing the rendering order between the plurality of first meshes, in which case the order of the plurality of first meshes in the meshes included in the 3D virtual scene is not fixed. In one example, the plurality of first meshes include: mesh A and mesh B, and the rendering order of mesh A and mesh B is to render mesh A first and then mesh B.
[0061] In the case where only the rendering order between the multiple first grids is fixed, it is necessary to determine the rendering order of each of the multiple first grids, that is, the rendering order in the grids included in the 3D virtual scene, based on the depth of the multiple first grids, that is, the viewing distance. At this time, the first order is obtained based on the order between the multiple first grids and the rendering order of each of the multiple first grids. It can be understood that for a group of multiple first grids, the order of each first grid determined based on the depth of each first grid is the same.
[0062] Fixing the rendering order between multiple first grids can also be understood to include fixing the rendering order of each first grid in the multiple first grids to obtain the first order. In this case, the rendering order of each first grid is fixed, and the rendering order between different first grids is also fixed. In one example, the multiple first grids include: grid A and grid B, wherein the rendering order values of grid A and grid B are 4 and 5 respectively, wherein the rendering order of the grids can be identified based on the rendering order value, and the larger the value of the rendering order value, the earlier it is.
[0063] When the rendering order of each of the plurality of first meshes is fixed, the rendering order of the plurality of first meshes is independent of the rendering order of other meshes and is not affected by the rendering order of other meshes.
[0064] For each second grid in the plurality of second grids, the depth of the second grid, i.e., the viewing distance, is determined, and the rendering order of the second grid is determined. The viewing distance of the second grid is the relative distance between the second grid and the position where the 3D virtual scene is viewed. The viewing distance of the second grid changes dynamically as the position where the 3D virtual scene is viewed changes.
[0065] S303: Render the 3D virtual scene based on the first order and the second order.
[0066] The first order, i.e., the rendering order of the first meshes, and the second order, i.e., the rendering order of the second meshes, are combined to obtain a third rendering order, i.e., the rendering order of the meshes included in the 3D virtual scene. The electronic device renders the meshes included in the 3D virtual scene based on the third rendering order to obtain the 3D virtual scene.
[0067] For the scheme of the present application, for multiple first meshes with conflicting rendering orders, the rendering order between the multiple first meshes is fixed to obtain the rendering order of the multiple first meshes, i.e., the first order, and the rendering order of multiple second meshes with no conflicting rendering orders in the 3D virtual network, i.e., the second order, is determined. The meshes in the 3D virtual network are rendered based on the first order and the second order, and the rendering order between the multiple first meshes with conflicting rendering orders is fixed. The rendering order of the meshes is agreed upon at the logical layer, thereby avoiding the problem of model flickering when it is uncertain how to render when rendering multiple first meshes with conflicting rendering orders, and improving the stability of the 3D virtual scene.
[0068] The following describes a process of determining a plurality of first meshes having conflicts in rendering order.
[0069] In a possible implementation, the process of determining a plurality of first meshes having conflicts in rendering order is as follows: Figure 6 As shown, including:
[0070] S601, comparing the depth of each grid of the 3D virtual scene with a depth upper limit value to determine a depth difference corresponding to each depth, wherein the depth upper limit value is the maximum depth of the 3D virtual scene;
[0071] S602: Determine a plurality of grids whose depth differences are smaller than a specified depth difference threshold as the plurality of first grids.
[0072] The electronic device determines the maximum depth of the 3D virtual scene, traverses each grid, compares the depth of each grid with the depth upper limit, determines the depth difference between the depth of each grid and the depth upper limit, and determines multiple grids with depth differences less than the depth difference threshold as the first grid. The first grid here can be called a super-distant grid.
[0073] In the embodiment of the present application, the first grid here can be a 3D model regarded as a grid, and the super-far grid can be called a super-far model.
[0074] A super-distant grid or super-distant model can be understood as a grid or model that is very far from the warp plane. The super-distant grid or super-distant model has a large viewing distance. When rendering, as the viewing distance increases, the flickering problem of the super-distant model becomes more serious. In an embodiment of the present application, the super-distant grid or super-distant model is used as the first grid, and the rendering order between the super-distant grids or super-distant models is fixed, thereby avoiding the occurrence of model flickering caused by the super-distant grid or super-distant model.
[0075] In one possible implementation, based on Figure 6 The process of determining the first grid, fixing the rendering order between the plurality of first grids, and obtaining the first order, includes:
[0076] According to the spatial order from far to near in the multiple first grids, the rendering order of each first grid in the multiple first grids is determined, and it is determined that the rendering order of the multiple first grids is before the rendering order of grids other than the multiple first grids in the 3D virtual scene.
[0077] The rendering order of each of the plurality of first grids is determined according to the spatial order between the plurality of ultra-distant grids or ultra-distant models. The spatial order can be understood as the spatial position sorting.
[0078] Here, the rendering order of the first mesh does not need to be determined based on a variable depth, but is determined based on a fixed spatial position order. At this time, for the first mesh, the determined rendering order is also fixed and will not change with changes in the distance plane.
[0079] For ultra-distant grids or ultra-distant models, the rendering of the ultra-distant grids or ultra-distant models is arranged before other grids in the 3D virtual scene, and can be rendered with priority, thereby ensuring that the rendering of the ultra-distant grids or ultra-distant models is not affected by other grids in the 3D virtual scene.
[0080] In a possible implementation, determining that the rendering order of the plurality of first grids is before the rendering order of grids other than the plurality of first grids in the 3D virtual scene includes:
[0081] marking the plurality of first grids;
[0082] Putting the marked first meshes into a rendering queue according to the rendering order of the first meshes;
[0083] After the marked multiple first grids are put into the rendering queue, grids other than the multiple first grids in the 3D virtual scene are put into the rendering queue, wherein the grids in the rendering queue are rendered based on a first-in-first-out principle.
[0084] Each first grid among the multiple first grids is marked, wherein the marking can be performed by a rendering order value (order), and the multiple first grids are placed in a rendering queue according to the order. Then, the grids in the 3D virtual scene except the multiple first grids are placed in the rendering queue according to the rendering order determined according to the depth.
[0085] In an embodiment of the present application, the electronic device may put the grid information of each grid into a rendering queue, and the renderer directly reads the rendering data of each grid from the rendering queue to render the grid. The electronic device may also put the grid identification of each grid into a rendering queue, and the rendering data of the grid is stored in a storage space. The renderer reads the identification of the grid from the rendering queue, and reads the rendering data of the grid from the storage space based on the identification of the grid to render the grid.
[0086] In an embodiment of the present application, ultra-distant grids or ultra-distant models are marked, and the marked ultra-distant grids or ultra-distant models are rendered preferentially, that is, the ultra-distant grids or ultra-distant models are removed from the depth calculation logic, thereby eliminating the calculation logic of the rendering order of the ultra-distant grids or ultra-distant models, and avoiding the flashing problem of the far grids or ultra-distant models due to exceeding the resolution accuracy threshold.
[0087] In a possible implementation, the process of determining a plurality of first meshes having conflicts in rendering order is as follows: Figure 7 As shown, including:
[0088] S701. Determine a plurality of grids with the same depth level located in a same pixel region as the plurality of first grids, wherein the depth level of the grid is determined based on the depth of the grid.
[0089] Here, the conditions that the plurality of grids belong to the plurality of first grids include:
[0090] Condition 1: Multiple grids are located in the same pixel area;
[0091] Condition 2: The depth levels of multiple grids are the same.
[0092] The electronic device determines the depth level of each grid according to the depth of each grid, that is, the viewing distance. The electronic device can determine the depth level of the grid based on the depth of the grid for the super-distant grid or the grid outside the super-distant model.
[0093] The electronic device determines the pixel area where each grid is located according to the position information of each grid, and determines the grids located in the same pixel area. Here, a grid can occupy one or more pixel areas, and for two grids, if they overlap in a pixel area, the two grids are located in the same pixel area.
[0094] The electronic device determines whether the depth levels of the regions located in the same pixel are the same, and if they are the same, determines that the multiple grids located in the same pixel region are multiple first grids.
[0095] In one example, for a 3D virtual scene including a wall with a painting on it, the wall is a grid, the painting is a grid, the wall and the painting overlap in position, and based on the depth of the wall and the depth of the painting, it is determined that the wall and the painting are at the same depth level, then it is determined that the wall and the painting belong to the first grid.
[0096] In a possible implementation manner, the condition that the multiple grids belong to the multiple first grids includes, in addition to condition 1 and condition 2, further including:
[0097] Condition 3: The relative viewing distance between multiple grids is less than the viewing distance difference threshold.
[0098] In condition 3, the viewing distance difference threshold may be a preset viewing distance difference, or may be related to the depth levels of the plurality of meshes.
[0099] For multiple grids with the same depth level located in the same pixel area, the depth difference between different grids, that is, the relative viewing distance, is determined; when the depth difference between two grids is less than the viewing distance difference threshold, the two grids are determined to be two first grids; when the depth difference between the two grids is greater than or equal to the viewing distance difference threshold, the two grids are determined to belong to the second grid.
[0100] In the case where the viewing distance difference is related to the depth level of multiple grids, the viewing distance difference corresponding to different depth levels is determined based on the resolution accuracy at the corresponding depth level. At this time, the depth difference between the two grids, that is, the viewing distance difference, can be compared with the viewing distance difference threshold; if the depth difference between the two grids, that is, the viewing distance difference, is less than the viewing distance difference threshold, the electronic device cannot distinguish the positional relationship between the two grids, that is, the occlusion relationship between the two grids, and at this time, it is determined that the two grids belong to the first grid; if the depth difference between the two grids, that is, the viewing distance difference, is greater than or equal to the viewing distance difference threshold, the electronic device can distinguish the positional relationship between the two grids, that is, the occlusion relationship between the two grids, and at this time, it is determined that the two grids do not belong to the first grid.
[0101] In the embodiment of the present application, grids with inconsistent rendering order and flickering problems can be accurately determined based on pixel areas and depth levels.
[0102] In one possible implementation, based on Figure 7 The process of determining the first grid, fixing the rendering order between the plurality of first grids, and obtaining the first order, includes:
[0103] Adjusting the depth of some first grids among the plurality of first grids;
[0104] Based on the adjusted depths of the plurality of first grids, a rendering order among the plurality of first grids is determined to obtain the first order.
[0105] In the embodiment of the present application, for a plurality of first grids having a rendering order conflict in the same pixel region, the depth of some of the first grids in the plurality of first grids may be adjusted.
[0106] In the embodiment of the present application, the method of adjusting the depth of some first grids among the plurality of first grids may include one of the following methods:
[0107] Method 1: adding an offset label to the portion of the first grid, wherein the offset label may indicate that the first grid is offset forward or backward;
[0108] Method 2: modifying the depth of the portion of the first grid based on the offset, and modifying the depth of the portion of the first grid to the depth after the offset.
[0109] In mode 1, the forward offset can be understood as an offset toward the position of viewing the 3D virtual scene, that is, the viewing distance becomes smaller, and the backward offset can be understood as an offset toward the position of viewing the 3D virtual scene, that is, the viewing distance becomes larger. In one example, the label indicating the forward offset is -1, and the label indicating the backward offset is +1.
[0110] The electronic device determines the relative positions between the plurality of first grids based on the offset tag, thereby determining the rendering relationship between the plurality of first grids. Wherein, when the offset tag indicates a forward offset, it is determined that the depth of the first grid with the offset tag added relative to other grids, i.e., the viewing distance becomes smaller; when the offset tag indicates a forward offset, it is determined that the depth of the first grid with the offset tag added relative to other grids, i.e., the viewing distance becomes smaller.
[0111] In method 2, the electronic device modifies the offset of some grids based on the offset to increase the relative viewing distance between the multiple first grids. The electronic device can determine the occlusion relationship between the multiple first grids based on the increased relative viewing distance, thereby determining the rendering relationship of each first grid in the multiple first grids.
[0112] In an embodiment of the present application, for multiple first grids, the electronic device may determine the position information of each first grid in the multiple first grids, thereby determining the positional relationship between the multiple first grids. For a first grid located closer to the front, i.e., a grid with a smaller depth, the electronic device may add a label indicating a forward offset to the first grid, or reduce the depth of the first grid. For a first grid located closer to the back, i.e., a grid with a larger depth, the electronic device may add a label indicating a backward offset to the first grid, or increase the depth of the first grid.
[0113] In one example, if Figure 8As shown, grid 801 and grid 802 are grids with the same depth level in the same pixel area. The depth of grid 801 can be offset, and the offset grid 801 can be shown as grid 803.
[0114] In the embodiment of the present application, when the depth of part of the first meshes is adjusted, the adjusted depth is only used to assist the renderer in determining the rendering order of the plurality of first meshes, and does not change the actual depth of the part of the meshes.
[0115] In the embodiment of the present application, for grids with conflicting rendering orders in the same pixel area, the electronic device may fix the rendering order between the multiple first grids by adjusting the depth of some of the first grids.
[0116] In a possible implementation, Fig. 9 As shown, the 3D virtual scene rendering method provided in the embodiment of the present application further includes the following S901 and S902:
[0117] S901, subtracting a specific adjustment value from the depth of the grid to obtain an adjusted depth of the grid;
[0118] S902: Determine a depth level of the mesh based on the adjusted depth of the mesh, where the depth level is used to determine a rendering order of the mesh.
[0119] For a mesh in a 3D virtual scene, when determining the depth level of the mesh, the electronic device may subtract a specific adjustment value from the depth of the mesh to obtain an adjusted depth, and the electronic device determines the depth level of the mesh based on the adjusted depth.
[0120] In one example, the depth of a grid is 4, and the specific adjustment value is 3, then the adjusted depth of the grid is 1, and the electronic device determines that the depth level of the grid is the depth level corresponding to 1.
[0121] In the embodiment of the present application, the specific adjustment value may be a fixed value, or may be determined according to the scene type of the 3D virtual scene.
[0122] The electronic device may also provide a modification opportunity for a specific adjustment value, and the user may use the specific adjustment value provided by the electronic device as the initial adjustment value to determine the final specific adjustment value through continuous attempts. After determining the final specific adjustment value, the electronic device may update the specific adjustment value.
[0123] The relationship between the depth, i.e., the viewing distance, and the depth level in the embodiment of the present application is a nonlinear relationship. The depth of the grid is reduced, thereby reducing the depth level corresponding to the grid. As the depth level decreases, the resolution accuracy increases. Therefore, the embodiment of the present application can parse the grid based on high resolution accuracy to improve the resolution accuracy.
[0124] It should be noted that the electronic device can adjust the depth of all meshes that need to determine the rendering order based on the depth level, thereby pushing the near-distance plane closer.
[0125] In the embodiment of the present application, the depth of all meshes that need to determine the rendering order based on the depth level is adjusted, which can be understood as increasing the starting value of the depth level.
[0126] In one example, the relationship between viewing distance and depth level can be as follows: Fig.10 As shown in the curve 1001 in FIG. 1 , when calculating the depth of the grid, the depth is reduced by 4, which can be understood as the starting value of the depth level is increased by 4. The relationship between the viewing distance and the depth level after the starting value of the depth level is increased by 4 can be as follows: Fig.10 As shown in curve 1002, based on the comparison between curve 1001 and curve 1002, it can be determined that the depth levels corresponding to the same depth in curve 1001 and curve 1002 may be different, and the depth level corresponding to curve 1002 may be smaller than the depth level corresponding to curve 1001, thereby having higher resolution accuracy.
[0127] In a possible implementation, the 3D virtual scene rendering method provided in the embodiment of the present application further includes the following steps:
[0128] Based on the scene type of the 3D virtual scene, selecting a target depth level division rule from a plurality of depth level division rules;
[0129] The depth level of the grid is determined by dividing the target depth level into the depth level corresponding to the adjusted depth of the grid.
[0130] In an embodiment of the present application, the electronic device can determine the scene type of the 3D virtual scene and select a target depth level division rule corresponding to the current scene type from a plurality of stored depth level division rules. Among the plurality of stored depth level division rules, different depth level division rules correspond to different numbers of depth levels.
[0131] In the embodiment of the present application, the scene type of the 3D virtual scene may be related to the size of the scene, including: digital computer room, warehouse, industrial park, etc. Corresponding to different scene sizes, depth level division rules with different numbers of depth levels are used to determine the depth level of the corresponding 3D virtual scene.
[0132] In the embodiment of the present application, the number of depth levels varies according to different scenes. The electronic device can set a depth level number threshold for different scene types and continuously try a greater number of depth levels based on the depth level number threshold.
[0133] In the related art, the number of depth levels in the depth level division rule is fixed, that is, for any scene type, the corresponding depth level division rule is the same. In the embodiment of the present application, multiple depth level division rules are set, and the number of depth levels in the multiple depth level division rules is different, and the number of depth levels is greater than the number of depth levels in the related art.
[0134] In the embodiment of the present application, when the number of depth levels increases, the depth range corresponding to one depth level decreases, so that a Z buffer with higher calculation accuracy can be used to reduce the probability of conflict.
[0135] The following describes a 3D virtual scene rendering method provided in an embodiment of the present application.
[0136] In the related technology, in ultra-large-scale digital scenes, if you want to improve the user's immersive experience and visual sense, you must achieve a high degree of restoration of the scene model's texture, position, structure and other information. To achieve this effect, depth overlap between models is inevitable. In the same screen pixel, there are rendering objects A and B with similar depths. At this time, the renderer does not know which one to render, and there is a situation where some render rendering object A and some render rendering object B. This situation can be called depth conflict (Z-Fighting).
[0137] The principle of depth conflict is as follows Fig.11 As shown, in a screen pixel 1100, there are rendering objects with similar depths, including object 1110 and object 1120, wherein the depth of object 1110 is Fig.11 In depth map 1101, the depth of object 1120 is Fig.11 , when rendering the depth map 1103 and the depth map 1102 based on the rendering background, the depth map used by the renderer may be the depth map 1104, such as Fig.11 As shown, the depth map 1103 and the depth map 1101 may be superimposed to obtain the depth map 1105, and then the depth map 1105 and the depth map 1102 may be superimposed to obtain the depth map 1104, wherein the model rendered based on the depth map 1104 has a flickering problem.
[0138] The result of rendering with depth conflict is Fig.12 , Fig.13 or Fig.14 The model shown has flickering issues. Fig.12 In the figure, there is no model flickering in city model 1201, but in city model 1202, the whole scene texture flickers at high frequency and is fragmented. Fig.13 The flickering problem of the concrete model is shown. Fig.14 In the game, as the viewing distance increases, the problem of model flickering will become more serious.
[0139] In related technologies, in order to avoid the model flickering problem, the following solutions can be adopted:
[0140] Solution 1: Increase the spacing between models or textures to avoid depth overlap between models;
[0141] Solution 2: Control the relative distance between the camera and the target to observe without exceeding the maximum threshold for flickering.
[0142] Solution 3: Multiple Levels of Detail (LOD) solution, completely ignoring the high-precision restoration of distant models.
[0143] For Solution 1, the following technical problems exist: 1. It is only suitable for small and medium-sized twin scenarios, but the flickering problem will still reappear in large or even extra-large scenarios; 2. It deviates from the essence of twins, modifies the position and structure between the models, and zooming in on the perspective will expose distortion problems; 3. It requires repeated position adjustments and repeated development and testing, which increases costs.
[0144] For Solution 2, there are the following technical problems: 1. The model size is limited. When expanding the rendering range, the model scale needs to be reduced to maintain the viewing distance; 2. Reducing the model scale requires the object to modify all rendering parameters, and the development cost is extremely high; 3. The interaction method is limited and can only be used in the bird's-eye view mode, and the target is fixed. Once the roaming mode is changed, flickering is likely to occur.
[0145] For Solution 3, there are the following technical problems: 1. It is impossible to render the entire scene with high precision. The high-poly model will only be rendered when the camera is close. 2. During the interactive operation, frequent changes in the viewing distance will trigger high-poly rendering, causing frame freezes at the second level. 3. The development cost of modeling is increased, and several sets of models will be produced for one building.
[0146] The 3D virtual scene rendering method provided by the embodiment of the present application includes the following technical features: increasing the number of depth levels (buffer levels); dynamically modifying the camera near plane distance and resetting the division of the depth range interval; turning on the grid model offset to assist the renderer in distinguishing the front and back order; defining the rendering order for the ultra-distant model and bypassing the renderer to distinguish the rendering process. The 3D virtual scene rendering method provided by the embodiment of the present application has the following technical effects: in terms of resources, there is no need to repeatedly load and render low-polygon models, saving resources; in terms of accuracy, the coordinate algorithm intervenes to assist the renderer in correctly rendering the hierarchical order between models; in terms of stability, combined with the coordinate algorithm, the logical layer agrees on the position and offset of the grid to completely avoid model flickering.
[0147] The following is a detailed description of the 3D virtual scene rendering method provided in the embodiments of the present application.
[0148] For increasing the number of depth levels (buffer levels)
[0149] Since the depth level of the renderer is limited and the depth buffer is Fig.15 As shown in the nonlinear trend, the camera viewing distance, that is, the depth, will appear closer to the camera, that is, the smaller the depth, the higher the accuracy; the farther away from the camera, that is, the greater the depth, the lower the accuracy. As a result, multiple mesh models at a very long distance are divided into one depth level, making it impossible for the depth buffer (Z-Buffer) to correctly determine the order of rendering models, resulting in high-frequency flickering.
[0150] Assume that there are three depth levels, such as Fig.15 As shown, the depth differences of each depth level are: depth level 0 (L0): 0-1, depth level 1 (L2): 1-8, depth level 2 (L3): 8-20.
[0151] The renderer calculates coordinates at different depth intervals according to different accuracies to determine the occlusion relationship. Among them, the order of model rendering is related to the resolution accuracy. At a low depth level, such as L0, the camera may calculate coordinates with an accuracy of millimeters. Therefore, if two objects are almost overlapping, the order of occlusion can still be distinguished as long as there is a millimeter difference. However, at a high depth level, such as L5, its accuracy may only be accurate to meters. Therefore, if the distance between two objects is no more than 1 meter, the camera cannot determine who is in front and who is behind through calculation, and cannot accurately render who occludes whom, so alternating rendering leads to flickering problems and flashing surfaces.
[0152] In the embodiment of the present application, the number of depth levels can be increased, a higher precision Z buffer can be used, and the probability of conflict can be reduced.
[0153] In one example, Fig.15 The number of depth levels shown increases from 3 to 6, and the depth differences of each depth level are: Depth Level 0 (L0): 0-0.8, Depth Level 1 (L2): 0.8-1.7, Depth Level 2 (L3): 1.7-4.2, Depth Level 3 (L3): 4.2-7.5, Depth Level 4 (L4): 7.5-12, Depth Level 5 (L5): 12-20.
[0154] As the depth level increases, the range of depths corresponding to a depth level decreases, for example: Fig.15 The depth distance range of L0 is 1, Fig.16 If the depth distance range of L0 is 0.8, the resolution accuracy increases.
[0155] Understandably, before the depth level increases, L0 needs to parse all models within a depth range of 1 meter. After the depth level increases, L0 needs to parse all models within a depth range of 0.8m. The accuracy of the relative distance between parsed models, i.e. the order of rendering, increases. In other words, within the same depth range, there are more levels, and the viewing distance range of each level is reduced. Under the condition that the computing power at this level remains unchanged, the parsing accuracy is higher.
[0156] Adjusting the camera's near plane is equivalent to increasing the starting value of the depth level. Because it is a nonlinear trend, modifying the near plane distance will have a much greater impact on the depth level. The mesh of a very far model may be promoted to the depth level of the previous plane, improving the camera rendering accuracy.
[0157] In one example, if Fig.10 As shown, relative to Fig.16 , the starting value of the depth level is increased by 4, that is, the near plane distance is increased by 4, so that the viewing distance that needs to be calculated in each level is larger, and the camera resolution accuracy is improved.
[0158] In the embodiment of the present application, the improvement of the near plane distance may be an adjustment based on increasing the depth level.
[0159] Enable mesh model offset to help renderer distinguish front and back order
[0160] Here, you can adjust the polygon offset of the mesh model.
[0161] The steps to adjust the polygon offset of a mesh model are:
[0162] S1. Deeply traverse the model grid and determine whether grid offset is required by comparing the relative viewing distances between grids.
[0163] S2. When the model is of ultra-long viewing distance, modify the offset to adjust the depth value of the model itself;
[0164] S3. The renderer is tricked into obtaining the modified model depth value and adjusting the rendering order.
[0165] In an embodiment of the present application, grids within the same pixel area can be compared, and when the relative distance is less than the resolution accuracy at the current depth level, a flashing surface occurs. At this time, the offset needs to be increased or decreased. For example, at this time, the camera believes that the viewing distance of the two grids is 1, and then a flashing surface occurs. In this case, the offset of one of the grids is +1. At this time, the camera gives priority to grids with offsets, and the grids with larger offsets are compared.
[0166] For example: the renderer prioritizes rendering models in order according to the offset: for example, the current depth level accuracy is 0.5 meters, and the positions of the grids in the same two pixel blocks differ by 0.4 meters. The renderer finds that one of the grids has an offset of -0.1. The renderer, which is unable to determine the rendering order, skips the cyclic rendering of the two grids (flash surface) and prioritizes rendering the grid with an offset of -0.1.
[0167] Can be as Fig.17 As shown, in Fig.17 In (a), if the mesh 1701 is shifted closer to the camera, the depth difference between the mesh 1701 and the mesh 1702 increases, and the shifted mesh 1701 is rendered first; Fig.17 In (b), if the grid 1701 is offset from the camera, the depth difference between the grid 1701 and the grid 1702 increases, and the grid 1701 is blocked by the grid 1702.
[0168] Dynamically calculate the model position, define the rendering order, bypass the buffer depth value calculation logic, and give priority to rendering. Specifically, the following steps are included:
[0169] S1. After the model mesh is initialized, it will enter a rendering queue (renderList).
[0170] Model grid initialization can be understood as differentiating the model based on grids, where different grids have different depths.
[0171] S2. The renderer will sort the queue in ascending order before rendering.
[0172] S3. After the renderer starts rendering, it will prioritize the rendering order according to the order size.
[0173] Here, the grid positions can be dynamically traversed first, and the grids at a very long distance can be marked with order. The order can be sorted by spatial position. After the renderer starts rendering, the grids marked with order are rendered first, which not only saves the buffer depth value calculation logic, but also avoids flickering.
[0174] In the embodiment of the present application, the rendering queue can be as follows Fig.18 As shown, the grid that enters the queue first leaves the queue first.
[0175] In a second aspect, in order to implement the above-mentioned 3D virtual scene rendering method, a 3D virtual scene rendering device according to an embodiment of the present application is provided. The structural schematic diagram of the 3D virtual scene rendering device is described below.
[0176] like Fig.19As shown, the 3D virtual scene rendering device 1900 includes: a determination unit 1901, a sorting unit 1902 and a rendering unit 1903;
[0177] The determining unit 1901 is used to determine, based on the depth of each grid of the 3D virtual scene, a plurality of first grids having conflicts in rendering order of the 3D virtual scene and a second grid having no conflicts in rendering order; wherein the 3D virtual scene includes a plurality of 3D models, one of the 3D models includes one or more grids, and the grids represent spatial elements constituting the 3D model;
[0178] A sorting unit 1902 is used to fix the rendering order of the plurality of first grids to obtain a first order;
[0179] The sorting unit 1902 is further configured to arrange the rendering order of the plurality of second grids based on the depth of each second grid in the plurality of second grids to obtain a second order;
[0180] The rendering module 1903 is used to render the 3D virtual scene based on the first order and the second order.
[0181] In some embodiments, the determining unit 1901 is further configured to:
[0182] Compare the depth of each grid of the 3D virtual scene with the depth upper limit value to determine the depth difference corresponding to each depth, wherein the depth upper limit value is the maximum depth of the 3D virtual scene;
[0183] A plurality of meshes whose depth differences are smaller than a specified depth difference threshold are determined as the plurality of first meshes.
[0184] In some embodiments, the sorting unit 1902 is further configured to:
[0185] According to the spatial order from far to near in the multiple first grids, the rendering order of each first grid in the multiple first grids is determined, and it is determined that the rendering order of the multiple first grids is before the rendering order of grids other than the multiple first grids in the 3D virtual scene.
[0186] In some embodiments, the sorting unit 1902 is further configured to:
[0187] marking the plurality of first grids;
[0188] Putting the marked first meshes into a rendering queue according to the rendering order of the first meshes;
[0189] After the marked multiple first grids are put into the rendering queue, grids other than the multiple first grids in the 3D virtual scene are put into the rendering queue, wherein the grids in the rendering queue are rendered based on a first-in-first-out principle.
[0190] In some embodiments, the determination unit 1901 is further configured to determine a plurality of grids with the same depth level located in the same pixel region as the plurality of first grids, wherein the depth level of the grid is determined based on the depth of the grid.
[0191] In some embodiments, the sorting unit 1902 is further configured to:
[0192] Adjusting the depth of some first grids among the plurality of first grids;
[0193] Based on the adjusted depths of the plurality of first grids, a rendering order among the plurality of first grids is determined to obtain the first order.
[0194] In some embodiments, the 3D virtual scene rendering device 1900 further includes an adjustment unit, configured to:
[0195] Subtracting a specific adjustment value from the depth of the grid to obtain an adjusted depth of the grid;
[0196] Based on the adjusted depths of the meshes, a depth level of the meshes is determined, and the depth level is used to determine a rendering order of the meshes.
[0197] In some embodiments, the 3D virtual scene rendering apparatus 1900 further includes: a selection unit, configured to:
[0198] Based on the scene type of the 3D virtual scene, selecting a target depth level division rule from a plurality of depth level division rules;
[0199] The depth level of the grid is determined by dividing the target depth level into the depth level corresponding to the adjusted depth of the grid.
[0200] It should be noted that the 3D virtual scene rendering device provided in the embodiment of the present application includes the various units included, which can be implemented by a processor in an electronic device; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU, Central Processing Unit), a microprocessor (MPU, MicroProcessor Unit), a digital signal processor (DSP, Digital Signal Processor) or a field programmable gate array (FPGA, Field-Programmable Gate Array), etc.
[0201] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0202] It should be noted that in the embodiment of the present application, if the above-mentioned 3D virtual scene rendering method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.
[0203] In a third aspect, in order to implement the above-mentioned 3D virtual scene rendering method, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the steps in the 3D virtual scene rendering method provided in the above-mentioned embodiment are implemented.
[0204] In a fourth aspect, an embodiment of the present application provides a storage medium, that is, a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the 3D virtual scene rendering method provided in the above embodiment are implemented.
[0205] It should be noted here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0206] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in some embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.
[0207] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0208] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0209] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0210] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0211] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.
[0212] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0213] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A 3D virtual scene rendering method, the method comprising: Based on the depth of each mesh of the 3D virtual scene, determine a plurality of first meshes having conflicts in rendering order of the 3D virtual scene and a second mesh having no conflicts in rendering order; wherein the 3D virtual scene includes a plurality of 3D models, one of the 3D models includes one or more meshes, and the meshes represent spatial elements constituting the 3D model; Fixing a rendering order among the plurality of first grids to obtain a first order, and determining a rendering order among the plurality of second grids based on a depth of each second grid among the plurality of second grids to obtain a second order; The 3D virtual scene is rendered based on the first order and the second order.
2. The method according to claim 1, determining a plurality of first meshes having conflicts in rendering order of the 3D virtual scene based on the depth of each mesh of the 3D virtual scene, comprising: Compare the depth of each grid of the 3D virtual scene with the depth upper limit value to determine the depth difference corresponding to each depth, wherein the depth upper limit value is the maximum depth of the 3D virtual scene; A plurality of meshes whose depth differences are smaller than a specified depth difference threshold are determined as the plurality of first meshes.
3. The method according to claim 2, wherein fixing the rendering order between the plurality of first grids to obtain the first order comprises: According to the spatial order from far to near in the multiple first grids, the rendering order of each first grid in the multiple first grids is determined, and it is determined that the rendering order of the multiple first grids is before the rendering order of grids other than the multiple first grids in the 3D virtual scene.
4. The method according to claim 3, wherein determining that the rendering order of the plurality of first meshes is before the rendering order of meshes other than the plurality of first meshes in the 3D virtual scene comprises: marking the plurality of first grids; Putting the marked first meshes into a rendering queue according to the rendering order of the first meshes; After the marked multiple first grids are put into the rendering queue, grids other than the multiple first grids in the 3D virtual scene are put into the rendering queue, wherein the grids in the rendering queue are rendered based on a first-in-first-out principle.
5. The method according to claim 1, determining a plurality of first meshes having conflicts in rendering order of the 3D virtual scene based on the depth of each mesh of the 3D virtual scene, comprises: A plurality of grids with the same depth level located in the same pixel region are determined as the plurality of first grids, wherein the depth level of the grid is determined based on the depth of the grid.
6. The method according to claim 5, wherein fixing the rendering order between the plurality of first grids to obtain the first order comprises: Adjusting the depth of some first grids among the plurality of first grids; Based on the adjusted depths of the plurality of first grids, a rendering order among the plurality of first grids is determined to obtain the first order.
7. The method according to claim 1, further comprising: Subtracting a specific adjustment value from the depth of the grid to obtain an adjusted depth of the grid; Based on the adjusted depths of the meshes, a depth level of the meshes is determined, and the depth level is used to determine a rendering order of the meshes.
8. The method according to claim 7, further comprising: Based on the scene type of the 3D virtual scene, selecting a target depth level division rule from a plurality of depth level division rules; The depth level of the grid is determined by dividing the target depth level into the depth level corresponding to the adjusted depth of the grid.
9. A 3D virtual scene rendering device, the device comprising: A determination unit, configured to determine, based on the depths of the meshes of the 3D virtual scene, a plurality of first meshes having conflicts in rendering order of the 3D virtual scene and a second meshes having no conflicts in rendering order; wherein the 3D virtual scene includes a plurality of 3D models, one of the 3D models includes one or more meshes, and the meshes represent spatial elements constituting the 3D model; A sorting unit, used for fixing the rendering order among the plurality of first grids to obtain a first order; The sorting unit is further used to arrange the rendering order of the plurality of second grids based on the depth of each second grid in the plurality of second grids to obtain a second order; A rendering unit is used to render the 3D virtual scene based on the first order and the second order.
10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the 3D virtual scene rendering method according to any one of claims 1 to 8 is implemented.