Model rendering method and device, terminal equipment and readable storage medium

By generating a bounding box and eliminating unnecessary structures according to the collision relationship, the model rendering process is simplified, and the rendering time problem is too long due to the large number of nodes and faces of the three-dimensional model is solved, which improves the rendering speed and user experience.

CN119169165APending Publication Date: 2024-12-20CONTEMPORARY AMPEREX FUTURE ENERGY RES INST (SHANGHAI) LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310730826.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-19
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

In the existing model rendering methods, the more nodes and faces the three-dimensional model, the longer the rendering time, resulting in the user waiting time being too long and the experience is poor.

Method used

By generating the bounding box of the three-dimensional mesh model, the collision relationship between the bounding boxes is determined, unnecessary structure is eliminated, and only the three-dimensional mesh model that needs to be retained is rendered to simplify the rendering process.

Benefits of technology

Improve rendering speed, shorten the waiting time of users, and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119169165A_ABST
    Figure CN119169165A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of model rendering, and provides a model rendering method and device, terminal equipment and a readable storage medium, and the method comprises the steps: generating a bounding box of a to-be-rendered three-dimensional grid model; determining a collision relationship between the bounding boxes, and determining a three-dimensional grid model needing to be reserved according to the collision relationship; and rendering the three-dimensional grid model needing to be reserved to obtain a rendered image corresponding to the three-dimensional grid model to be rendered. Through the method, the surface feature details of the three-dimensional grid model to be rendered can be reserved after rendering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of model rendering technology, and in particular, relates to a model rendering method, apparatus, terminal device and readable storage medium. Background Art

[0002] Model rendering is the process of converting a three-dimensional radiosity process into a two-dimensional image.

[0003] At present, in order to make the rendered 3D model as close to the actual object as possible, a 3D model with more nodes and faces is usually designed. During the model rendering process, the more nodes and faces the 3D model has, the longer the rendering time is required, which causes the user to wait too long and have a poor experience. Summary of the invention

[0004] The embodiments of the present application provide a model rendering method, apparatus, terminal device and readable storage medium, which can solve the problem of long rendering time in existing rendering methods.

[0005] In a first aspect, an embodiment of the present application provides a model rendering method, comprising:

[0006] Generate a bounding box of the three-dimensional mesh model to be rendered;

[0007] Determining a collision relationship between the bounding boxes, and determining a three-dimensional mesh model to be retained according to the collision relationship;

[0008] The three-dimensional mesh model to be retained is rendered to obtain a rendered image corresponding to the three-dimensional mesh model to be rendered.

[0009] Since the bounding box is a regular object, it is more efficient and simpler to use it to replace the model itself for collision calculation than to use the model itself directly for collision calculation. At the same time, since the 3D mesh model to be rendered is determined according to the collision relationship, only the 3D mesh model to be retained needs to be rendered during rendering, thus simplifying the structure to be rendered, thereby increasing the rendering speed, shortening the user's waiting time, and improving the user's good experience.

[0010] Optionally, determining the three-dimensional mesh model to be retained according to the collision relationship includes:

[0011] The internal structure in the three-dimensional mesh model to be rendered is eliminated according to the collision relationship to obtain the three-dimensional mesh model to be retained.

[0012] Optionally, the removing the internal structure in the three-dimensional mesh model to be rendered according to the collision relationship includes:

[0013] The three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the collision relationship in the three-dimensional mesh model to be rendered is eliminated according to the collision relationship to obtain the three-dimensional mesh model to be retained.

[0014] Optionally, before removing the three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the collision relationship in the three-dimensional mesh model to be rendered according to the collision relationship, the method further includes:

[0015] When the collision relationship is an intersection relationship, a ratio value between the volume of the intersection portion and the volume of the bounding box with a smaller volume is calculated;

[0016] The step of eliminating the three-dimensional mesh model corresponding to the overlapping area of ​​two bounding boxes corresponding to the collision relationship in the three-dimensional mesh model to be rendered according to the collision relationship includes:

[0017] When the ratio value is greater than a preset ratio threshold, the three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the intersection relationship in the three-dimensional mesh model to be rendered is discarded.

[0018] Optionally, the model rendering method further includes:

[0019] When the ratio value is greater than a preset ratio threshold, the target area of ​​the smaller bounding box in the two bounding boxes corresponding to the intersection relationship in the three-dimensional mesh model to be rendered is eliminated, and the target area is the area of ​​the smaller bounding box that does not belong to the overlapping area.

[0020] Optionally, determining the collision relationship between the bounding boxes and determining the three-dimensional mesh model to be retained according to the collision relationship includes:

[0021] Select an untraversed bounding box from the target bounding boxes, and determine the collision relationship between the selected bounding box and the remaining bounding boxes, wherein when the untraversed bounding box is selected for the first time, the target bounding box is each generated bounding box, and when the untraversed bounding box is not selected for the first time, the target bounding box is the bounding box corresponding to the current three-dimensional mesh model to be retained;

[0022] After each traversal, the three-dimensional mesh model corresponding to the smaller bounding box of the two bounding boxes whose collision relationship is a containment relationship is eliminated.

[0023] Optionally, the model rendering method further includes:

[0024] After the collision relationships among all the bounding boxes in the target bounding box are determined, for each group of two bounding boxes whose collision relationships are intersecting relationships, determine whether to determine the three-dimensional mesh model corresponding to the bounding box with the smaller volume as the three-dimensional mesh model to be retained based on the proportional relationship between the volume of the intersecting part and the volume of the bounding box with the smaller volume.

[0025] Optionally, before selecting an untraversed bounding box from the target bounding box, the method further includes:

[0026] Calculate the volume of each of the generated bounding boxes;

[0027] According to the size of the volume, the bounding boxes are sorted from large to small, wherein when the untraversed bounding boxes are selected for the first time, the sorted bounding boxes are used as the target bounding boxes;

[0028] The step of selecting an untraversed bounding box from the target bounding box includes:

[0029] An untraversed bounding box is selected from the target bounding boxes in order from front to back.

[0030] Optionally, before generating the bounding box of the three-dimensional mesh model to be rendered, the method further includes:

[0031] Get the model file content of the 3D model file;

[0032] Generate a data structure in a target format according to the content of the model file;

[0033] A mesh structure is generated according to the data structure to obtain the three-dimensional mesh model to be rendered.

[0034] Optionally, the data structure of the target format includes vertex coordinates of a vertex and a vertex index field of the vertex, the vertex index field includes: a connection relationship between the vertex and other vertices stored in a tree structure, and generating a mesh structure according to the data structure includes:

[0035] Determine the vertex corresponding to the parent node and the vertex index field corresponding to the parent node according to the connection relationship between the vertex stored in the tree structure in the vertex index field and other vertices;

[0036] A mesh structure is generated according to the determined vertex coordinates corresponding to the vertex and the determined vertex index field.

[0037] Optionally, generating a bounding box of the three-dimensional mesh model to be rendered includes:

[0038] For each vertex index field, determine the vertices with a connection relationship according to the vertex index field to obtain a target vertex set;

[0039] For each of the target vertex sets, determining the maximum value and the minimum value corresponding to the target vertex set on the three-dimensional coordinate axis according to the vertex coordinates of the vertices in the target vertex set;

[0040] The bounding box of the three-dimensional mesh model to be rendered is generated according to the maximum value and the minimum value corresponding to each of the target vertices concentrated on the three-dimensional coordinate axis.

[0041] Optionally, before generating the bounding box of the three-dimensional mesh model to be rendered, the method further includes:

[0042] Determining whether the three-dimensional mesh model to be rendered needs to be simplified;

[0043] The generating of the bounding box of the three-dimensional mesh model to be rendered comprises:

[0044] In the case where the three-dimensional mesh model to be rendered needs to be simplified, a bounding box of the three-dimensional mesh model to be rendered is generated.

[0045] Optionally, the determining whether the three-dimensional mesh model to be rendered needs to be simplified includes:

[0046] Acquire current scene information or model information of the three-dimensional mesh model to be rendered;

[0047] It is determined whether the three-dimensional mesh model to be rendered needs to be simplified according to the current scene information or the model information.

[0048] In a second aspect, an embodiment of the present application provides a model rendering device, including:

[0049] A bounding box generation module, used to generate a bounding box of a three-dimensional mesh model to be rendered;

[0050] A module for determining a three-dimensional mesh model to be retained, used to determine a collision relationship between the bounding boxes, and determine a three-dimensional mesh model to be retained according to the collision relationship;

[0051] The rendering module is used to render the three-dimensional mesh model to be retained to obtain a rendered image corresponding to the three-dimensional mesh model to be rendered.

[0052] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in any one of the first aspects when executing the computer program.

[0053] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the first aspects is implemented.

[0054] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute any of the methods described in the first aspect above.

[0055] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art.

[0057] Figure 1 It is a flowchart of a model rendering method provided by an embodiment of the present application;

[0058] Figure 2 is a schematic diagram of a side view of a three-dimensional grid to be rendered provided by an embodiment of the present application;

[0059] Figure 3 This is a method provided by an embodiment of the present application. Figure 2 A schematic diagram of a bounding box obtained by performing a bounding box operation on a three-dimensional mesh to be rendered;

[0060] Figure 4 It is a schematic diagram of two bounding boxes whose collision relationship is a containment relationship provided by an embodiment of the present application;

[0061] Figure 5 is a schematic diagram of two bounding boxes in a separation relationship with a collision relationship provided by another embodiment of the present application;

[0062] Figure 6 This is a schematic diagram of a bounding box before deletion provided by an embodiment of the present application;

[0063] Figure 7 Another embodiment of the present application provides Figure 6 Schematic diagram after some bounding boxes are deleted;

[0064] Figure 8 is a schematic diagram of a three-dimensional mesh model to be rendered provided by another embodiment of the present application;

[0065] Fig. 9 is a schematic diagram of a retained three-dimensional grid model provided in an embodiment of the present application;

[0066] Fig.10 It is a structural schematic diagram of a model rendering device provided by an embodiment of the present application;

[0067] Fig.11 It is a structural diagram of a terminal device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0068] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0069] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0070] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0071] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0072] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.

[0073] Embodiment 1:

[0074] When a 3D model includes a large number of nodes and faces, it will take a long time to render if all the nodes and faces are rendered.

[0075] In order to shorten the rendering time, the embodiment of the present application provides a model rendering method, in which a bounding box of a 3D mesh model to be rendered is first generated, and then the 3D mesh model to be retained is determined based on the collision relationship between the generated bounding boxes, and finally the 3D mesh model to be retained is rendered.

[0076] The model rendering method provided in the embodiment of the present application is described below with reference to the accompanying drawings.

[0077] Figure 1 A flow chart of a model rendering method provided in an embodiment of the present application is shown, and the method can be applied to a terminal device, as described in detail as follows:

[0078] S11, generating a bounding box of the three-dimensional mesh model to be rendered.

[0079] The shape of the three-dimensional mesh model to be rendered may be a regular shape, such as a cube or a cuboid, or an irregular shape, such as an irregular shape composed of a plurality of three-dimensional bodies of different shapes.

[0080] The 3D mesh model to be rendered may be a standard mesh structure of the Web Graphics Library (WebGL) on the Web side. The WebGL technology is a technology used to draw and render 3D graphics on a web page and allow users to interact with them.

[0081] Among them, the bounding box is an algorithm for solving the optimal bounding space of a discrete point set. The basic idea is to use a slightly larger geometric body with simpler characteristics (i.e., the bounding box) to approximately replace complex geometric objects. Common bounding box algorithms include axis-aligned bounding box (AABB), bounding sphere, oriented bounding box (OBB), and fixed directions hull (FDH).

[0082] Since the 3D mesh model to be rendered is usually an irregular shape, and the bounding box is a geometric body with simple features, the number of bounding boxes generated is usually greater than 1. Assume that the side of the 3D mesh to be rendered (the side is a 2D graphic) is as follows Figure 2 As shown, after the bounding box operation is performed on the three-dimensional grid to be rendered, two bounding boxes are obtained, such as Figure 3 shown.

[0083] In an embodiment of the present application, in the process of generating a bounding box of a three-dimensional mesh model to be rendered, a mapping relationship between the three-dimensional mesh model to be rendered and the bounding box is recorded, as well as the maximum and minimum values ​​of each bounding box in three dimensions. For example, assuming that there are two bounding boxes generated, the position coordinates of the three-dimensional mesh model enclosed by each bounding box are recorded, and then the mapping relationship between each bounding box and the three-dimensional mesh model to be rendered is obtained. After obtaining the mapping relationship between each bounding box and the three-dimensional mesh model, the three-dimensional mesh models corresponding to different bounding boxes can be found out according to the mapping relationship.

[0084] S12, determining the collision relationship between the above bounding boxes, and determining the three-dimensional mesh model to be retained according to the above collision relationship.

[0085] Specifically, when the number of generated bounding boxes is greater than 1, for each dimension, the coordinates of two bounding boxes in the dimension are compared, and the collision relationship between the two bounding boxes is determined according to the comparison results of the coordinates in each dimension.

[0086] In some embodiments, the above-mentioned collision relationship includes: a containment relationship, an intersection relationship, and a separation relationship. Specifically, when the number of generated bounding boxes is greater than 1, the collision relationship between the two bounding boxes is determined by comparing the maximum and minimum values ​​of the two bounding boxes in three dimensions. For example, assuming there are two bounding boxes: a first bounding box and a second bounding box, the maximum and minimum values ​​of the first bounding box in three dimensions are respectively: Xmin, Xmax, Ymin, Ymax, Zmin, Zmax, and the relationship between all vertices (x, y, z) of the second bounding box and Xmin, Xmax, Ymin, Ymax, Zmin, Zmax is determined. If:

[0087] Xmin≤x≤Xmax

[0088] Ymin≤y≤Ymax

[0089] Zmin≤y≤Zmax

[0090] It is determined that the first bounding box contains the second bounding box, that is, the second bounding box is inside the first bounding box, that is, the collision relationship between the first bounding box and the second bounding box is a containment relationship. Figure 4 A schematic diagram showing two bounding boxes whose collision relationship is a containment relationship.

[0091] If all vertices (x, y, z) of the second bounding box do not satisfy the above relationship, that is, x is greater than Xmax or x is less than Xmin, y is greater than Ymax or y is less than Ymin, z is greater than Zmax or z is less than Zmin, then it is determined that there is no overlap between the first bounding box and the second bounding box, that is, the collision relationship between the first bounding box and the second bounding box is a separation relationship. Figure 5 A schematic diagram showing two bounding boxes whose collision relationship is a separation relationship.

[0092] If some vertices (x, y, z) of the second bounding box satisfy the above relationship, such as Xmin≤x≤Xmax, but y is greater than Ymax or y is less than Ymin, then it is determined that there is a partial overlap between the first bounding box and the second bounding box, that is, the collision relationship between the first bounding box and the second bounding box is an intersection relationship. Figure 3 A schematic diagram showing two bounding boxes whose collision relationship is an intersection relationship.

[0093] After obtaining the collision relationship, the terminal device can select the 3D mesh model to be retained according to the retention instruction issued by the user. The retention instruction includes a specific collision relationship. For example, when the collision relationship included in the retention instruction is a separation relationship, the 3D mesh model corresponding to the separation relationship is the 3D mesh model to be retained. When the collision relationship included in the retention instruction is a separation relationship and an intersection relationship, the 3D mesh models corresponding to the separation relationship and the intersection relationship are both the 3D mesh models to be retained.

[0094] Of course, in addition to selecting the 3D mesh model to be retained according to the retention instruction issued by the user, the 3D mesh model to be retained can also be selected according to a preset rule. For example, when the preset rule is to remove the internal structure of the 3D mesh model to be rendered, the 3D mesh model to be retained is the 3D mesh model remaining after removing the internal structure from the 3D mesh model to be rendered.

[0095] S13, rendering the three-dimensional mesh model to be retained to obtain a rendered image corresponding to the three-dimensional mesh model to be rendered.

[0096] Specifically, the three-dimensional mesh model to be retained can be added to the rendering scene for rendering, such as adding it to the WebGL rendering scene for rendering. Before rendering, it is also necessary to initialize the WebGL rendering scene to make the rendered virtual scene closer to the real environment. For example, by creating an ambient light module and a parallel light module to simulate the diffuse light source and the sunlight source in the environment respectively, and by initializing the camera module to simulate the user's perspective. Since WebGL does not require any browser plug-in support, and its interface is implemented through a unified, cross-platform open graphics library interface, rendering the three-dimensional mesh model to be retained in the WebGL rendering scene can improve the convenience of rendering.

[0097] In the embodiment of the present application, since the bounding box is a regular object, it is more efficient and simpler to use it to replace the model itself for collision calculation than to directly use the model itself for collision calculation. At the same time, since the three-dimensional mesh model to be rendered is determined to be retained according to the collision relationship, only the three-dimensional mesh model to be retained needs to be rendered during rendering, thus simplifying the structure to be rendered, thereby increasing the rendering speed, shortening the user's waiting time, and improving the user's good experience.

[0098] It should be understood that the size of the serial numbers of the steps in the above embodiments 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 embodiments of the present application.

[0099] Embodiment 2:

[0100] In some embodiments, when determining the three-dimensional mesh model to be retained according to a preset rule, the step of determining the three-dimensional mesh model to be retained according to the collision relationship in S12 includes:

[0101] The internal structure of the three-dimensional mesh model to be rendered is eliminated according to the collision relationship to obtain the three-dimensional mesh model to be retained.

[0102] The above-mentioned internal structure refers to a structure that does not belong to the surface of the three-dimensional mesh model to be rendered.

[0103] In the embodiment of the present application, after the internal structure is removed, there is no need to render the internal structure subsequently. Since what is removed is the internal structure in the three-dimensional mesh model to be rendered, that is, the external structure of the three-dimensional mesh model to be rendered is retained, it is possible to ensure that the three-dimensional model to be rendered still retains the mesh feature details on its surface after rendering. And since users usually do not pay attention to the internal structure of the model, if the three-dimensional mesh model to be rendered is rendered after the internal structure is removed, it can not only reduce the three-dimensional mesh models to be rendered and improve the rendering efficiency, but also retain the mesh feature details on the surface of the three-dimensional mesh model to be rendered as much as possible, that is, it is guaranteed that the user can obtain enough mesh feature details on the surface of the model.

[0104] In some embodiments, the above-mentioned removing the internal structure in the above-mentioned three-dimensional mesh model to be rendered according to the above-mentioned collision relationship includes:

[0105] According to the collision relationship, the three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the collision relationship in the three-dimensional mesh model to be rendered is eliminated to obtain the three-dimensional mesh model to be retained.

[0106] Specifically, after determining the collision relationship between the bounding boxes in the three-dimensional mesh model to be rendered, analyze whether there are overlapping areas between the two bounding boxes corresponding to each collision relationship. If so, the three-dimensional mesh models corresponding to these overlapping areas are discarded. For example, assuming that the collision relationship between the two bounding boxes is a containment relationship, since the area where the contained bounding box is located is the overlapping area of ​​the two bounding boxes, therefore, discarding the overlapping area means discarding the three-dimensional mesh model corresponding to the contained bounding box. For example, assuming that the collision relationship between the two bounding boxes is an intersection relationship, since the intersecting area in the two bounding boxes is the overlapping area, therefore, discarding the overlapping area means discarding the three-dimensional mesh model corresponding to the intersecting area.

[0107] Of course, if the collision relationship between the two bounding boxes is a separation relationship, since there is no overlapping part between the two bounding boxes in the separation relationship, the three-dimensional mesh models corresponding to the two bounding boxes are not eliminated, that is, the three-dimensional mesh models corresponding to the two bounding boxes are retained.

[0108] In the embodiment of the present application, considering that when there is an overlapping area between two bounding boxes, the structure corresponding to the overlapping area must belong to the internal structure of the two bounding boxes. Therefore, by finding the overlapping area and eliminating it, the three-dimensional mesh model that needs to be retained can be accurately determined.

[0109] In some embodiments, considering that the collision relationship between two bounding boxes is an intersection relationship, both bounding boxes have areas that do not belong to the other bounding box, and since the intersections of the two bounding boxes are extensions of the areas in the corresponding bounding boxes that do not belong to the other bounding box, in order to balance the rendered image that can be viewed by the user and the rendering speed, before the three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the collision relationship in the three-dimensional mesh model to be rendered is removed according to the collision relationship, the following further includes:

[0110] When the collision relationship is an intersection relationship, the ratio of the volume of the intersection portion to the volume of the bounding box with a smaller volume is calculated.

[0111] Correspondingly, the above-mentioned removing the three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the above-mentioned collision relationship in the above-mentioned three-dimensional mesh model to be rendered according to the above-mentioned collision relationship includes:

[0112] When the ratio value is greater than a preset ratio threshold, the three-dimensional mesh model corresponding to the overlapping area of ​​the two bounding boxes corresponding to the intersection relationship in the three-dimensional mesh model to be rendered is eliminated.

[0113] The preset ratio threshold is usually greater than or equal to 50%.

[0114] In the embodiment of the present application, assuming that the collision relationship between the bounding box A and the bounding box B is determined to be an intersection relationship, and the volume of the bounding box A is smaller than the volume of the bounding box B, assuming that the volume of the intersection of the bounding box A and the bounding box B is S, the ratio value is first calculated: the volume of the bounding box A / S. After determining that the ratio value is greater than the preset ratio threshold, the intersection between the bounding box A and the bounding box B is removed, otherwise, the intersection between the bounding box A and the bounding box B is not removed. Since the three-dimensional mesh model corresponding to the intersection between the two bounding boxes is removed only after the ratio value is greater than the preset ratio threshold, and when the above conditions are met, it indicates that the mesh feature details of the surface included in the bounding box with a smaller volume are less, therefore, even if the intersection of the two bounding boxes is removed, it will not have a significant impact on the user viewing the rendered three-dimensional mesh model.

[0115] It should be noted that when the collision relationship is a containment relationship, the ratio value can be calculated without calculation, and the 3D mesh model lost by the contained bounding box can be directly eliminated. Of course, when the collision relationship is a separation relationship, the 3D mesh models corresponding to the two bounding boxes in the separation relationship are retained. Figure 6 ,exist Figure 6 The diagram shows the bounding box before it is culled based on its collision relationship. Figure 7 The collision relationship between the bounding box and the Figure 6 Schematic diagram after removing some bounding boxes. Figure 8 , Figure 8 It shows a schematic diagram of the 3D mesh model to be rendered. Fig. 9 Shown is a schematic diagram of the preserved 3D mesh model.

[0116] In some embodiments, in order to further shorten the rendering time, the above model rendering method further includes:

[0117] When the above-mentioned ratio value is greater than a preset ratio threshold, the target area of ​​the smaller bounding box in the two bounding boxes corresponding to the above-mentioned intersection relationship in the above-mentioned three-dimensional mesh model to be rendered is eliminated, and the above-mentioned target area is the area in the above-mentioned smaller bounding box that does not belong to the above-mentioned overlapping area.

[0118] In the embodiment of the present application, when the collision relationship is an intersection relationship, the ratio of the volume of the intersecting part to the volume of the smaller bounding box is calculated, and after determining that the ratio is greater than a preset ratio threshold (the ratio threshold can be set to a value greater than 50%), the area in the smaller bounding box that does not belong to the overlapping area of ​​the smaller bounding box and the larger bounding box is eliminated. That is, in the embodiment of the present application, when the collision relationship is an intersection relationship, if it is determined that the ratio is greater than the preset ratio threshold, the three-dimensional mesh model corresponding to the smaller bounding box is eliminated. Since when the ratio is greater than the preset ratio threshold, it indicates that the mesh feature details of the surface included in the smaller bounding box are less, even if the three-dimensional mesh model corresponding to the smaller bounding box is eliminated, it will not have a significant impact on the user's viewing of the rendered three-dimensional mesh model.

[0119] Embodiment three:

[0120] In some embodiments, the above S12 includes:

[0121] A1. Select an untraversed bounding box from the target bounding boxes, and determine the collision relationship between the selected bounding box and the remaining bounding boxes, wherein when the untraversed bounding box is selected for the first time, the target bounding box is the generated bounding boxes, and when the untraversed bounding box is not selected for the first time, the target bounding box is the bounding box corresponding to the current three-dimensional mesh model to be retained.

[0122] A2. After each traversal, the three-dimensional mesh model corresponding to the smaller bounding box of the two bounding boxes whose collision relationship is a containment relationship is eliminated.

[0123] Specifically, assuming that the number of bounding boxes generated is greater than 1, these bounding boxes are traversed in a certain order (such as from front to back), and the collision relationship between the selected bounding box and other bounding boxes is determined. If the collision relationship is a containment relationship, the three-dimensional mesh model corresponding to the smaller bounding box of the two bounding boxes corresponding to the containment relationship is eliminated, and then new bounding boxes are continuously selected for traversal until the remaining bounding boxes are all traversed. Since the bounding boxes that need to be calculated for the collision relationship are selected by traversal, repeated calculation of the collision relationship for the same bounding box can be avoided. At the same time, since the three-dimensional mesh model corresponding to the smaller bounding box of the two bounding boxes in the containment relationship is eliminated after each traversal, the internal structure in the three-dimensional mesh model to be rendered can be eliminated in time. In addition, since the bounding box is eliminated, it is no longer necessary to calculate the collision relationship for the bounding box, thereby reducing the amount of calculation of the collision relationship.

[0124] In some embodiments, the above model rendering method further includes:

[0125] After the collision relationship of each bounding box in the above-mentioned target bounding box is determined, for each group of two bounding boxes with an intersecting collision relationship, determine whether to determine the three-dimensional mesh model corresponding to the above-mentioned smaller bounding box as the three-dimensional mesh model to be retained based on the proportional relationship between the volume of the intersecting part and the volume of the smaller bounding box.

[0126] Specifically, after each traversal, the two bounding boxes corresponding to each intersection relationship are retained first. Only after the collision relationship of each bounding box in the target bounding box is determined, the proportional relationship between the volume of the intersecting part and the smaller bounding box of the two intersecting bounding boxes is calculated, and according to the calculated proportional relationship, it is determined whether to discard the three-dimensional mesh model corresponding to the smaller bounding box.

[0127] In order to more clearly describe the process of how to determine the three-dimensional mesh model to be retained by traversing the bounding box, a specific application example is described below.

[0128] Assume that the number of bounding boxes of the generated three-dimensional mesh model to be rendered is 4, namely A, B, C, and D.

[0129] Select A for the first traversal: determine the collision relationships between A and B, A and C, and A and D. If the collision relationship between A and B is a containment relationship and A contains B, the collision relationship between A and C is an intersection relationship, and the collision relationship between A and D is a separation relationship, then after this traversal is completed, the 3D mesh model corresponding to B is removed.

[0130] After the first traversal, the remaining bounding boxes are A, C, and D.

[0131] Select C for the second traversal. Since the collision relationship between A and C has been determined, only the collision relationship between C and D needs to be determined during this traversal. Assume that the collision relationship between C and D is a containment relationship, and the volume of D is greater than the volume of C, that is, D contains C. Therefore, delete the 3D mesh model corresponding to C.

[0132] After the second traversal, the collision relationships of the remaining bounding boxes (i.e., A and D) are determined. Although during the first traversal, the collision relationship between A and C is an intersection relationship (assuming that the volume of A is greater than the volume of C), since the 3D mesh model corresponding to C is removed after the second traversal, that is, the collision relationship between A and C will no longer exist, there is no need to determine the proportional relationship between the volume of the intersection part (i.e., the overlapped part of A and C) and the volume of C, and thus there is no need to perform the determination step of whether to retain the 3D mesh model corresponding to C, thereby improving the rendering efficiency of the model.

[0133] In the embodiment of the present application, after each collision relationship between two bounding boxes is obtained, the three-dimensional mesh model corresponding to the bounding box with the smaller volume in the containing relationship is first eliminated, but the three-dimensional mesh model corresponding to the bounding box with the intersecting relationship is temporarily not processed. Only after the collision relationship of the remaining bounding boxes is obtained, it is determined whether the three-dimensional mesh model corresponding to the bounding box with the smaller volume in the intersecting relationship needs to be retained. The two bounding boxes with the intersecting relationship determined earlier may be eliminated when the collision relationship is determined later (for example, if a bounding box with the intersecting relationship is contained by other bounding boxes, then the bounding box will be eliminated). Therefore, when the above method is used to determine the three-dimensional mesh model to be retained, the amount of calculation can be reduced and the efficiency of obtaining the three-dimensional mesh model to be retained can be improved.

[0134] In some embodiments, before the above A1, the method further includes:

[0135] B1. Calculate the volume of each of the above generated bounding boxes.

[0136] Specifically, before calculating the volume of a bounding box, the center point of the bounding box is determined according to the maximum and minimum values ​​of the bounding box in three dimensions, and the length, width, and depth of the bounding box are determined according to the center point and each vertex of the bounding box. The volume of the bounding box is calculated according to the length, width, and depth of the bounding box.

[0137] B2. Sort the bounding boxes from large to small according to their volumes, wherein when selecting an untraversed bounding box for the first time, use the sorted bounding boxes as the target bounding boxes.

[0138] Correspondingly, the above A1 includes:

[0139] Select an untraversed bounding box from the above target bounding boxes in order from front to back.

[0140] In order to more clearly describe how to sort the bounding boxes according to their volumes and how to traverse the sorted bounding boxes, a specific application example is described below.

[0141] Assume that the number of bounding boxes of the generated 3D mesh model to be rendered is 4, namely A, B, C, and D, and the volume of each bounding box satisfies the following relationship: A>B>D>C, then the result after sorting is: ABDC.

[0142] From the front to the back, select an untraversed bounding box in the target bounding box "ABDC". Since A has not been traversed, A is selected for the first traversal: determine the collision relationship between A and B, A and D, and A and C respectively. If the collision relationship between A and B is a containment relationship and A contains B, the collision relationship between A and D is an intersection relationship, and the collision relationship between A and C is a separation relationship, then after this traversal is completed, the 3D mesh model corresponding to B is eliminated.

[0143] After the first traversal is completed, an untraversed bounding box is selected from the target bounding box "ADC" from the front to the back. The bounding box selected this time is "D". The collision relationship between D and C determined during the traversal process is a separation relationship.

[0144] Since the remaining bounding boxes (i.e., the target bounding boxes) are "ADC" after the second traversal, and the collision relationships between these bounding boxes are determined, the bounding boxes corresponding to the intersection relationship can be screened out from these collision relationships: i.e., A and D, and whether to retain the 3D mesh model corresponding to D is determined based on the ratio of the volume of the intersection to the volume of D. Since the collision relationship between A and C is a disjoint relationship, and the collision relationship between D and C is also a disjoint relationship, the 3D mesh model corresponding to C is the 3D mesh model that needs to be retained, and since A has the largest volume, the 3D mesh model corresponding to A is also the 3D mesh model that needs to be retained.

[0145] In the embodiment of the present application, since each bounding box is first sorted in order from large to small according to the volume of the bounding box, and then the untraversed bounding boxes are selected in order from front to back to calculate the collision relationship between the bounding boxes, the collision relationship between the bounding boxes with large volumes will be calculated first when calculating the collision relationship. Since the probability of a bounding box with a larger volume containing other bounding boxes is greater, the collision relationship between the bounding box with a larger volume and other bounding boxes is calculated first, so that the three-dimensional mesh model corresponding to the contained bounding box can be eliminated earlier, thereby reducing the number of bounding boxes that need to be calculated for collision relationships later, and thus improving the efficiency of obtaining the three-dimensional mesh model that needs to be retained.

[0146] Embodiment 4:

[0147] In some embodiments, before the above S11, the method further includes:

[0148] C1. Obtain the model file content of the 3D model file.

[0149] The above-mentioned model file content is the content that needs to be rendered, wherein the format of the 3D model file includes but is not limited to the following formats: ".obj", ".gltf", ".glb", ".fbx", and ".stl".

[0150] Specifically, the 3D model file stored in a local or cloud server may be read through Ajax or fetch, and the model file content of the read 3D model file may be obtained.

[0151] C2. Generate a data structure in the target format according to the content of the above model file.

[0152] The target data structure may be a json data structure or a string data structure.

[0153] C3. Generate a grid structure according to the above data structure to obtain the above three-dimensional grid model to be rendered.

[0154] The grid data in the grid structure is internal data stored in a computer in a grid structure and is suitable for screen display.

[0155] In the embodiment of the present application, considering that the model file content includes the content that needs to be rendered, it is possible to quickly generate a data structure in a target format based on the model file content, and the grid structure is a special data structure. Therefore, after generating the data structure in the target format, it is possible to accurately generate a grid structure corresponding to the data structure in combination with the characteristics of the grid structure, thereby facilitating subsequent corresponding rendering based on the grid structure.

[0156] In some embodiments, the data structure of the target format includes vertex coordinates of the vertex and a vertex index field of the vertex, the vertex index field includes: a connection relationship between the vertex and other vertices stored in a tree structure, and the C3 includes:

[0157] C31. Determine the vertex corresponding to the parent node and the vertex index field corresponding to the parent node according to the connection relationship between the vertex stored in the tree structure in the vertex index field and other vertices.

[0158] The vertex index field includes the connection relationship between the vertex and other vertices in the model file content. For example, assuming that the vertex index field corresponding to vertex A is vertex index field A, and vertex A is connected to vertex B, then the vertex index field includes: the connection relationship between vertex A and vertex B. From the connection relationship between the two vertices, it can be seen which of the two vertices is the parent node and which vertex is the child node. In addition, the vertex index field can also include the mesh drawing order of the vertices.

[0159] Specifically, the connection relationship of each vertex index field is analyzed to find out the vertices belonging to the parent node among each vertex.

[0160] C32. Generate a mesh structure according to the determined vertex coordinates corresponding to the above vertices and the determined vertex index fields.

[0161] After determining which vertex belongs to the parent node, the vertex coordinates of the obtained vertices and the vertex index fields corresponding to the vertices are converted into a three-dimensional mesh model, such as a WebGL standard mesh structure. Of course, if the vertex index field also includes the mesh drawing order of the vertex, each vertex is converted into a three-dimensional mesh model according to the mesh drawing order of the vertex.

[0162] For example, suppose that the three-dimensional model corresponding to the content of the model file is a bottle and a fruit, and the fruit is in the bottle. Since the fruit is in the bottle, the vertices corresponding to the fruit are child nodes of the vertices corresponding to the bottle. At this time, the three-dimensional mesh model to be rendered can be directly obtained based on the vertices corresponding to the bottle.

[0163] In the embodiment of the present application, since the vertices belonging to the parent node are first filtered out from each vertex and then converted into a three-dimensional mesh model, the number of vertices that need to be converted into a three-dimensional mesh model is reduced, thereby improving the conversion efficiency.

[0164] In some embodiments, the above S11 includes:

[0165] D1. For each vertex index field, determine the vertices with a connection relationship according to the vertex index field to obtain a target vertex set.

[0166] Specifically, a target vertex set is determined according to the connection relationship of the vertices recorded in each vertex index field in the data structure of the target format.

[0167] D2. For each of the target vertex sets, determine the maximum value and the minimum value corresponding to the target vertex set on the three-dimensional coordinate axis according to the vertex coordinates of the vertices in the target vertex set.

[0168] D3. Generate a bounding box of the three-dimensional mesh model to be rendered according to the maximum and minimum values ​​corresponding to each of the target vertices concentrated on the three-dimensional coordinate axis.

[0169] Since the mesh model to be rendered is a three-dimensional model, the generated bounding box is also a three-dimensional bounding box, and the maximum value of the coordinates of the bounding box in any dimension is at least greater than the minimum value of the coordinates of the three-dimensional mesh model in that dimension, and the minimum value of the coordinates of the bounding box in that dimension is at least less than the minimum value of the coordinates of the three-dimensional mesh model in that dimension. That is, the bounding box of the three-dimensional mesh model to be rendered can be accurately generated according to the above method.

[0170] Embodiment five:

[0171] In some embodiments, considering that in some scenarios, the user does not need to pay attention to the internal structure of the model, but in some scenarios, the user needs to pay attention to the internal structure of the model, therefore, before the above S11, it also includes:

[0172] Determine whether the three-dimensional mesh model to be rendered needs to be simplified.

[0173] The above S11 includes:

[0174] In the case that the three-dimensional mesh model to be rendered needs to be simplified, a bounding box of the three-dimensional mesh model to be rendered is generated.

[0175] The model simplification refers to removing part of the structure of the three-dimensional mesh model to be rendered, such as removing the internal structure of the three-dimensional mesh model to be rendered.

[0176] In an embodiment of the present application, since the bounding box of the model is generated only after it is determined that the three-dimensional mesh model to be rendered needs to be simplified, it is possible to avoid the situation where the bounding box is still generated when the user does not need to simplify the model, thereby resulting in the subsequent deletion of certain mesh models based on the collision relationship between the bounding boxes.

[0177] In some embodiments, the above-mentioned determination of whether the three-dimensional mesh model to be rendered needs to be simplified includes:

[0178] E1. Obtain current scene information or model information of the above-mentioned three-dimensional mesh model to be rendered.

[0179] The current scene information may include at least one of the following: the current time, the user who issues the rendering request, the result of determining whether a culling instruction is received, and the occupation of the user who views the rendering result.

[0180] Among them, the above-mentioned model information includes information for indicating whether the three-dimensional mesh model to be rendered is an inner-outer nested model. For example, if the three-dimensional mesh model to be rendered is an inner-outer nested model, it is determined that the three-dimensional mesh model to be rendered needs to be simplified.

[0181] E2. Determine whether the three-dimensional mesh model to be rendered needs to be simplified according to the current scene information or the model information.

[0182] Specifically, if the current scene information includes the current time, it is determined whether the current time is within a preset time range (i.e., the preset condition includes the preset time range). If so, it is determined that the three-dimensional mesh model to be rendered needs to be simplified, otherwise, it is determined that the three-dimensional mesh model to be rendered does not need to be simplified. If the current scene information includes the user who issues the rendering request, it is determined whether the user who issues the rendering request is a preset user (i.e., the preset condition includes the preset user). If so, it is determined that the three-dimensional mesh model to be rendered needs to be simplified, otherwise, it is determined that the three-dimensional mesh model to be rendered does not need to be simplified. If the current scene information includes a judgment result of whether a model simplification instruction is received, and the judgment result indicates that a model simplification instruction is received (i.e., the preset condition includes receiving a simplification instruction), it is determined that the three-dimensional mesh model to be rendered needs to be simplified, otherwise, it is determined that the three-dimensional mesh model to be rendered does not need to be simplified. If the current scene information includes the occupation of the user who views the rendering result, it is determined whether the occupation of the user who views the rendering result belongs to the preset occupation (that is, the preset condition includes the preset occupation). If so, it is determined that the 3D mesh model to be rendered needs to be simplified (for example, assuming that the 3D mesh models to be rendered are multiple building models of a park, each building model has a model structure of water and electricity pipelines inside the wall or a model structure of equipment inside the room. If the person who views the rendering result is the designer and constructor of the park, since the constructor does not pay attention to the internal details of each building model, but only pays attention to the surface details of each building model in the park, the interior of the multiple building models in the park can be eliminated - that is, the model is simplified. However, if the person who views the rendering result is the interior designer of the building model, the interior of the multiple building models in the park cannot be eliminated - that is, the model is not simplified). Otherwise, it is determined that the 3D mesh model to be rendered does not need to be simplified.

[0183] It should be pointed out that when the current scene information includes at least two pieces of information among "current time, user who issues the rendering request, judgment result of whether the culling instruction is received, and occupation of the user who views the rendering result", only one kind of information needs to meet the preset conditions, and no limitation is given here.

[0184] In the embodiment of the present application, since it is possible to determine whether the three-dimensional mesh model to be rendered needs to be simplified in a variety of ways, the flexibility of the determination method is improved.

[0185] Embodiment six:

[0186] Corresponding to the model rendering method described in each method embodiment above, Fig.10 A structural block diagram of a model rendering device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0187] refer to Fig.10 The model rendering device 10 comprises: a bounding box generation module 101, a three-dimensional mesh model determination module 102 to be retained, and a rendering module 103. Among them:

[0188] The bounding box generation module 101 is used to generate a bounding box of a three-dimensional mesh model to be rendered.

[0189] The module 102 for determining the three-dimensional mesh model to be retained is used to determine the collision relationship between the bounding boxes, and determine the three-dimensional mesh model to be retained according to the collision relationship.

[0190] The rendering module 103 is used to render the three-dimensional mesh model to be retained to obtain a rendered image corresponding to the three-dimensional mesh model to be rendered.

[0191] In the embodiment of the present application, since the bounding box is a regular object, it is more efficient and simpler to use it to replace the model itself for collision calculation than to directly use the model itself for collision calculation. At the same time, since the three-dimensional mesh model to be rendered is determined to be retained according to the collision relationship, only the three-dimensional mesh model to be retained needs to be rendered during rendering, thus simplifying the structure to be rendered, thereby increasing the rendering speed, shortening the user's waiting time, and improving the user's good experience.

[0192] In some embodiments, when determining the three-dimensional mesh model to be retained according to the collision relationship, the module 102 for determining the three-dimensional mesh model to be retained is specifically used to:

[0193] The internal structure of the three-dimensional mesh model to be rendered is eliminated according to the collision relationship to obtain the three-dimensional mesh model to be retained.

[0194] In some embodiments, the above-mentioned removing the internal structure in the above-mentioned three-dimensional mesh model to be rendered according to the above-mentioned collision relationship includes:

[0195] According to the collision relationship, the three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the collision relationship in the three-dimensional mesh model to be rendered is eliminated to obtain the three-dimensional mesh model to be retained.

[0196] In some embodiments, before the three-dimensional mesh model corresponding to the overlapping area of ​​the two bounding boxes corresponding to the collision relationship in the three-dimensional mesh model to be rendered is removed according to the collision relationship, the method further includes:

[0197] When the collision relationship is an intersection relationship, the ratio of the volume of the intersection portion to the volume of the bounding box with a smaller volume is calculated.

[0198] Correspondingly, the above-mentioned removing the three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the above-mentioned collision relationship in the above-mentioned three-dimensional mesh model to be rendered according to the above-mentioned collision relationship includes:

[0199] When the ratio value is greater than a preset ratio threshold, the three-dimensional mesh model corresponding to the overlapping area of ​​the two bounding boxes corresponding to the intersection relationship in the three-dimensional mesh model to be rendered is eliminated.

[0200] In some embodiments, the model rendering device 10 further includes:

[0201] The external structure elimination module of the intersection relationship is used to eliminate the target area of ​​the smaller bounding box in the two bounding boxes corresponding to the above-mentioned intersection relationship in the above-mentioned three-dimensional mesh model to be rendered when the above-mentioned ratio value is greater than the preset ratio threshold. The above-mentioned target area is the area in the above-mentioned smaller bounding box that does not belong to the above-mentioned overlapping area.

[0202] In some embodiments, the three-dimensional mesh model determination module 102 to be retained includes:

[0203] The untraversed bounding box selection unit is used to select an untraversed bounding box from the target bounding boxes and determine the collision relationship between the selected bounding box and the remaining bounding boxes, wherein when the untraversed bounding box is selected for the first time, the above-mentioned target bounding box is each generated bounding box, and when the untraversed bounding box is not selected for the first time, the above-mentioned target bounding box is the bounding box corresponding to the current three-dimensional mesh model that needs to be retained.

[0204] The smaller bounding box culling unit is used to cull the three-dimensional mesh model corresponding to the smaller bounding box of two bounding boxes whose collision relationship is a containment relationship after each traversal.

[0205] In some embodiments, the model rendering device 10 further includes:

[0206] A module for determining whether to retain bounding boxes with intersecting relationships is used to determine whether to determine the three-dimensional mesh model corresponding to the smaller bounding box as the three-dimensional mesh model to be retained, based on the proportional relationship between the volume of the intersecting part and the volume of the smaller bounding box, for each group of two bounding boxes with intersecting collision relationships after the collision relationships of the various bounding boxes in the target bounding box are determined.

[0207] In some embodiments, the model rendering device 10 provided in the embodiment of the present application further includes:

[0208] The volume calculation module is used to calculate the volume of each of the generated bounding boxes before selecting an untraversed bounding box from the target bounding box.

[0209] The volume sorting module is used to sort the above bounding boxes from large to small according to the size of the volume, wherein when the untraversed bounding boxes are selected for the first time, the sorted bounding boxes are used as the target bounding boxes.

[0210] Correspondingly, the untraversed bounding box selection unit is specifically used for:

[0211] Select an untraversed bounding box from the above target bounding boxes in order from front to back.

[0212] In some embodiments, the model rendering device provided by the embodiment of the present application further includes:

[0213] The model file content acquisition module is used to acquire the model file content of the three-dimensional model file before generating the bounding box of the three-dimensional mesh model to be rendered.

[0214] The data structure generation module is used to generate a data structure in a target format according to the content of the above model file.

[0215] The mesh model generation module is used to generate a mesh structure according to the above data structure to obtain the above three-dimensional mesh model to be rendered.

[0216] In some embodiments, the data structure of the target format includes vertex coordinates of the vertex and a vertex index field of the vertex, and the vertex index field includes: a connection relationship between the vertex and other vertices stored in a tree structure. When the mesh model generation module generates a mesh structure according to the data structure, it is specifically used to:

[0217] According to the connection relationship between the vertex stored in the tree structure in the vertex index field and other vertices, the vertex corresponding to the parent node and the vertex index field corresponding to the parent node are determined.

[0218] A mesh structure is generated according to the determined vertex coordinates corresponding to the above vertices and the determined vertex index fields.

[0219] In some embodiments, the bounding box generation module 101 includes:

[0220] The target vertex set determination unit is used to determine, for each vertex index field, vertices having a connection relationship according to the vertex index field to obtain a target vertex set.

[0221] The extreme value determination unit is used to determine, for each of the above target vertex sets, the maximum value and the minimum value corresponding to the above target vertex set on the three-dimensional coordinate axis according to the vertex coordinates of the vertices in the above target vertex set.

[0222] The bounding box generating unit is used to generate the bounding box of the above-mentioned three-dimensional mesh model to be rendered according to the maximum value and the minimum value corresponding to each of the above-mentioned target vertices concentrated on the three-dimensional coordinate axis.

[0223] In some embodiments, the model rendering device 10 provided in the embodiment of the present application further includes:

[0224] The model simplification judgment module is used to judge whether the three-dimensional mesh model to be rendered needs to be simplified before generating the bounding box of the three-dimensional mesh model to be rendered.

[0225] Correspondingly, the above-mentioned bounding box generation module 101 is specifically used for:

[0226] In the case that the three-dimensional mesh model to be rendered needs to be simplified, a bounding box of the three-dimensional mesh model to be rendered is generated.

[0227] In some embodiments, the model simplification judgment module includes:

[0228] The information acquisition unit is used to acquire the current scene information or the model information of the above-mentioned three-dimensional mesh model to be rendered.

[0229] The information judgment unit is used to judge whether the three-dimensional mesh model to be rendered needs to be simplified according to the current scene information or the model information.

[0230] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0231] Embodiment seven:

[0232] Fig.11 This is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. Fig.11 As shown, the terminal device 11 of this embodiment includes: at least one processor 110 ( Fig.11 Only one processor is shown in the figure), a memory 111, and a computer program 112 stored in the above-mentioned memory 111 and executable on the above-mentioned at least one processor 110, and when the above-mentioned processor 110 executes the above-mentioned computer program 112, the steps in any of the above-mentioned method embodiments are implemented.

[0233] The terminal device 11 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device 11 may include, but is not limited to, a processor 110 and a memory 111. Those skilled in the art will appreciate that Fig.11It is only an example of the terminal device 11 and does not constitute a limitation on the terminal device 11. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.

[0234] The processor 110 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0235] In some embodiments, the memory 111 may be an internal storage unit of the terminal device 11, such as a hard disk or memory of the terminal device 11. In other embodiments, the memory 111 may also be an external storage device of the terminal device 11, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 11. Further, the memory 111 may also include both an internal storage unit of the terminal device 11 and an external storage device. The memory 111 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 111 may also be used to temporarily store data that has been output or is to be output.

[0236] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0237] An embodiment of the present application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps of any of the above method embodiments when executing the computer program.

[0238] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0239] An embodiment of the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0240] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code can be in source code form, object code form, executable file or some intermediate form. The above-mentioned computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0241] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0242] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0243] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0244] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, 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 solution of this embodiment.

[0245] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A model rendering method, characterized in that: include: Generate a bounding box of the three-dimensional mesh model to be rendered; Determining a collision relationship between the bounding boxes, and determining a three-dimensional mesh model to be retained according to the collision relationship; The three-dimensional mesh model to be retained is rendered to obtain a rendered image corresponding to the three-dimensional mesh model to be rendered.

2. The model rendering method according to claim 1, characterized in that: The step of determining the three-dimensional mesh model to be retained according to the collision relationship includes: The internal structure in the three-dimensional mesh model to be rendered is eliminated according to the collision relationship to obtain the three-dimensional mesh model to be retained.

3. The model rendering method according to claim 2, characterized in that: The removing of the internal structure in the to-be-rendered three-dimensional mesh model according to the collision relationship comprises: The three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the collision relationship in the three-dimensional mesh model to be rendered is eliminated according to the collision relationship to obtain the three-dimensional mesh model to be retained.

4. The model rendering method according to claim 3, characterized in that: Before the three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the collision relationship in the three-dimensional mesh model to be rendered is eliminated according to the collision relationship, the method further includes: When the collision relationship is an intersection relationship, a ratio value between the volume of the intersection portion and the volume of the bounding box with a smaller volume is calculated; The step of eliminating the three-dimensional mesh model corresponding to the overlapping area of ​​two bounding boxes corresponding to the collision relationship in the three-dimensional mesh model to be rendered according to the collision relationship includes: When the ratio value is greater than a preset ratio threshold, the three-dimensional mesh model corresponding to the overlapping area in the two bounding boxes corresponding to the intersection relationship in the three-dimensional mesh model to be rendered is discarded.

5. The model rendering method according to claim 4, characterized in that: The model rendering method further includes: When the ratio value is greater than a preset ratio threshold, the target area of ​​the smaller bounding box in the two bounding boxes corresponding to the intersection relationship in the three-dimensional mesh model to be rendered is eliminated, and the target area is the area of ​​the smaller bounding box that does not belong to the overlapping area.

6. The model rendering method according to claim 1, characterized in that: The determining the collision relationship between the bounding boxes and determining the three-dimensional mesh model to be retained according to the collision relationship includes: Select an untraversed bounding box from the target bounding boxes, and determine the collision relationship between the selected bounding box and the remaining bounding boxes, wherein when the untraversed bounding box is selected for the first time, the target bounding box is each generated bounding box, and when the untraversed bounding box is not selected for the first time, the target bounding box is the bounding box corresponding to the current three-dimensional mesh model to be retained; After each traversal, the three-dimensional mesh model corresponding to the smaller bounding box of the two bounding boxes whose collision relationship is a containment relationship is eliminated.

7. The model rendering method according to claim 6, characterized in that: The model rendering method further includes: After the collision relationships among all the bounding boxes in the target bounding box are determined, for each group of two bounding boxes whose collision relationships are intersecting relationships, determine whether to determine the three-dimensional mesh model corresponding to the bounding box with the smaller volume as the three-dimensional mesh model to be retained based on the proportional relationship between the volume of the intersecting part and the volume of the bounding box with the smaller volume.

8. The model rendering method according to claim 6, characterized in that: Before selecting an untraversed bounding box from the target bounding box, the method further includes: Calculate the volume of each of the generated bounding boxes; According to the size of the volume, the bounding boxes are sorted from large to small, wherein when the untraversed bounding boxes are selected for the first time, the sorted bounding boxes are used as the target bounding boxes; The step of selecting an untraversed bounding box from the target bounding box includes: An untraversed bounding box is selected from the target bounding boxes in order from front to back.

9. The model rendering method according to any one of claims 1 to 8, characterized in that: Before generating the bounding box of the three-dimensional mesh model to be rendered, the method further includes: Get the model file content of the 3D model file; Generate a data structure in a target format according to the content of the model file; A mesh structure is generated according to the data structure to obtain the three-dimensional mesh model to be rendered.

10. The model rendering method according to claim 9, characterized in that: The data structure of the target format includes vertex coordinates of the vertex and a vertex index field of the vertex, wherein the vertex index field includes: a connection relationship between the vertex and other vertices stored in a tree structure, and generating a mesh structure according to the data structure includes: Determine the vertex corresponding to the parent node and the vertex index field corresponding to the parent node according to the connection relationship between the vertex stored in the tree structure in the vertex index field and other vertices; A mesh structure is generated according to the determined vertex coordinates corresponding to the vertex and the determined vertex index field.

11. The model rendering method according to claim 10, characterized in that: The generating a bounding box of the three-dimensional mesh model to be rendered comprises: For each vertex index field, determine the vertices with a connection relationship according to the vertex index field to obtain a target vertex set; For each of the target vertex sets, determining the maximum value and the minimum value corresponding to the target vertex set on the three-dimensional coordinate axis according to the vertex coordinates of the vertices in the target vertex set; The bounding box of the three-dimensional mesh model to be rendered is generated according to the maximum value and the minimum value corresponding to each of the target vertices concentrated on the three-dimensional coordinate axis.

12. The model rendering method according to any one of claims 1 to 11, characterized in that: Before generating the bounding box of the three-dimensional mesh model to be rendered, the method further includes: Determining whether the three-dimensional mesh model to be rendered needs to be simplified; The generating of the bounding box of the three-dimensional mesh model to be rendered comprises: In the case where the three-dimensional mesh model to be rendered needs to be simplified, a bounding box of the three-dimensional mesh model to be rendered is generated.

13. The model rendering method according to claim 12, characterized in that: The determining whether the three-dimensional mesh model to be rendered needs to be simplified includes: Acquire current scene information or model information of the three-dimensional mesh model to be rendered; It is determined whether the three-dimensional mesh model to be rendered needs to be simplified according to the current scene information or the model information.

14. A model rendering device, characterized in that: include: A bounding box generation module, used to generate a bounding box of a three-dimensional mesh model to be rendered; A module for determining a three-dimensional mesh model to be retained, used to determine a collision relationship between the bounding boxes, and determine a three-dimensional mesh model to be retained according to the collision relationship; The rendering module is used to render the three-dimensional mesh model to be retained to obtain a rendered image corresponding to the three-dimensional mesh model to be rendered.

15. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 13 is implemented.

16. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 13 is implemented.

Citation Information

Cited By

  • Terrain rendering method and device, computer equipment, readable storage medium and program product

    CN119418016A

  • Rendering system, chip, equipment and rendering method applied to rendering system

    CN121708181A