A model processing method and apparatus, an electronic device, and a storage medium
By acquiring and calculating the vertex information and curvature of the road surface model, and using color to distinguish and display the concavity and convexity information of the road surface model, the problems of low efficiency and poor adaptability in the existing technology are solved, and efficient detection of road surface bumps and improved user experience are achieved.
Patent Information
- Application Number
- CN202411668226.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-11-20
AI Technical Summary
Existing technologies for determining the surface roughness of road models in games are inefficient, have poor adaptability, and struggle to handle complex road conditions, thus impacting user experience.
By acquiring vertex information on the road surface of the road model, the target vertex and its adjacent vertices are determined, the first curvature of the target vertex is calculated, and the concavity and convexity information of the road model is displayed in the engine with color differentiation based on the curvature information, intuitively showing the bumpy situation.
It improves the detection efficiency and user experience of road surface models, accurately detects the bumps of complex road surface models, and provides an intuitive display of bump and dent information.
Smart Images

Figure CN119656579B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game technology, specifically to a model processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] In games, existing methods for determining the bumpiness of road surface curves in road models typically involve analyzing the bumpiness of the road surface curves segment by segment based on the road surface wiring pattern. However, the road surface wiring pattern mainly relies on manual control, which has poor adaptability and is difficult to handle complex road conditions. This results in the inefficiency of existing methods for determining the bumpiness of road surface curves in road models, negatively impacting the user experience. Summary of the Invention
[0003] This application provides a model processing method, apparatus, electronic device, and storage medium. By determining the curvature of the target vertex of the road surface model, the road surface of the road surface model can be distinguished and displayed in the engine using color information, thereby marking the concavity and convexity information of the road surface model. This intuitively displays the bumpiness of the road surface of the road surface model, improving detection efficiency and enhancing user experience.
[0004] In a first aspect, embodiments of this application provide a model processing method, the method comprising:
[0005] Obtain vertex information on the road surface of the road model;
[0006] Based on the vertex information, determine the target vertex and the adjacent vertices of the target vertex;
[0007] Based on the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex, the first curvature of the target vertex is determined;
[0008] Based on the first curvature of the target vertex, determine the color information of the target vertex of the road surface model;
[0009] The road surface model is displayed based on the color information.
[0010] Secondly, embodiments of this application provide a model processing apparatus, including:
[0011] The vertex information acquisition module is used to acquire vertex information on the road surface of the road model;
[0012] The adjacent vertex determination module is used to determine the target vertex and the adjacent vertices of the target vertex based on the vertex information.
[0013] The first curvature determination module is used to determine the first curvature of the target vertex based on the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex.
[0014] The color information determination module is used to determine the color information of the target vertex of the road surface model based on the first curvature of the target vertex.
[0015] The display module is used to display the road surface model based on the color information.
[0016] Thirdly, embodiments of this application also provide an electronic device, which includes a processor and a memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform the steps of any model processing method.
[0017] Fourthly, embodiments of this application also provide a computer-readable storage medium including a processor and a memory, wherein the memory stores a computer program that, when executed by the processor, causes the processor to perform steps of any model processing method.
[0018] Fifthly, embodiments of this application also provide a computer program product, including a computer program stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the electronic device to perform the steps of any of the model processing methods provided in embodiments of this application.
[0019] The solution adopted in this application embodiment can obtain vertex information on the road surface of the road model; determine the target vertex and its adjacent vertices based on the vertex information; determine the first curvature of the target vertex based on the vertex information of the target vertex and the vertex information of its adjacent vertices; determine the color information of the target vertex of the road model based on the first curvature of the target vertex; and display the road model based on the color information. Based on this, by determining the curvature of the target vertex of the road model, the road surface of the road model can be distinguished and displayed within the engine using color information, thereby marking the concavity and convexity information of the road model, intuitively displaying the bumps and jolts of the road surface of the road model, improving detection efficiency while enhancing the user experience. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram of an implementation environment scenario for the model processing method provided in this application embodiment;
[0022] Figure 2 This is a schematic flowchart of one embodiment of the model processing method provided in this application.
[0023] Figure 3 This is a schematic diagram showing the road surface model after processing by the model processing method provided in the embodiments of this application;
[0024] Figure 4 This is a schematic diagram of the structure of the model processing device provided in the embodiments of this application;
[0025] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0026] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. At the same time, in the description of the embodiments of this application, the terms "first," "second," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0027] This application provides a model processing method, apparatus, electronic device, and computer-readable storage medium. The model processing apparatus can be integrated into an electronic device, which may be a server or a terminal, etc.
[0028] The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery network (CDN) acceleration services, and big data and artificial intelligence platforms. The terminal can include, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0029] Please see Figure 1 Taking the integration of model processing devices into electronic devices as an example, Figure 1 This is a schematic diagram of an implementation scenario of the model processing method provided in this application. The electronic device can be a terminal device, which acquires vertex information on the road surface of the road model; determines a target vertex and its adjacent vertices based on the vertex information; determines a first curvature of the target vertex based on the vertex information of the target vertex and the vertex information of its adjacent vertices; determines the color information of the target vertex of the road model based on the first curvature of the target vertex; and displays the road model based on the color information.
[0030] It should be noted that, Figure 1 The illustrated scenario of the model processing method is merely an example. The implementation environment of the model processing method described in this application is intended to more clearly illustrate the technical solutions of this application and does not constitute a limitation on the technical solutions provided in this application. Those skilled in the art will recognize that, with the evolution of data processing and the emergence of new business scenarios, the technical solutions provided in this application are equally applicable to similar technical problems.
[0031] The solutions provided in this application are specifically illustrated through the following embodiments. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.
[0032] This embodiment will be described from the perspective of a model processing device, which can be integrated into an electronic device, which can be a terminal and / or a server, and this application does not impose any limitations on it.
[0033] Research has revealed that current methods for designing road surface models in game applications rely on manual visual inspection and simple physical simulations to generate the models. Road surface models generated using these traditional methods suffer from low simulation accuracy and difficulty in accurately detecting bumps and subtle imbalances on the road surface.
[0034] For example, in racing games and simulators, the quality and detail of the road surface directly impact the player's experience. Developers manually control the topology of the track model to generate the track model, and the physical track in the game is based on this model. The physical representation of the road surface when a vehicle travels is achieved by confirming the physical materials of different road sections within the track model. This is typically done in 3D software to ensure the smoothness of the track model's surface, and by detecting bumps in each road surface through in-game testing methods within the engine. However, because this track model needs to be generated manually by developers controlling the topology, developers need to observe the smoothness of the track model segment by segment, leading to the following problems: low efficiency, poor consistency, low accuracy, difficulty in expansion, and poor visibility. Low efficiency refers to the time-consuming, labor-intensive, and complex nature of existing methods, making it difficult to handle complex road network scenarios. Poor consistency and low accuracy mean that due to the need for manual identification and testing, the road surface bumps in the track model cannot be fully detected, and the differences in drawing styles and precision among different developers inevitably lead to significant errors, resulting in inconsistent track model performance. The difficulty in scaling refers to the repetitive nature of existing methods, requiring manual intervention for each modification or adjustment, hindering rapid iteration. When large-scale track adjustments are needed, re-inspecting road surface bumps is costly and prone to errors. Manual inspection methods are difficult to scale to different projects and requirements, necessitating extensive manual work for each new project, lacking versatility and reusability. Poor visibility means that identifying uneven areas in the model through observation of the model's wiring is challenging, especially in subtle areas affecting the vehicle's suspension, resulting in insufficient visualization.
[0035] To address the aforementioned issues, this application obtains vertex information from the road surface of a road model; based on this vertex information, it determines a target vertex and its adjacent vertices; based on the vertex information of the target vertex and its adjacent vertices, it determines the first curvature of the target vertex; based on the first curvature of the target vertex, it determines the color information of the target vertex of the road model; and based on the color information, it displays the road model. By determining the curvature of the target vertex of the road model, the engine uses color information to distinguish and display the road surface of the road model, thereby marking the unevenness information of the road model and intuitively displaying the bumps of the road surface, improving detection efficiency and enhancing the user experience.
[0036] Specifically, please refer to Figure 2 , Figure 2 This application provides a model processing method, the specific flow of which can be described by the following steps 101 to 105, wherein:
[0037] Step 101: Obtain vertex information on the road surface of the road model.
[0038] Here, a road surface model refers to a model that simulates the road surface in a game scene within a virtual digital space. The type of road surface model can be adjusted according to actual circumstances, and this application embodiment does not impose any limitations. For example, the road surface model may be a road model in a virtual scene. Another example is a racetrack model in a virtual scene.
[0039] Here, the road surface refers to the geometric representation of the road surface indicated by the road model. The representation of the road surface can be adjusted according to the actual situation, and the embodiments of this application do not impose any limitations. For example, the road surface is a triangular grid surface. Another example is that the road surface is a grid surface.
[0040] Vertex information is used to indicate relevant information about a vertex. The specific content of the vertex information can be adjusted according to actual conditions, and this application embodiment does not impose any limitations. For example, vertex information includes the vertex's coordinates, height information, normal vector, and position vector.
[0041] There are various ways to obtain vertex information, and the specific methods can be adjusted according to the actual situation. This application does not impose any restrictions on these methods. For example, when loading a road surface model, the vertex data of the road surface model object can be accessed by calling the interface or function provided by the software or program. When the vertex data is accessed, the vertex information is extracted.
[0042] Step 102: Based on the vertex information, determine the target vertex and its adjacent vertices.
[0043] In this context, a target vertex refers to a specific point in the road surface model that represents the road surface surface. The target vertex can be determined based on the road surface surface and the road surface model. For example, a target vertex is the point where each triangle on the triangular grid surface intersects or connects. Another example is an extreme point at a specific location on the road surface.
[0044] It should be noted that the number of target vertices can be adjusted according to the actual situation. For example, the number of target vertices can be all the vertices on the road surface model. Or, the target vertices can be only a portion of the vertices on the road surface model.
[0045] Adjacent vertices refer to vertices that are physically adjacent to the target vertex.
[0046] There are multiple ways to determine the neighboring vertices of a target vertex based on vertex information, and the specific methods can be adjusted according to the actual situation. This application does not impose any limitations on these methods. For example, for each target vertex, a function can be called to obtain the neighboring vertices of that target vertex, such as `int neighbours[] = neighbors(0, @ptnum)`; where `neighbours()` is a function, `@ptnum` is a vertex, and `neighbours[]` is the set of neighboring vertices of `@ptnum`. Another example is in a three-dimensional surface model, where the distance between vertices can be calculated based on their coordinates, and vertices that are closer together can be classified as neighboring vertices.
[0047] Step 103: Determine the first curvature of the target vertex based on the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex.
[0048] The first curvature refers to the degree of curvature of the target vertex at the corresponding position in the road surface model.
[0049] There are various ways to determine the first curvature, and the specific method can be adjusted according to the actual situation. This application does not impose any limitations on the embodiments. For example, if the road surface has an analytical expression, the principal curvature and Gaussian curvature of the vertex can be directly calculated through differentiation, and the Gaussian curvature of the vertex can be determined based on the principal curvature and Gaussian curvature. Another example is that if the road surface is a discrete surface (such as a triangular mesh surface), numerical differentiation can be performed on the adjacent vertices of the target vertex on the road surface to obtain the first curvature of that vertex. Yet another example is that finite difference can be used to approximate differentiation to obtain the first curvature of the vertex.
[0050] Specifically, in an optional embodiment, the process of determining the first curvature of the target vertex based on the vertex information of the target vertex and the vertex information of the neighboring vertices of the target vertex includes: determining the directional curvature of the neighboring vertices of the target vertex based on the vertex information of the target vertex and the vertex information of the neighboring vertices of the target vertex, and determining the weights of the neighboring vertices of the target vertex; constructing a shape operator corresponding to the target vertex based on the directional curvature and the weights; and determining the first curvature of the target vertex based on the shape operator of the target vertex.
[0051] Directional curvature refers to the degree of curvature of a vertex on a road surface along the direction determined by its adjacent vertices. There are various ways to determine directional curvature, and the specific method can be adjusted according to the actual situation. This application does not impose any restrictions on this method.
[0052] For example, vertex information includes normals, which are vectors perpendicular to the surface. The process of determining the directional curvature of the adjacent vertices of the target vertex, based on the vertex information of the target vertex and the vertex information of its adjacent vertices, can include: calculating the normal directions between the vertex and its adjacent vertices to determine the directional curvature.
[0053] For example, vertex information includes position vectors and normals. The process of determining the directional curvature of the adjacent vertices of the target vertex based on the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex can include: calculating the edge vectors between the target vertex and its adjacent vertices based on the position vectors of the target vertex and the position vectors of its adjacent vertices; projecting the edge vectors onto the normal plane of the target vertex to obtain the projection vectors corresponding to the adjacent vertices of the target vertex; and determining the directional curvature of the adjacent vertices of the target vertex based on the edge vectors corresponding to the adjacent vertices of the target vertex, the length information of the edge vectors, and the projection vectors.
[0054] Here, weight refers to the weight of adjacent vertices in the construction of subsequent shape operators. There are various ways to determine the weight, and the specific method can be adjusted according to the actual situation. This application does not impose any restrictions on the embodiments. For example, the weight of adjacent vertices can be determined based on the distance between a vertex and its adjacent vertices. Another example is to determine the area of half-faces of a vertex and its adjacent vertices, and then determine the weight of adjacent vertices based on this area.
[0055] Here, the shape operator refers to the differential operator that describes how a surface bends in the surrounding space. Based on the shape operator of the target vertex, there are various ways to determine the first curvature of the target vertex, and these methods can be adjusted according to actual circumstances; the embodiments in this application do not impose any limitations.
[0056] For example, the process of determining the first curvature of a target vertex based on the shape operator described above may include: determining the first eigenvector of the target vertex based on the shape operator; calculating eigenvalues based on the eigenvector; and determining the first curvature of the target vertex based on the eigenvalues. As another example, the process of determining the first curvature of a target vertex based on the shape operator described above may include: determining the first eigenvector of the target vertex based on the shape operator; performing a cross product between the first eigenvector and the normal vector of the target vertex to obtain a second eigenvector of the target vertex; determining the first eigenvalue and the second eigenvalue of the target vertex based on the first and second eigenvectors, wherein the first eigenvalue is not greater than the second eigenvalue; determining multiple second curvatures of the target vertex based on the first and second eigenvalues; and averaging the multiple second curvatures of the target vertex to obtain the first curvature of the target vertex.
[0057] The above embodiment will be explained below with a specific example. The code example for determining the first curvature of the target vertex based on the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex is as follows:
[0058] int neighbors[]=neighbors(0,@ptnum);
[0059] Here, @ptnum represents the vertex attribute of the current vertex. For example, the value of @ptnum for vertex 0 is 0, the value for vertex 1 is 1, and so on. neighbours[] represents the neighboring vertices of this vertex. This code determines the neighboring vertices of the target vertex.
[0060] @N = normalize(@N);
[0061] Here, @N represents the vertex normal. This code indicates normal normalization, ensuring that the vertex normal has a length of 1 by normalizing it. It should be noted that each vertex has its own vertex normal.
[0062] float mat_array[];
[0063] float area_sum = 0;
[0064] The above code initializes the shape operator matrix and area weights, where mat_array[] indicates the shape operator matrix and area_sum indicates the weights of adjacent vertices determined by area.
[0065] The following code iterates through the neighboring vertices of a vertex and calculates the weight and curvature contribution (i.e., directional curvature) of each neighboring vertex:
[0066] foreach(int neighbor;neighbors)
[0067] {
[0068] vector pos = point(0,"P",neighbour); / / Determines the position vector pos from the current vertex P to the neighboring vertex.
[0069] vector edge = pos - @P; / / Calculate the edge vector edge from the current vertex to the adjacent vertex.
[0070] matrix3 mat_p = ident() - outerproduct(@N, @N); / Project the edge vector edge onto a plane perpendicular to the normal vector @N.
[0071] vector edge_p = normalize(edge*mat_p); / / Project and normalize the edge vector edge.
[0072] / / Calculate directional curvature
[0073] float curv_d = 2 * f @_mcu_bound_size * dot(edge, @N) / dot(edge, edge); / / The final curvature difference is represented by the ratio of the component of the edge vector in the normal direction to the square length of the edge vector.
[0074] / / Calculate weights
[0075] float area = 0;
[0076] int prim1=hedge_prim(0,pointhedge(0,@ptnum,neighbour));
[0077] int prim2=hedge_prim(0,pointhedge(0,neighbour,@ptnum));
[0078] if (prim1 != -1)
[0079] area+=primintrinsic(0,"measuredarea",prim1);
[0080] if (prim2 != -1)
[0081] area+=primintrinsic(0,"measuredarea",prim2);
[0082] area_sum += area;
[0083] / / Construct shape operator
[0084] for(int i = 0; i < 9; i++)
[0085] mat_array[i]+=area*curv_d*edge_p[i / 3]*edge_p[i%3];
[0086] }
[0087] Among them, prim1 and prim2 are custom attributes. prim1 represents the half-face index from vertex 0 to vertex 1, and prim2 represents the half-face index from vertex 1 to vertex 0.
[0088] Standardize the shape operator matrix of the vertex by area using the following code:
[0089] for(int i = 0; i < 9; i++)
[0090] mat_array[i] / =area_sum;
[0091] Eigenvalue decomposition calculates eigenvectors from an input matrix.
[0092] matrix3 mat = set(mat_array); / / Assign the value of mat_array to matrix mat.
[0093] vector eigvec2 = normalize(eigenvector(mat, 100, 1e-5)); / / Calculate the eigenvector eigvec2 of matrix mat, corresponding to the larger eigenvalues (here 100 is used as the iteration number and 1e-5 is used as the tolerance).
[0094] vector eigvec1 = normalize(cross(@N, eigvec2)); / / Another eigenvector eigvec1 is obtained by cross-multiplying the normal vector @N with eigvec2 and normalizing it.
[0095] Calculate the corresponding eigenvalues from the eigenvectors:
[0096] float m11=(matrix3(set(eigvec1*mat,0,0))*transpose(matrix3(set(eigvec1,0,0)))).xx; / / First eigenvector.
[0097] float m22=(matrix3(set(eigvec2*mat,0,0))*transpose(matrix3(set(eigvec2,0,0)))).xx; / / Second eigenvector.
[0098] float k1 = 3 * m11 - m22; / / k1 is the minimum curvature of each vertex, i.e., the first eigenvalue.
[0099] float k2 = 3 * m22 - m11; / / k2 is the maximum curvature of each vertex, i.e., the second eigenvalue.
[0100] Step 104: Determine the color information of the target vertex of the road surface model based on the first curvature of the target vertex.
[0101] Color information is used to indicate the color information of vertices when the road surface model is rendered or displayed.
[0102] There are multiple ways to determine the color information of the target vertex of the road surface model based on the first curvature of the target vertex, and the specific method can be adjusted according to the actual situation. This application does not impose any restrictions on the embodiments.
[0103] For example, the process of determining the color information of a target vertex in a road surface model based on the first curvature of the target vertex can be achieved by determining the color value corresponding to the first curvature of the target vertex based on the mapping relationship between curvature and color information, and using this value as the color information of the target vertex in the road surface model. The mapping relationship can be constructed in advance.
[0104] For example, the process of determining the color information of the target vertex of the road surface model based on the first curvature of the target vertex can also be as follows: based on the first curvature of the target vertex, determine the maximum curvature and minimum curvature of the road surface model; based on the maximum curvature, minimum curvature and the first curvature of the target vertex, determine the concavity and convexity information of the target vertex; based on the concavity and convexity information, determine the color information of the target vertex of the road surface model.
[0105] For example, the first curvature is the average curvature, and the maximum and minimum curvatures corresponding to the road surface model can be determined using the following code:
[0106] float mean_curv=(k1+k2)*0.5; / / Calculate the average curvature mean_curv for each vertex.
[0107] float_mcu_max_curv = max(mean_curv); / / Calculate the maximum value of the mean_curv attribute of all vertices to obtain the maximum curvature of the road surface model.
[0108] float_mcu_min_curv = min(mean_curv); / / Calculate the minimum value of the mean_curv attribute of all vertices to obtain the minimum curvature of the road surface model.
[0109] It should be noted that a surface contains countless curves in different directions, and points on the surface have different curvatures in different directions. The maximum and minimum values are called the principal curvatures k1 and k2, and the directions of the extreme values are called the principal directions. Mathematically, k1 and k2 are perpendicular to each other. The arithmetic mean of the two principal curvatures, (k1+k2) / 2, reflects the degree of concavity or convexity of the surface. A positive average curvature indicates local concavity, while a negative average curvature indicates local convexity.
[0110] The concavity / convexity information includes concavity information and convexity information. Concavity information indicates the degree of concavity / convexity of the concave surface of the road surface model. Convexity information indicates the degree of concavity / convexity of the convex surface of the road surface model.
[0111] The process of determining the concavity / convexity information of a target vertex based on the maximum curvature, minimum curvature, and the first curvature of the target vertex is as follows: If the first curvature of the target vertex is within the range of convex curvature formed by the preset curvature to the minimum curvature, the convexity information corresponding to the first curvature is determined based on the first mapping relationship between the convex curvature range and the preset range, and the concavity information of the target vertex is determined as the preset concavity information; if the first curvature of the target vertex is within the range of concave curvature formed by the preset curvature to the maximum curvature, the concavity information corresponding to the first curvature is determined based on the second mapping relationship between the concave curvature range and the preset range, and the convexity information of the target vertex is determined as the preset convexity information.
[0112] The preset curvature can be adjusted according to actual conditions, and this application embodiment does not impose any restrictions. For example, the preset curvature is 0. Another example is a preset curvature of 0.5.
[0113] The preset range is a pre-defined adjustment range that can be adjusted according to actual conditions. For example, the preset range is (0, 1). Or, for another example, the preset range is (-1, 1).
[0114] The first mapping relationship is used to indicate the mapping relationship between the convex surface curvature range and the preset range.
[0115] For example, through the first mapping relationship, the convex surface curvature range (f@_mcu_min_convexity, 0), where f@_mcu_min_convexity indicates the minimum curvature of the road surface model and f@_mcu_max_convexity indicates the maximum curvature of the road surface model, is mapped to the range of 0-1. For example, the minimum value is -3, the intermediate value is -1.5, and after remapping, they become 1 and 0.5.
[0116] For example, the convexity information corresponding to the first curvature is determined according to the following code.
[0117] f@_mcu_convexity=fit(min(mean_curv*-1,0),0,_mcu_min_curv,0,1).
[0118] The second mapping relationship is used to indicate the mapping relationship between the concave surface curvature range and the preset range. For example, through the second mapping relationship, the concave surface curvature range (0, f@_mcu_min_convexity), where f@_mcu_min_convexity indicates the minimum curvature of the road surface model and f@_mcu_max_convexity indicates the maximum curvature of the road surface model, is mapped to the 0-1 range.
[0119] For example, the concavity information corresponding to the first curvature is determined according to the following code.
[0120] f@_mcu_concavity=fit(max(mean_curv,0),0,_mcu_max_curv,0,1).
[0121] It should be noted that the same vertex can have both of these attributes simultaneously without interfering with each other, because after the above data processing, when the value of _mcu_convexity is greater than zero, _mcu_concavity is 0.
[0122] In some optional embodiments, an adjustment curve can be bound to the concavity and convexity information of the vertex to facilitate subsequent parameter tuning.
[0123] Specifically, the adjustment curve is a ramp curve, and the ramp curve is bound to the concavity / bump information of the vertices according to the following code:
[0124] f@_mcu_convexity=chramp("convexramp",f@_mcu_convexity);
[0125] f@_mcu_concavity=chramp("concaveramp",f@_mcu_concavity).
[0126] In some optional embodiments, the process of determining the color information of a target vertex of a road surface model based on convexity information may include: if the display mode of the road surface model is monochrome, determining the color information of the target vertex based on the difference between the convexity information and the concavity information of the target vertex; if the display mode of the road surface model is non-monochrome, determining the first color value of the first color channel of the target vertex based on the convexity information of the target vertex, and determining the second color value of the second color channel of the target vertex based on the concavity information of the target vertex, and determining the color information of the target vertex based on the first color value and the second color value.
[0127] The first color channel and the second color channel can be adjusted according to the actual situation, and this application embodiment does not impose any restrictions.
[0128] Specifically, implement the above process using the following code:
[0129] if(int(ch("single_color")))
[0130] {
[0131] v@Cd=0.5+0.5*(f@_mcu_convexity-f@_mcu_concavity); / / This calculation increases the convexity of the vertices and decreases the concavity, ultimately yielding a monochrome value range of 0-1.
[0132] }
[0133] else
[0134] {
[0135] v@Cd.r = f@_mcu_convexity;
[0136] v@Cd.g = f@_mcu_concavity;
[0137] v@Cd.b = 0.0;
[0138] }
[0139] Here, int(ch("single_color")) indicates the color display mode provided by the tool. When int(ch("single_color")) is true, monochrome display is used, and when int(ch("single_color")) is false, non-monochrome display is used (such as red-green display or black-and-white display).
[0140] Step 105: Display the road surface model based on color information.
[0141] Specifically, the first curvature is written as the vertex color into the vertex attributes, and the road surface model is displayed based on the color information in the vertex attributes, that is, the vertex color.
[0142] Please see Figure 3 , Figure 3 This is a schematic diagram showing a road surface model processed by the model processing method provided in this application. By determining the curvature of the target vertices of the road surface model, the road surface of the model is displayed in the engine using color information, providing an intuitive display of curvature information and enhancing the detection effect. Furthermore, the above scheme can also be applied to complex target models, accurately detecting and representing the surface details of their road surfaces.
[0143] In some optional embodiments, the above method may further include displaying vertex colors in vertex attributes in a game environment to display the bump and dent information of the road surface model in real time.
[0144] In some optional embodiments, the above method may further include: filtering the first curvature of the target vertex, determining the position information of vertices that do not meet the model adjustment requirements, and adjusting the curvature of the vertices where the position information is located so that the curvature of the adjusted vertices meets the model adjustment requirements.
[0145] The solution adopted in this application embodiment can obtain vertex information on the road surface of the road model; determine the target vertex and its adjacent vertices based on the vertex information; determine the first curvature of the target vertex based on the vertex information of the target vertex and the vertex information of its adjacent vertices; determine the color information of the target vertex of the road model based on the first curvature of the target vertex; and display the road model based on the color information. Based on this, by determining the curvature of the target vertex of the road model, the road surface of the road model can be distinguished and displayed within the engine using color information, thereby marking the concavity and convexity information of the road model, intuitively displaying the bumps and jolts of the road surface of the road model, improving detection efficiency while enhancing the user experience.
[0146] This embodiment also provides a model processing device, which can be integrated into a terminal device. For example, such as Figure 4 As shown, the model processing device may include:
[0147] Vertex information acquisition module 201 is used to acquire vertex information on the road surface of the road model;
[0148] The adjacent vertex determination module 202 is used to determine the target vertex and the adjacent vertices of the target vertex based on the vertex information.
[0149] The first curvature determination module 203 is used to determine the first curvature of the target vertex based on the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex.
[0150] Color information determination module 204 is used to determine the color information of the target vertex of the road surface model based on the first curvature of the target vertex;
[0151] Display module 205 is used to display the road surface model based on color information.
[0152] Optionally, in the apparatus of this application embodiment, the color information determination module 204 includes:
[0153] The curvature determination submodule is used to determine the maximum and minimum curvature of the road surface model based on the first curvature of the target vertex.
[0154] The concavity and convexity information determination submodule is used to determine the concavity and convexity information of the target vertex based on the maximum curvature, minimum curvature, and the first curvature of the target vertex.
[0155] The color information determination submodule is used to determine the color information of target vertices of the road surface model based on the concavity and convexity information.
[0156] Optionally, in the apparatus of this application embodiment, the above-mentioned concavity and convexity information includes concavity information and convexity information.
[0157] Based on this, the aforementioned sub-module for determining concavity / convexity information includes:
[0158] The first unit for determining concavity and convexity information is used to determine the convexity information corresponding to the first curvature and to determine the concavity information of the target vertex as the preset concavity information if the first curvature of the target vertex is within the range of convex curvature formed by the preset curvature to the minimum curvature.
[0159] The second unit for determining concavity and convexity information is used to determine the concavity information corresponding to the first curvature and the convexity information of the target vertex as the preset convexity information if the first curvature of the target vertex is within the concave curvature range formed by the preset curvature to the maximum curvature.
[0160] Optionally, in the apparatus of this application embodiment, the aforementioned color information determination submodule includes:
[0161] The first unit for determining color information is used to determine the color information of the target vertex based on the difference between the convexity information and concavity information of the target vertex if the display mode of the road surface model is monochrome.
[0162] The second unit for determining color information is used to determine the first color value of the first color channel of the target vertex based on the convexity information of the target vertex, and the second color value of the second color channel of the target vertex based on the concavity information of the target vertex, and to determine the color information of the target vertex based on the first color value and the second color value.
[0163] Optionally, in the apparatus of this application embodiment, the first curvature determination module 203 includes:
[0164] The orientation curvature determination submodule is used to determine the orientation curvature of the adjacent vertices of the target vertex and the weights of the adjacent vertices of the target vertex based on the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex.
[0165] The shape operator construction submodule is used to construct the shape operator corresponding to the target vertex based on the directional curvature and weights.
[0166] The first curvature determination submodule is used to determine the first curvature of the target vertex based on the shape operator of the target vertex.
[0167] Optionally, in the apparatus of this application embodiment, the vertex information includes position vectors and normals.
[0168] Based on this, the aforementioned directional curvature determination submodule includes:
[0169] The edge vector determination unit is used to calculate the edge vector between the target vertex and its neighboring vertices based on the position vector of the target vertex and the position vectors of the target vertex's neighboring vertices.
[0170] The projection vector determination unit is used to project the edge vector onto the normal plane of the target vertex to obtain the projection vectors corresponding to the adjacent vertices of the target vertex.
[0171] The orientation curvature determination unit is used to determine the orientation curvature of the adjacent vertices of the target vertex based on the edge vectors corresponding to the adjacent vertices of the target vertex, the length information of the edge vectors, and the projection vector.
[0172] Optionally, in the apparatus of this application embodiment, the first curvature determination submodule includes:
[0173] The first feature vector determination unit is used to determine the first feature vector of the target vertex based on the shape operator of the target vertex.
[0174] The second feature vector determination unit is used to perform a cross product between the first feature vector of the target vertex and the normal vector of the target vertex to obtain the second feature vector of the target vertex.
[0175] The eigenvalue determination unit is used to determine the first eigenvalue and the second eigenvalue of the target vertex based on the first eigenvector and the second eigenvector, respectively, wherein the first eigenvalue is not greater than the second eigenvalue.
[0176] The second curvature determination unit is used to determine multiple second curvatures of the target vertex based on the first eigenvalue and the second eigenvalue;
[0177] The first curvature determination unit is used to average multiple second curvatures of the target vertex to obtain the first curvature of the target vertex.
[0178] The solution adopted in this application embodiment can acquire vertex information on the road surface of the road model through vertex information acquisition module 201; adjacent vertex determination module 202 determines the target vertex and its adjacent vertices based on the vertex information; first curvature determination module 203 determines the first curvature of the target vertex based on the vertex information of the target vertex and the vertex information of its adjacent vertices; color information determination module 204 determines the color information of the target vertex of the road model based on the first curvature of the target vertex; and display module 205 displays the road model based on the color information. Based on this, by determining the curvature of the target vertex of the road model, the road surface of the road model is distinguished and displayed within the engine using color information, thereby marking the concavity and convexity information of the road model and intuitively displaying the bumpiness of the road surface, improving detection efficiency and enhancing user experience.
[0179] Accordingly, this application also provides an electronic device, which can be a terminal, such as a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer (PC), personal digital assistant (PDA), or other terminal device. Alternatively, the electronic device can be a server.
[0180] like Figure 5 As shown, Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 300 includes a processor 301 with one or more processing cores, a memory 302 with one or more computer-readable storage media, and a computer program stored in the memory 302 and executable on the processor. The processor 301 and the memory 302 are electrically connected. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0181] The processor 301 is the control center of the electronic device 300. It connects various parts of the electronic device 300 via various interfaces and lines. By running or loading software programs and / or units stored in the memory 302, and by calling data stored in the memory 302, it executes various functions and processes data of the electronic device 300, thereby providing overall monitoring of the electronic device 300. The processor 301 can be a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc., and can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0182] In this embodiment, the processor 301 in the electronic device 300 loads the instructions corresponding to the processes of one or more applications into the memory 302 according to the following steps, and the processor 301 runs the applications stored in the memory 302 to realize various functions, such as:
[0183] Obtain vertex information on the road surface of the road model;
[0184] Based on the vertex information, determine the target vertex and its adjacent vertices;
[0185] Based on the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex, determine the first curvature of the target vertex;
[0186] Based on the first curvature of the target vertex, determine the color information of the target vertex of the road surface model;
[0187] The road surface model is displayed based on color information.
[0188] The electronic device provided in this application embodiment can acquire vertex information on the road surface of a road model; determine a target vertex and its adjacent vertices based on the vertex information; determine the first curvature of the target vertex based on the vertex information of the target vertex and its adjacent vertices; determine the color information of the target vertex of the road model based on the first curvature of the target vertex; and display the road model based on the color information. Based on this, by determining the curvature of the target vertex of the road model, the road surface of the road model can be distinguished and displayed within the engine using color information, thereby marking the concavity and convexity information of the road model and intuitively displaying the bumps and jolts of the road surface, improving detection efficiency and enhancing user experience.
[0189] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0190] Optional, such as Figure 5 As shown, the electronic device 300 also includes: a touch display screen 303, a radio frequency circuit 304, an audio circuit 305, an input unit 306, and a power supply 307. The processor 301 is electrically connected to the touch display screen 303, the radio frequency circuit 304, the audio circuit 305, the input unit 306, and the power supply 307. Those skilled in the art will understand that... Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0191] The touch display screen 303 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 303 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 301. It can also receive and execute commands from the processor 301. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 301 to determine the type of touch event. Subsequently, the processor 301 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 303 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 303 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 303 can also be used as part of the input unit 306 to achieve input functions.
[0192] The radio frequency circuit 304 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0193] Audio circuitry 305 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 305 converts received audio data into electrical signals, transmits them to the speaker, and the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 305, converted back into audio data, and then processed by processor 301 before being transmitted via radio frequency circuitry 304 to, for example, another electronic device, or output to memory 302 for further processing. Audio circuitry 305 may also include an earphone jack to facilitate communication between peripheral headphones and electronic devices.
[0194] The input unit 306 can be used to receive the display mode of the road surface model, or the curvature information of the vertices that need to be adjusted.
[0195] Power supply 307 is used to supply power to various components of electronic device 300. Optionally, power supply 307 can be logically connected to processor 301 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 307 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0196] although Figure 5 As not shown in the diagram, the electronic device 300 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0197] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0198] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0199] Therefore, embodiments of this application provide a computer-readable storage medium storing multiple computer programs that can be loaded by a processor to execute any of the model processing methods provided in this application. The computer program can execute the steps of the following model processing method:
[0200] Obtain vertex information on the road surface of the road model;
[0201] Based on the vertex information, determine the target vertex and its adjacent vertices;
[0202] Based on the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex, determine the first curvature of the target vertex;
[0203] Based on the first curvature of the target vertex, determine the color information of the target vertex of the road surface model;
[0204] The road surface model is displayed based on color information.
[0205] Using the computer-readable storage medium provided in this application embodiment, vertex information on the road surface of a road model can be acquired; based on the vertex information, a target vertex and its adjacent vertices can be determined; based on the vertex information of the target vertex and its adjacent vertices, a first curvature of the target vertex can be determined; based on the first curvature of the target vertex, the color information of the target vertex of the road model can be determined; and based on the color information, the road model can be displayed. Based on this, by determining the curvature of the target vertex of the road model, the road surface of the road model can be distinguished and displayed within the engine using color information, thereby marking the concavity and convexity information of the road model, intuitively displaying the bumpiness of the road surface of the road model, improving detection efficiency while enhancing the user experience.
[0206] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0207] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0208] Since the computer program stored in the computer-readable storage medium can execute any of the model processing methods provided in the embodiments of this application, it can achieve the beneficial effects that any of the model processing methods provided in the embodiments of this application can achieve, as detailed in the preceding embodiments, and will not be repeated here.
[0209] According to one aspect of this application, a computer program product or computer program is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in the various optional implementations of the above embodiments.
[0210] In the above embodiments of the model processing apparatus, computer-readable storage medium, electronic device, and computer program product, the descriptions of each embodiment have different focuses. Parts not described in detail in a particular embodiment can be referred to in the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes and beneficial effects of the model processing apparatus, computer-readable storage medium, computer program product, electronic device, and their corresponding units described above can be referred to the description of the model processing method in the above embodiments, and will not be repeated here.
[0211] The foregoing has provided a detailed description of a model processing method, apparatus, electronic device, computer-readable storage medium, and computer program product provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A model processing method characterized by comprising: The method comprises: acquiring vertex information on a road surface curve of a road surface model; determining a target vertex and adjacent vertices of the target vertex according to the vertex information; determining a first curvature of the target vertex according to vertex information of the target vertex and vertex information of the adjacent vertices of the target vertex; determining color information of the target vertex of the road surface model based on the first curvature of the target vertex; displaying the road surface model based on the color information; wherein the determining of the color information of the target vertex of the road surface model based on the first curvature of the target vertex comprises: determining a maximum curvature and a minimum curvature corresponding to the road surface model based on the first curvature of the target vertex; determining concave-convex information of the target vertex based on the maximum curvature, the minimum curvature and the first curvature of the target vertex, wherein the concave-convex information comprises concave information and convex information, and the determining of the concave-convex information of the target vertex based on the maximum curvature, the minimum curvature and the first curvature of the target vertex comprises: if the first curvature of the target vertex is in a convex curvature range constituted by a preset curvature to the minimum curvature, determining convex information corresponding to the first curvature based on a first mapping relationship between the convex curvature range and a preset range, and determining the concave information of the target vertex as preset concave information; and if the first curvature of the target vertex is in a concave curvature range constituted by a preset curvature to the maximum curvature, determining concave information corresponding to the first curvature based on a second mapping relationship between the concave curvature range and the preset range, and determining the convex information of the target vertex as preset convex information; determining the color information of the target vertex of the road surface model based on the concave-convex information.
2. The model processing method according to claim 1, characterized by, The determining of the color information of the target vertex of the road surface model based on the concave-convex information comprises: if a display mode of the road surface model is single-color display, determining the color information of the target vertex based on a difference between the convex information and the concave information of the target vertex; if the display mode of the road surface model is non-single-color display, determining a first color value of a first color channel of the target vertex based on the convex information of the target vertex, and determining a second color value of a second color channel of the target vertex based on the concave information of the target vertex, and determining the color information of the target vertex based on the first color value and the second color value.
3. The model processing method according to claim 2, characterized by, The determining of the first curvature of the target vertex according to the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex comprises: determining a directional curvature of the adjacent vertices of the target vertex and a weight of the adjacent vertices of the target vertex based on the vertex information of the target vertex and the vertex information of the adjacent vertices of the target vertex; constructing a shape operator corresponding to the target vertex based on the directional curvature and the weight; determining the first curvature of the target vertex based on the shape operator of the target vertex.
4. The model processing method according to claim 3, characterized by, The vertex information includes a position vector and a normal vector; the direction curvature of the adjacent vertex of the target vertex is determined based on the vertex information of the target vertex and the vertex information of the adjacent vertex of the target vertex, and includes: An edge vector between the target vertex and the adjacent vertex of the target vertex is calculated based on the position vector of the target vertex and the position vector of the adjacent vertex of the target vertex; The edge vector is projected onto the normal plane of the target vertex to obtain a projection vector corresponding to the adjacent vertex of the target vertex; The direction curvature of the adjacent vertex of the target vertex is determined based on the edge vector corresponding to the adjacent vertex of the target vertex, the length information of the edge vector, and the projection vector.
5. The model processing method according to claim 3, characterized by, The first curvature of the target vertex is determined based on the shape operator of the target vertex, and includes: A first eigenvector of the target vertex is determined based on the shape operator of the target vertex; A second eigenvector of the target vertex is obtained by cross-multiplying the first eigenvector of the target vertex and the normal vector of the target vertex; A first eigenvalue and a second eigenvalue of the target vertex are respectively determined based on the first eigenvector and the second eigenvector, and the first eigenvalue is not greater than the second eigenvalue; A plurality of second curvatures of the target vertex are determined based on the first eigenvalue and the second eigenvalue; The first curvature of the target vertex is obtained by averaging the plurality of second curvatures of the target vertex.
6. A model processing apparatus characterized by comprising: The device includes: A vertex information acquisition module is configured to acquire vertex information on a road surface of a road surface model; An adjacent vertex determination module is configured to determine a target vertex and an adjacent vertex of the target vertex according to the vertex information; A first curvature determination module is configured to determine a first curvature of the target vertex according to the vertex information of the target vertex and the vertex information of the adjacent vertex of the target vertex; A color information determination module is configured to determine color information of the target vertex of the road surface model based on the first curvature of the target vertex; A display module is configured to display the road surface model based on the color information; The color information determination module is further configured to: Determine a maximum curvature and a minimum curvature corresponding to the road surface model based on the first curvature of the target vertex. determine concave-convex information of the target vertex based on the maximum curvature, the minimum curvature and the first curvature of the target vertex, wherein the concave-convex information comprises concave information and convex information, and the determining of the concave-convex information of the target vertex based on the maximum curvature, the minimum curvature and the first curvature of the target vertex comprises: if the first curvature of the target vertex is in a convex curvature range constituted by the preset curvature and the minimum curvature, determining convex information corresponding to the first curvature based on a first mapping relationship between the convex curvature range and a preset range, and determining the concave information of the target vertex as preset concave information; and if the first curvature of the target vertex is in a concave curvature range constituted by the preset curvature and the maximum curvature, determining concave information corresponding to the first curvature based on a second mapping relationship between the concave curvature range and the preset range, and determining the convex information of the target vertex as preset convex information. determine color information of the target vertex of the road surface model based on the concave-convex information.
7. An electronic device, comprising: The device comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the computer program causes the processor to execute the steps of the model processing method in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The device comprises a computer program, and when the computer program is executed on a processor, the computer program is used to cause the processor to execute the steps of the model processing method in any one of claims 1-5.
Citation Information
Patent Citations
Periphery monitoring device
CN109643439A
Information processing device, information processing method, program and mobile unit
CN110959143A