Method of building a model and related apparatus

CN115984506BActive Publication Date: 2026-10-16HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111205441.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-15
Publication Date
2026-10-16
Estimated Expiration
2041-10-15

AI Technical Summary

Technical Problem

[0004]然而,在一些场景中,三维物体的模型并不完全用于渲染出供消费者或者观察者观看的图像

Benefits of technology

[0010] Furthermore, the above technical solutions can improve the performance of some applications. For example, a protrusion of building A might obscure building B. When performing occlusion culling using the original model of building A, building B would be judged as being obscured by building A. In this case, to reduce computational load, the model of building B would not be rendered. However, when the viewing angle changes, building B might become fully or partially visible, but since its model hasn't been rendered, building B wouldn't appear in the image, significantly impacting the user experience. The proxy model in the above technical solution removes the vertices of the protrusion from the original model. Thus, when performing occlusion culling using the proxy model, building B would be judged as not being obscured. Therefore, the model of building B would be rendered, thus avoiding the aforementioned problem.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115984506B_ABST
    Figure CN115984506B_ABST
Patent Text Reader

Abstract

This application provides a method and related apparatus for building a model. The method includes: obtaining the projected coordinates of N vertices of an original model projected onto a target plane; determining M vertices from the N vertices, where M is a positive integer greater than or equal to 3 and less than or equal to N; and building a proxy model corresponding to the original model based on the projected coordinates of the M vertices and the height information of the original model. Using the above technical solution, a proxy model of the original model can be built. Compared with the original model, the proxy model retains the detailed information of the original model but includes fewer vertices, thus having a simpler structure. Therefore, in scenarios where rendering images using a model is not required (e.g., collision detection, occlusion culling, shadow rendering), a simpler proxy model can be used to replace the original model. This reduces computational load, improves application efficiency, and enhances user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer graphics, and more specifically, to methods and related apparatus for building models. Background Technology

[0002] Rendering refers to the process of generating an image from a model using software. A model is a rigorously defined description of a three-dimensional object using a language or data structure, including information such as geometry, viewpoint, texture, lighting, and shadows. An image is a digital image or a bitmap image. The rendering process involves adding bitmap or procedural textures, lighting, bump mapping, and positioning relative to other objects to the model, resulting in the complete image that the consumer or observer can see.

[0003] To render a realistic 3D object, the model needs a large number of vertices and triangles. Figure 1 For example, if you want to render something like... Figure 1 The building shown would require 18,709 vertices and 11,748 triangles.

[0004] However, in some scenarios, the model of a 3D object is not solely used to render images for consumers or observers. Using a separate model for image generation in these scenarios would increase the hardware burden. Therefore, simplifying 3D object models to suit different application scenarios is a pressing issue. Summary of the Invention

[0005] This application provides a method and related apparatus for building a model, which can establish a proxy model to replace the original model, facilitating subsequent applications.

[0006] In a first aspect, embodiments of this application provide a method for establishing a model, comprising: obtaining N coordinates, wherein the N coordinates are the projection coordinates of the N vertices of the original model onto a target plane, and N is a positive integer greater than or equal to 3; determining M vertices from the N vertices based on the N coordinates, wherein M is a positive integer greater than or equal to 3 and less than or equal to N; and establishing a proxy model corresponding to the original model based on the projection coordinates of the M vertices and the height information of the original model.

[0007] The above technical solution can be used to create a proxy model for the original model. Compared to the original model, the proxy model retains the detailed information of the original model but includes fewer vertices, resulting in a simpler structure. Therefore, in scenarios where rendering images using the model is not required (such as collision detection, occlusion culling, and shadow rendering), the simpler proxy model can be used to replace the original model. This reduces computational load, improves application efficiency, and enhances the user experience.

[0008] In conjunction with the first aspect, in one possible implementation of the first aspect, obtaining the N coordinates includes: determining a plurality of candidate vertices based on the projection coordinates of the vertices of the original model projected onto the target plane, wherein the projection coordinates of each of the plurality of candidate vertices projected onto the target plane are located within a reference region, the reference region being the region in the original model where vertices projected onto the target plane at a preset ratio; determining the N vertices from the plurality of candidate vertices; and determining the projection coordinates of the N vertices projected onto the target plane.

[0009] Vertices located outside the reference region are usually protruding parts of an object. Removing these vertices has little impact on the functionality of the proxy model, but can result in a proxy model with a simpler structure.

[0010] Furthermore, the above technical solutions can improve the performance of some applications. For example, a protrusion of building A might obscure building B. When performing occlusion culling using the original model of building A, building B would be judged as being obscured by building A. In this case, to reduce computational load, the model of building B would not be rendered. However, when the viewing angle changes, building B might become fully or partially visible, but since its model hasn't been rendered, building B wouldn't appear in the image, significantly impacting the user experience. The proxy model in the above technical solution removes the vertices of the protrusion from the original model. Thus, when performing occlusion culling using the proxy model, building B would be judged as not being obscured. Therefore, the model of building B would be rendered, thus avoiding the aforementioned problem.

[0011] In conjunction with the first aspect, in one possible implementation of the first aspect, determining the N vertices from the plurality of candidate vertices includes: determining N groups of candidate vertices based on the projected coordinates of each candidate vertex in the plurality of candidate vertices projected onto the target plane, wherein each group of candidate vertices in the N groups includes at least one vertex, and any two candidate vertices belonging to the same group have the same projected coordinates on the target plane, and any two candidate vertices belonging to different groups have different projected coordinates on the target plane; determining the N vertices, wherein the N vertices belong to the N groups of candidate vertices respectively.

[0012] For multiple vertices with the same projected coordinates, the above technical solution retains only one vertex, which can further reduce the number of vertices included in the proxy model.

[0013] In conjunction with the first aspect, in one possible implementation of the first aspect, the N vertices are the vertices with the largest coordinate values ​​in the reference direction among the N groups of candidate vertices, and the reference direction is the direction perpendicular to the target plane; the height information of the original model is the coordinate values ​​of the M vertices in the reference direction.

[0014] In conjunction with the first aspect, in one possible implementation of the first aspect, the height information of the original model is the height information of the bounding box, and all vertices of the original model are located in the bounding box.

[0015] In conjunction with the first aspect, in one possible implementation of the first aspect, determining M vertices from the N vertices based on the N coordinates includes: traversing the N vertices based on the N coordinates, deleting abnormal vertices from the N vertices to obtain the M vertices, wherein the angle between the first reference line and the second reference line is greater than a preset angle, the first reference line is the line connecting the abnormal vertex and the first adjacent point, the second reference line is the line connecting the abnormal vertex and the second adjacent point, and the first adjacent point and the second adjacent point are two vertices located on both sides of the abnormal vertex and adjacent to the abnormal vertex among the N vertices.

[0016] The above technical solution can further reduce the number of vertices in the proxy model. Furthermore, by selecting an appropriate preset angle, the number of abnormal vertices to be deleted and the similarity between the proxy model and the original model can be controlled. For example, a smaller preset angle results in more abnormal vertices being deleted, reducing the number of vertices in the proxy model, but also decreasing the similarity between the proxy model and the original model; a larger preset angle results in fewer vertices being deleted, increasing the number of vertices in the proxy model, but also increasing the similarity between the proxy model and the original model. The higher the similarity between the proxy model and the original model, the closer the structure of the proxy model is to the original model; conversely, the lower the similarity, the greater the difference between the proxy model and the original model. The purpose of generating a proxy model is to replace the structurally complex original model. The closer the structure of the proxy model is to the original model, the worse the effect on saving hardware resources; conversely, if the proxy model is simpler in structure than the original model, the effect on decompressing hardware resources is better. However, if the structural difference between the proxy model and the original model is too large, the details of the original model cannot be preserved, which is detrimental to subsequent applications. Therefore, by selecting a suitable preset angle, the details of the original model can be preserved while also saving hardware resources.

[0017] In conjunction with the first aspect, in one possible implementation, establishing a proxy model corresponding to the original model based on the projected coordinates of the M vertices and the height information of the original model includes: determining the coordinates of the M top vertices on the top surface of the proxy model and the coordinates of the M bottom vertices on the bottom surface of the proxy model based on the projected coordinates of the M vertices and the height information of the original model; determining a vertex index based on the coordinates of the M top vertices and the coordinates of the M bottom vertices, the vertex index being used to record the connection order of each vertex in the proxy model, the proxy model including the coordinates of the M top vertices, the coordinates of the M bottom vertices, and the vertex index.

[0018] The vertex index can include a top face index, a bottom face index, and a side face index. The top face index is used to record the connection order of vertices located on the top face, the bottom face index is used to record the connection order of vertices located on the bottom face, and the side face index is used to record the connection order of vertices on the side faces.

[0019] The top face index can be determined based on the coordinates of the M top face vertices; the bottom face index can be determined based on the coordinates of the M bottom face vertices; and the side face index can be determined based on the coordinates of the M top face vertices and the M bottom face vertices.

[0020] Secondly, embodiments of this application provide a computer device that includes units for implementing the first aspect or any possible implementation of the first aspect.

[0021] Thirdly, embodiments of this application provide a computer device including a processor for coupling with a memory to read and execute instructions and / or program code in the memory to perform the first aspect or any possible implementation thereof.

[0022] Fourthly, embodiments of this application provide a chip system including logic circuitry for coupling with an input / output interface to transmit data via the input / output interface, thereby executing the first aspect or any possible implementation thereof.

[0023] Fifthly, embodiments of this application provide a computer-readable storage medium storing program code that, when executed on a computer, causes the computer to perform the first aspect or any possible implementation thereof.

[0024] In a sixth aspect, embodiments of this application provide a computer program product comprising: computer program code, which, when run on a computer, causes the computer to perform as in the first aspect or any possible implementation thereof. Attached Figure Description

[0025] Figure 1 The building shown

[0026] Figure 2 This is a schematic diagram of occlusion culling.

[0027] Figure 3 This is a schematic flowchart of a method for building a model according to an embodiment of this application.

[0028] Figure 4 This is a schematic diagram of the vertices of the original model projected onto the target plane.

[0029] Figure 5 A diagram illustrating the process of deleting abnormal vertices.

[0030] Figure 6 This is a schematic diagram of the proxy model.

[0031] Figure 7 This is a schematic flowchart illustrating an application scenario of the model building method provided in the embodiments of this application.

[0032] Figure 8 It is based on Figure 3 The method shown generates the corresponding Figure 1 The proxy model of the original model shown.

[0033] Figure 9 This is a schematic diagram of a computer device provided according to an embodiment of this application. Detailed Implementation

[0034] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0035] To help those skilled in the art better understand the technical solution of this application, some concepts involved in this application will be introduced first.

[0036] 1. Bounding boxes

[0037] Bounding box algorithms are used to find the optimal bounding space for a discrete set of points. The basic idea is to approximate a complex geometric object using a slightly larger, simpler geometric shape (called a bounding box). Common bounding box algorithms include Axis Aligned Bounding Box (AABB), Bounding Sphere, and Oriented Bounding Box (OBB).

[0038] 2. Mesh

[0039] A mesh is a series of triangular facets, consisting of vertex coordinate data, index coordinate data, normal data, and texture coordinates (also known as UV coordinates). The vertex coordinate data stores the coordinates of all the spatial points required by the model, typically in three dimensions. Then, an index is generated for each spatial point, and every three indices form a group to constitute the index coordinates. This is equivalent to selecting three spatial points to form a triangle, and the index coordinate data describes the composition of all the triangular facets in the model. The normal data specifies the normal direction of each vertex, and the UV coordinates specify the location on the mesh where the texture is "attached."

[0040] 3. Model

[0041] Unless otherwise specified, the term "model" in this document refers to a 3D model. This 3D model can be applied to animation, games, and other scenarios. The model can be divided into two parts: a mesh and textures. The mesh is composed of a series of triangular facets, which is equivalent to the "skeleton" of the model. The textures include the model's built-in texture images and lightmaps, which are equivalent to the model's "skin."

[0042] Furthermore, unless otherwise specified, the scenes, objects, buildings, etc. mentioned in the embodiments of this application are all three-dimensional.

[0043] 4. Shader

[0044] Shaders are small programs that run on the GPU. These programs run for a specific part of the graphics rendering pipeline. Essentially, a shader is simply a program that transforms input into output. Different shaders are used in different processing parts of the rendering pipeline.

[0045] 5. Occlusion removal

[0046] Occlusion culling refers to removing the models of objects in a scene that are obscured by occluders. This allows the scene to be rendered only with models of objects visible to the observer. This reduces data transfer between the central processing unit (CPU) and the graphics processing unit (GPU), as well as computation in the vertex and fragment shader stages, ultimately reducing the number of visible objects at any given time. This optimizes performance and reduces GPU load.

[0047] Figure 2 This is a diagram illustrating occlusion culling. For example... Figure 2The field of view of the camera 201 shown includes five buildings: building 211, building 212, building 213, building 214, and building 215. If the observer is located at the position of camera 201, the observer cannot see the occluded buildings 215 and 213. Therefore, in rendering... Figure 2 When the scene is shown, only the buildings that can be seen by the observer can be rendered, namely building 211, building 212 and building 214.

[0048] 6. Collision Detection

[0049] Collision detection refers to determining whether objects intersect (or contain or overlap), calculating focal points, and predicting the moment of intersection.

[0050] Taking 3D games as an example, collision detection can be used to enable smooth movement of characters in the scene. When encountering steps within a certain height, the character can automatically climb them, while steps that are too high will block the character. When encountering slopes with a gentle gradient, the character can climb them, while slopes that are too steep will block the character.

[0051] 7. Collider

[0052] Colliders can be used to define the shape of objects to be collided with, facilitating collision detection. Common colliders include box colliders, sphere colliders, capsule colliders, conformal colliders, mesh colliders, and static colliders.

[0053] 8. Shadow

[0054] To better simulate realistic scenes, object shadows are drawn during scene rendering. Object shadows are achieved using volumetric shadowing. Volumetric shadowing is a geometry-based technique that requires the object's outline under light from a specific direction to create a closed volume. The shadow portion of the object in the scene is then determined by the projection of light.

[0055] In applications such as occlusion culling, collision detection, or shadow generation, the object's model plays a supporting role, not for rendering. Therefore, in these applications, it is not necessary to use a model to generate the image for the observer to view. For clarity, the model used to generate the image for the observer to view will be referred to as the original model, while the model that plays a supporting role in applications such as occlusion culling, collision detection, or shadow generation will be referred to as the surrogate model.

[0056] This application provides a method for building a model, which can generate a corresponding proxy model based on the original model of an object. Compared with the original model, the proxy model has a simpler structure, but can still retain the detailed information of the original model. Below, in conjunction with... Figure 1and Figure 3 The embodiments of this application will be described.

[0057] Figure 3 This is a schematic flowchart of a method for building a model according to an embodiment of this application. Figure 3 The method shown can be implemented by a computer device or a component (e.g., a chip, circuit, etc.) within a computer device. The computer device referred to in the embodiments of this application can be a desktop computer, laptop computer, tablet computer, server, mobile phone, game console (e.g., a PlayStation (PS), a Nintendo Switch (NS), etc.), etc. For ease of description, the following assumptions are made. Figure 3 The original model in is as follows Figure 1 The model of the building shown.

[0058] 301, Determine the projection coordinates of the vertices in the original model onto the target plane.

[0059] The target plane can be any plane. However, for ease of calculation, it is usually set as the bottom or top surface of the object.

[0060] There are three ways to obtain the projected coordinates of a vertex on the target plane:

[0061] Option 1: Determine the projected coordinates of each vertex on the target plane.

[0062] In this case, the projected coordinates determined in step 301 can be the projected coordinates of all vertices in the original model on the target plane. Assume the original model is used to render a... Figure 1 Given the building model shown, in this case, it is necessary to obtain the projection coordinates of 18709 vertices onto the target plane.

[0063] Option 2: Only the projected coordinates of one vertex in each group on the target plane are retained.

[0064] In the original model, some vertices have the same coordinates on the target plane, but their coordinates differ in the direction perpendicular to the target plane. For example... Figure 1 As shown, assuming the target plane is the base of a building, some vertices have the same coordinates in the xy-plane but different coordinates in the z-axis direction. In this case, vertices can be grouped according to their coordinates, with each group containing one or more vertices. If a group contains multiple vertices, then any two vertices in that group have the same coordinates in the xy-plane but different coordinates in the z-axis direction. Any two vertices belonging to different groups have different coordinates in the xy-plane. Thus, only the projected coordinates of one vertex from each group on the target plane need to be determined. Furthermore... Figure 1For example, 18,709 vertices can be divided into 2,655 groups of vertices. In Scheme 2, only 2,655 projected coordinates need to be determined. This greatly simplifies the computational resources required for subsequent steps.

[0065] Option 3: Determine the projected coordinates of the vertices within the reference region.

[0066] A reference region is determined based on the projected coordinates of all vertices of the original model onto the target plane. 95% of the vertices of the original model have their projected coordinates within this reference region. In this case, only the projected coordinates of vertices whose projected coordinates fall within the reference region can be obtained. The method for obtaining the projected coordinates of vertices within the reference region can be the same as in Scheme 1 above, obtaining the projected coordinates of each vertex; or it can be the same as in Scheme 2 above, where only the projected coordinates of one vertex from a group of vertices with the same projected coordinates are retained.

[0067] It is understood that the 95% mentioned above is merely an example of a preset percentage. This preset percentage can also be other values; for example, it can typically be set to greater than or equal to 90% and less than or equal to 98%.

[0068] Vertices located outside the reference region are usually protruding parts of an object, and deleting these vertices has little impact on the functionality of the proxy model.

[0069] For ease of description, it is assumed that the projected coordinates of N vertices are obtained in step 301, where N is a positive integer greater than or equal to 3.

[0070] 302. Based on the projected coordinates of the N vertices, determine M vertices from the N vertices, where M is a positive integer greater than or equal to 3 and less than or equal to N.

[0071] In some embodiments, the M vertices can be implemented through the following steps:

[0072] Step 1: Determine the target vertex and the two vertices adjacent to the target vertex (which can be referred to as the first adjacent point and the second adjacent point, respectively). The target vertex can be any one of the N vertices.

[0073] Step 2: Determine the first reference line and the second reference line, wherein the first reference line is the line connecting the first adjacent point and the target vertex, and the second reference line is the line connecting the target vertex and the second adjacent point;

[0074] Step 3: Determine whether the angle between the first reference line and the second reference line is greater than a preset angle. If the angle is greater than the preset angle, the target vertex can be considered an abnormal vertex and can be deleted. If the angle is less than or equal to the preset angle, the target vertex can be retained.

[0075] Step 4: Determine a neighboring point (e.g., the first neighboring point) of the target vertex as a new target vertex, and then repeat steps 1 to 3 until all N vertices have been traversed. The final target vertices are the M vertices.

[0076] The preset angle can be set to greater than 90 degrees, and is usually set to greater than or equal to 140 degrees and less than or equal to 150 degrees.

[0077] Figure 4 This is a schematic diagram of the vertices of the original model projected onto the target plane. The method for deleting abnormal vertices is explained using the six vertices in the upper left corner as an example. Figure 5 Delete such as Figure 4 This diagram illustrates the process of identifying an abnormal vertex among the six vertices in the upper left corner. Assume the preset angle is 145 degrees.

[0078] For ease of description, the six vertices can be named D1, D2, D3, D4, D5, and D6. Let L12 represent the line connecting D1 and D2, L61 represent the line connecting D6 and D1, L23 represent the line connecting D2 and D3, and so on.

[0079] First, assume D1 is the target vertex. Then, the two vertices adjacent to D1 are D2 and D6. Determine the angle between L61 and L12 and compare it with a preset angle. Clearly, the angle between L61 and L12 is less than 145 degrees. In this case, D1 can be retained.

[0080] The order of vertices can be determined using the gift wrapping algorithm or other algorithms used to solve the convex hull problem. For example, in some embodiments, suppose a ray starting from D1 scans counterclockwise from the 12 o'clock direction. The first vertex that overlaps with the ray during the scan is vertex D2, which is adjacent to D1. Continuing the scan, the second vertex that overlaps with the ray is vertex D3, which is adjacent to D2, and so on, until the order of all vertices is determined.

[0081] Continuing with D2 as the target vertex, the two vertices adjacent to D2 are D1 and D3. Determine the angle between L12 and L23 and compare it with a preset angle. Obviously, the angle between L12 and L23 is greater than 145 degrees, so D2 can be considered an abnormal vertex and is deleted.

[0082] Continuing with D3 as the target vertex, the two vertices adjacent to D3 are D1 and D4. Determine the angle between L13 and L34 and compare it with a preset angle. Clearly, the angle between L13 and L34 is less than 145 degrees. In this case, D3 can be retained.

[0083] Continuing with D4 as the target vertex, the two vertices adjacent to D4 are D3 and D5. Determine the angle between L34 and L45 and compare it with a preset angle. Clearly, the angle between L34 and L45 is less than 145 degrees. In this case, D4 ​​can be retained.

[0084] Continuing with D5 as the target vertex, the two vertices adjacent to D5 are D4 and D6. Determine the angle between L45 and L56 and compare it with a preset angle. Clearly, the angle between L45 and L56 is greater than 145 degrees, so D5 can be considered an abnormal vertex and is deleted.

[0085] Continuing with D6 as the target vertex, the two vertices adjacent to D6 are D4 and D1. Determine the angle between L46 and L61 and compare it with a preset angle. Clearly, the angle between L46 and L61 is less than 145 degrees. In this case, D6 can be retained.

[0086] By following the steps above, two abnormal vertices, D2 and D5, are deleted from D1 to D6, resulting in four vertices: D1, D3, D4, and D6.

[0087] 303. Based on the projected coordinates of the M vertices and the height information of the original model, establish a proxy model corresponding to the original model.

[0088] The height information of the original model is the height information perpendicular to the target plane. The height information can include the maximum height and the minimum height.

[0089] In some embodiments, the height information of the original model can be the height value of the bounding box of the original model. Before determining the projected coordinates of the vertices of the original model onto the target plane, a bounding box can be created, all vertices of the original model can be traversed, and the bounding box can be appropriately scaled so that it contains all vertices of the original model. At this point, the height information of the bounding box can be recorded. The height information of the bounding box can be used as the height information of the original model. The maximum height of the bounding box is the maximum height of the original model, and the minimum height of the bounding box is the minimum height of the original model.

[0090] In other embodiments, the maximum height of the original model's height information can be the height values ​​of the M vertices. As described above, in step 301, in schemes 2 and 3, only the projected coordinates of one vertex in each group of vertices on the target plane are retained. In this case, the height value of the vertex with the highest height value in each group of vertices can also be determined and saved. Thus, each of the N vertices obtained through step 301 also has a corresponding height value. Since the M vertices in step 302 are selected from these N vertices, each of these M vertices also has a corresponding height value. The minimum height in the height information of the original model can be considered as 0.

[0091] Based on the projected coordinates of the M vertices and the height information of the original model, the 3D coordinates of each of the M vertices can be determined. Based on the maximum height from the projected coordinates of the M vertices and the height information of the original model, the 3D coordinates of the M vertices located on the top surface of the proxy model can be determined. The projected coordinates of the 3D coordinates of the M vertices located on the top surface of the proxy model are the projected coordinates of the M vertices themselves, and the height value of the 3D coordinates of these M vertices is the maximum height from the height information. Similarly, based on the projected coordinates of the M vertices and the minimum height from the height information of the original model, the 3D coordinates of the M vertices located on the bottom surface of the proxy model can be determined. The projected coordinates of the 3D coordinates of the M vertices located on the bottom surface of the proxy model are the projected coordinates of the M vertices themselves, and the height value of the 3D coordinates of these M vertices is the minimum height from the height information.

[0092] The 3D coordinates of each vertex obtained from the height information need to be connected in the correct order to form the correct plane. Therefore, vertex indices also need to be determined. Vertex indices are used to record the connection order of each vertex. Vertex indices can include top face index, bottom face index, and side face index. The top face index records the connection order of vertices located on the top face, the bottom face index records the connection order of vertices located on the bottom face, and the side face index records the connection order of vertices on the sides. Based on the vertex coordinates, top face index, bottom face index, and side face index, a proxy model corresponding to the original model can be constructed.

[0093] by Figure 6 For example, Figure 6 In (a), D1, D2, D3 and D4 are the four vertices on the top surface determined by the projection coordinates and height information, and D5, D6, D7 and D8 are the four vertices on the bottom surface determined by the projection coordinates and height information. Figure 6 (b) The correct connection order of the eight vertices. Figure 6 (c) in the diagram illustrates an incorrect connection on the side.

[0094] The top face index can be determined using the gift wrapping algorithm or other algorithms used to solve the convex hull problem. Taking the four vertices of the top face as an example, suppose a ray starting from D1 scans counter-clockwise from the 12 o'clock direction. The first vertex that overlaps with this ray during the scan is vertex D2, which is adjacent to D1. Continuing the scan, the second vertex that overlaps with the ray is vertex D3, which is adjacent to D2. Continuing the scan, we obtain the next vertex D4. This determines the connection order from D1 to D4, i.e., the top face index. The bottom face index is determined in the same way as the top face index, and for simplicity, it will not be elaborated here.

[0095] The following describes some methods for determining the side lateral index. Two vertices located on the top and bottom faces with the same projected coordinates differ only in their height coordinates in 3D coordinates. Therefore, these two vertices are related. After determining the two related vertices, the next vertex can be found along the simplified direction of one of the vertices (e.g., the direction downwards from that vertex). First, construct the first triangle. The second triangle is constructed using the vertically related vertices (one of which is the vertex found in the simplified direction of the previous step) and the hypotenuse of the first triangle. This forms a side lateral face with the two triangles. This yields the correct plane. The vertex indices of the triangles (vertices order) constitute the final side lateral index (the order of the side lateral vertices).

[0096] like Figure 6 As shown in (d), vertices D1 and D5 have the same projected coordinates, therefore, vertices D1 and D5 are a pair of related vertices. The simplified direction of vertex D5 is the direction from D5 to D6. Therefore, the next vertex can be determined as vertex D6. In this way, a triangle formed by vertices D1, D5, and D6 (hereinafter referred to as triangle 1) can be determined. Vertex D6 and vertex D2 are a pair of related vertices (i.e., vertices D6 and D2 have the same projected coordinates). Using vertices D6 and D2, as well as the hypotenuse in triangle 1 (i.e., the edge from D1 to D6), another triangle (hereinafter referred to as triangle 2) can be constructed. In this way, the order of vertices D1, D2, D5, and D6 is determined. Similarly, the order of the remaining vertices on the sides can be determined, obtaining the side index.

[0097] After determining the proxy model, it can be scaled according to the specific application. For example, to facilitate collision detection and reduce the occurrence of incorrect collision detection judgments, the proxy model can be appropriately enlarged. Conversely, in occlusion culling, the proxy model can be appropriately shrunk, which can reduce the occurrence of models that need to be rendered being judged as models that do not need to be rendered.

[0098] In some embodiments, the proxy model can also be overlaid with the corresponding original model. This allows adjustments to the proxy model's scaling, height, and other parameters based on the overlay result.

[0099] Figure 7 This is a schematic flowchart illustrating an application scenario of the model building method provided in the embodiments of this application.

[0100] 701, Obtain the raw model data of the objects (e.g., occluders) in the scene whose proxy models need to be determined.

[0101] 702, Based on the data of the object's original model, using, for example Figure 3 The method shown establishes a proxy model corresponding to the original model.

[0102] 703, Generate a preview of the proxy model in this scenario.

[0103] 704, determine whether the preview result of the proxy model meets expectations.

[0104] If the expectation is not met, proceed to step 705; if the expectation is met, proceed to step 706.

[0105] 705. Adjust the size or height of the proxy model. After adjusting the size or height of the proxy model, you can continue to determine whether the preview result of the proxy model meets expectations. If it still does not meet expectations, you can continue to adjust the proxy model until it does.

[0106] In some embodiments, in addition to adjusting the size or height of the proxy model in step 705, some thresholds used in the proxy model generation process can also be adjusted to regenerate the proxy model. For example, the preset ratio used in step 301 to determine which vertices to acquire can be adjusted. Similarly, the preset angle used in step 302 to determine abnormal vertices can be adjusted.

[0107] 706, Baking generates persistent data for this proxy model, making it easier to call at runtime.

[0108] Figure 8 It is based on Figure 3 The method shown generates the corresponding Figure 1 The proxy model shown is the original model. Figure 8 The proxy model shown has only 96 vertices and 60 triangles. Compared to the original model, this proxy model reduces the number of vertices and triangles by approximately 99.5%. Therefore, the proxy model obtained using the technical solution provided in this application significantly reduces the number of vertices and triangles, while maintaining a high degree of fit with the original model. Thus, using the proxy model provided by this application can reduce the computational load of applications such as occlusion culling and collision detection, improve application efficiency, and enhance the user experience.

[0109] Taking occlusion culling as an example, we conducted tests in a real game scenario, and the results are shown in Table 1.

[0110] Table 1

[0111]

[0112] As shown in Table 1, with the increase of the rejection rate, this solution can effectively improve the frame rate during game operation and enhance the game experience while ensuring conservative rejection.

[0113] Figure 9 This is a schematic diagram of a computer device provided according to an embodiment of this application. Figure 9 The computer device 900 shown includes an acquisition unit 901, a processing unit 902, and a modeling unit 903.

[0114] The acquisition unit 901 is used to acquire N coordinates, wherein the N coordinates are the projection coordinates of the N vertices of the original model onto the target plane, and N is a positive integer greater than or equal to 3;

[0115] Processing unit 902 is used to determine M vertices from the N vertices based on the N coordinates, where M is a positive integer greater than or equal to 3 and less than or equal to N;

[0116] Modeling unit 903 is used to establish a replacement model corresponding to the original model based on the projected coordinates of the M vertices and the height information of the original model.

[0117] The specific functions and beneficial effects of the acquisition unit 901, processing unit 902 and modeling unit 903 can be referred to the description of some embodiments of the above method, and will not be repeated here for the sake of brevity.

[0118] It should be understood that Figure 9 The computer device described above, including the acquisition unit, processing unit, and modeling unit, is optional and not a limitation. Figure 9 The structure shown.

[0119] When the computer device 900 is a chip, the chip includes a transmitting unit and a processing unit. The transmitting unit can be an input / output circuit or a communication interface; the processing unit is a processor, microprocessor, or integrated circuit integrated on the chip.

[0120] This application also provides a computer device including a processor and a memory. The processor is configured to be coupled to the memory, read and execute instructions and / or program code in the memory to perform the steps described in the method embodiments above.

[0121] It should be understood that the aforementioned processor can be a chip. For example, the processor can be a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC), a system-on-chip (SoC), a central processing unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD), other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or other integrated chips.

[0122] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here.

[0123] It should be noted that the processor in the embodiments of this application can be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method embodiments can be completed by the integrated logic circuitry in the processor's hardware or by instructions in software form. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0124] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0125] According to the method provided in the embodiments of this application, this application also provides a computer program product, which includes computer program code, which, when run on a computer, causes the computer to perform the steps in the above embodiments.

[0126] According to the method provided in the embodiments of this application, this application also provides a computer-readable medium storing program code, which, when run on a computer, causes the computer to perform the steps in the above embodiments.

[0127] Those skilled in the art will recognize that the units and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0128] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0129] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0130] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0131] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0132] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0133] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for establishing a model, characterized in that, include: Obtain N coordinates, where N coordinates are the projection coordinates of the N vertices of the original model onto the target plane, and N is a positive integer greater than or equal to 3; Based on the N coordinates, traverse the N vertices and delete the abnormal vertices from the N vertices to obtain M vertices from the N vertices. The angle between the first reference line and the second reference line is greater than a preset angle. The first reference line is the line connecting the abnormal vertex and the first adjacent point. The second reference line is the line connecting the abnormal vertex and the second adjacent point. The first adjacent point and the second adjacent point are two vertices located on both sides of the abnormal vertex and adjacent to the abnormal vertex from the N vertices. M is a positive integer greater than or equal to 3 and less than or equal to N. Based on the projected coordinates of the M vertices and the height information of the original model, a proxy model corresponding to the original model is established.

2. The method according to claim 1, characterized in that, The process of obtaining N coordinates includes: Based on the projection coordinates of the vertices in the original model onto the target plane, multiple candidate vertices are determined, wherein the projection coordinates of each candidate vertex onto the target plane are located within a reference region, which is the region in the original model where vertices are projected onto the target plane at a preset ratio; The N vertices are determined from the plurality of candidate vertices; Determine the projection coordinates of the N vertices onto the target plane.

3. The method according to claim 2, characterized in that, The step of determining the N vertices from the plurality of candidate vertices includes: Based on the projection coordinates of each candidate vertex in the target plane, N groups of candidate vertices are determined. Each group of candidate vertices in the N groups includes at least one vertex, and any two candidate vertices belonging to the same group have the same projection coordinates in the target plane, while any two candidate vertices belonging to different groups have different projection coordinates in the target plane. The N vertices are determined, and each of the N vertices belongs to one of the N groups of candidate vertices.

4. The method according to claim 3, characterized in that, The N vertices are the vertices with the largest coordinate values ​​in the reference direction among the N groups of candidate vertices, and the reference direction is the direction perpendicular to the target plane; The height information of the original model is the coordinate value of the M vertices in the reference direction.

5. The method according to claim 1 or 2, characterized in that, The height information of the original model is the height information of the bounding box, and all vertices of the original model are located within the bounding box.

6. The method according to any one of claims 1 to 4, characterized in that, The step of establishing a proxy model corresponding to the original model based on the projected coordinates of the M vertices and the height information of the original model includes: Based on the projected coordinates of the M vertices and the height information of the original model, determine the coordinates of the M top vertices located on the top surface of the proxy model and the coordinates of the M bottom vertices located on the bottom surface of the proxy model; Based on the coordinates of the M top vertices and the M bottom vertices, a vertex index is determined. The vertex index is used to record the connection order of each vertex in the proxy model. The proxy model includes the coordinates of the M top vertices, the coordinates of the M bottom vertices, and the vertex index.

7. A computer device, characterized in that, include: The acquisition unit is used to acquire N coordinates, wherein the N coordinates are the projection coordinates of the N vertices of the original model onto the target plane, and N is a positive integer greater than or equal to 3; The processing unit is configured to traverse the N vertices according to the N coordinates, delete abnormal vertices from the N vertices, and obtain M vertices from the N vertices. The angle between the first reference line and the second reference line is greater than a preset angle. The first reference line is the line connecting the abnormal vertex and the first adjacent point. The second reference line is the line connecting the abnormal vertex and the second adjacent point. The first adjacent point and the second adjacent point are two vertices located on both sides of the abnormal vertex and adjacent to the abnormal vertex from the N vertices. M is a positive integer greater than or equal to 3 and less than or equal to N. The modeling unit is used to build a proxy model corresponding to the original model based on the projected coordinates of the M vertices and the height information of the original model.

8. The computer device according to claim 7, characterized in that, The acquisition unit is specifically used to determine multiple candidate vertices based on the projection coordinates of the vertices in the original model projected onto the target plane, determine the N vertices from the multiple candidate vertices, and determine the projection coordinates of the N vertices projected onto the target plane. The projection coordinates of each candidate vertex in the multiple candidate vertices projected onto the target plane are located within a reference area, and the reference area is the area in the original model where vertices projected onto the target plane at a preset ratio.

9. The computer device according to claim 8, characterized in that, The acquisition unit is specifically used to determine N groups of candidate vertices based on the projection coordinates of each candidate vertex in the plurality of candidate vertices onto the target plane. Each group of candidate vertices in the N groups includes at least one vertex, and any two candidate vertices belonging to the same group have the same projection coordinates onto the target plane, while any two candidate vertices belonging to different groups have different projection coordinates onto the target plane. The N vertices are determined, and each of the N vertices belongs to one of the N groups of candidate vertices.

10. The computer device according to claim 9, characterized in that, The N vertices are the vertices with the largest coordinate values ​​in the reference direction among the N groups of candidate vertices, and the reference direction is the direction perpendicular to the target plane; The height information of the original model is the coordinate value of the M vertices in the reference direction.

11. The computer device according to claim 7 or 8, characterized in that, The height information of the original model is the height information of the bounding box, and all vertices of the original model are located within the bounding box.

12. The computer device according to any one of claims 7 to 10, characterized in that, The processing unit is specifically used to determine the coordinates of the M top surface vertices located on the top surface of the proxy model and the coordinates of the M bottom surface vertices located on the bottom surface of the proxy model based on the projected coordinates of the M vertices and the height information of the original model. Based on the coordinates of the M top vertices and the M bottom vertices, a vertex index is determined. The vertex index is used to record the connection order of each vertex in the proxy model. The proxy model includes the coordinates of the M top vertices, the coordinates of the M bottom vertices, and the vertex index.

13. A computer device, characterized in that, include: A processor configured to be coupled to memory, read and execute instructions and / or program code in the memory to perform the method as described in any one of claims 1 to 6.

14. A chip system, characterized in that, include: A logic circuit for coupling with an input / output interface, through which data is transmitted to perform the method as described in any one of claims 1 to 6.

15. A computer-readable medium, characterized in that, The computer-readable medium stores program code that, when run on a computer, causes the computer to perform the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data reduction device for three-dimensional object molding

    JP2016099841A

  • Rendering based generation of occlusion culling models

    US20170358127A1