Arc rendering method with width and computer program product

By calculating the normal vector of the 3D arc as the width extension direction, combining the viewing angle and line segment direction, the 3D arc with bandwidth is rendered, which solves the problems of poor appearance and large calculation amount of 3D arc rendering in the prior art, and improves the rendering efficiency and visual effect.

CN114723864BActive Publication Date: 2025-05-16ALIBABA (CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210112994.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-29
Publication Date
2025-05-16
Estimated Expiration
2042-01-29

AI Technical Summary

Technical Problem

In the prior art, 3D arc rendering with bandwidth has a poor appearance and a large amount of calculation, resulting in low rendering efficiency.

Method used

By determining the first vertex coordinates and the first direction vector of each line segment of the 3D arc, combining the camera position coordinates at the perspective, the normal vector is calculated as the width extension direction, and the line segments of the bandwidth are rendered based on this information, thereby splicing into a 3D arc with bandwidth.

Benefits of technology

It reduces the computing volume of CPU and GPU, saves computing resources, improves the rendering efficiency of 3D arcs, and maintains good visual effects from all perspectives.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114723864B_ABST
    Figure CN114723864B_ABST
Patent Text Reader

Abstract

The disclosed embodiment discloses a method for rendering a 3D arc with width and a computer program product, the method comprising: determining the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc; the line segment has no width; for each line segment, determining the second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates; determining the normal vector of the plane where the first direction vector and the second direction vector are located; for each line segment, using the direction of the normal vector as the width extension direction, and obtaining the line segment with width based on the first vertex coordinates and the width extension direction of the line segment; rendering the 3D arc with width based on the line segment with width. This technical solution can save computing resources and improve rendering efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image technology, and in particular to a method for rendering a 3D arc with width and a computer program product. Background Art

[0002] In the field of map visualization, lines with width are an indispensable rendering type in visualization scenes. Wide line types are roughly divided into three categories: wide lines attached to the land surface, wide lines with curved strips, and wide lines with curved columns. Among them, wide lines attached to the land surface are mainly used to describe data such as roads and navigation lines attached to the land surface; wide lines with curved strips are used to describe virtual aerial trajectories. Since wide lines with curved strips are usually ribbon-shaped and have no thickness, they will lead to poor viewing from a 3D perspective in actual rendering scenes; wide lines with curved columns are an improved form of wide lines with curved strips, which are mainly used to solve the problem of poor viewing of wide lines with curved strips from a 3D perspective. However, the rendering of wide lines with curved columns in the existing technology is either cumbersome and requires a lot of GPU calculations, or the calculations are simple but the 3D viewing is poor and prone to errors. Therefore, how to improve the rendering efficiency of arcs with width and reduce the amount of calculations while ensuring the 3D rendering effect is one of the main problems that need to be solved in this field. Summary of the invention

[0003] Embodiments of the present disclosure provide a method for rendering a 3D arc with width and a computer program product.

[0004] In a first aspect, an embodiment of the present disclosure provides a method for rendering a 3D arc with width, which includes:

[0005] Determine the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc; the line segment has no width;

[0006] For each of the line segments, determine a second direction vector from the camera position coordinates at the viewing angle corresponding to the line segment to the first vertex coordinates;

[0007] Determine a normal vector of a plane where the first direction vector and the second direction vector are located;

[0008] For each of the line segments, taking the direction of the normal vector as a width extension direction, and obtaining a line segment with width based on the first vertex coordinates of the line segment and the width extension direction;

[0009] Based on the line segment to be widened, the 3D arc with width is rendered.

[0010] Furthermore, the first direction vector is a direction vector of the line segment from the starting point to the end point, and determining the normal vector of the plane where the first direction vector and the second direction vector are located includes:

[0011] The normal vector is obtained by cross-multiplying the first direction vector and the second direction vector.

[0012] Further, for each of the line segments, the direction of the normal vector is used as a width extension direction, and a line segment with width is obtained based on the first vertex coordinates of the line segment and the width extension direction, including:

[0013] For each of the line segments, the two first vertex coordinates of the line segment are translated by a preset distance along the positive direction and the negative direction of the normal vector respectively to obtain four second vertex coordinates; the preset distance is half the width of the 3D arc;

[0014] Determine the four second vertex coordinates as vertex coordinates of two triangles that are spliced ​​to form the line segment with width, so as to render the two triangles;

[0015] Rendering the 3D arc with width based on the line segment with width includes:

[0016] For each of the line segments, two corresponding triangles are rendered based on the vertex coordinates of the two triangles, thereby obtaining the 3D arc with width.

[0017] Further, determining the four second vertex coordinates as vertex coordinates of two triangles that are spliced ​​to form the line segment with width, so as to render the two triangles, includes:

[0018] For each of the line segments, determine the vertical distance from each pixel point in the triangle to the side where the first vertex coordinates are located away from one end of the viewing angle;

[0019] The pixels are colored with different transparency levels based on the vertical distance.

[0020] Further, for each of the line segments, determining a vertical distance from each pixel point in the triangle to the side where the first vertex coordinates are located away from one end of the viewing angle includes:

[0021] determining the actual geographic distance of the line segment;

[0022] The vertical distance corresponding to each pixel point in the triangle is determined based on the actual geographic distance.

[0023] Furthermore, before determining the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc, the method further includes:

[0024] Obtaining the starting point coordinates, the ending point coordinates and the radian of the 3D arc with width;

[0025] Determine an arc segment from the starting point coordinates to the ending point coordinates, and the arc is consistent with the arc of the 3D arc; the arc segment has no width;

[0026] The arc segment is divided into a plurality of line segments.

[0027] In a second aspect, an embodiment of the present invention provides a map rendering method, which includes:

[0028] Get map rendering data;

[0029] When rendering a map based on the map rendering data, a virtual aerial track is rendered on the map based on the arc rendering method with width described in the first aspect.

[0030] In a third aspect, an embodiment of the present invention provides a 3D arc rendering device with width, which includes: a CPU and a GPU;

[0031] The CPU determines the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc, and transmits the first vertex coordinates and the first direction vector to the GPU; the line segment has no width;

[0032] The GPU determines, for each of the line segments, a second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates, and determines a normal vector of the plane where the first direction vector and the second direction vector are located; and the GPU also uses, for each of the line segments, the direction of the normal vector as a width extension direction, obtains a line segment with width based on the first vertex coordinates of the line segment and the width extension direction, and renders the 3D arc with width based on the line segment to be widened.

[0033] In a fourth aspect, an embodiment of the present invention provides a 3D arc rendering device with width, comprising:

[0034] A first determination module is configured to determine the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc; the line segment has no width;

[0035] A second determination module is configured to determine, for each of the line segments, a second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates;

[0036] A third determination module is configured to determine a normal vector of a plane where the first direction vector and the second direction vector are located;

[0037] An extension module is configured to, for each of the line segments, use the direction of the normal vector as a width extension direction, and obtain a line segment with width based on the first vertex coordinates of the line segment and the width extension direction;

[0038] The rendering module is configured to render the 3D arc with width based on the line segment to be widened.

[0039] The functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the functions.

[0040] In one possible design, the structure of the above-mentioned device includes a memory and a processor, the memory is used to store one or more computer instructions that support the above-mentioned device to execute the above-mentioned corresponding method, and the processor is configured to execute the computer instructions stored in the memory. The above-mentioned device may also include a communication interface for the above-mentioned device to communicate with other devices or communication networks.

[0041] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method described in any one of the above aspects.

[0042] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium for storing computer instructions used by any of the above-mentioned devices, and when the computer instructions are executed by a processor, they are used to implement the method described in any of the above-mentioned aspects.

[0043] In a seventh aspect, an embodiment of the present disclosure provides a computer program product, which includes computer instructions, and when the computer instructions are executed by a processor, they are used to implement the method described in any of the above aspects.

[0044] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0045] In the process of rendering a 3D arc with width, the disclosed embodiment calculates the first vertex coordinates and the first direction vector of the line segments without width that constitute the 3D arc, determines the second direction vector to the first vertex coordinates of each line segment according to the camera position coordinates under the viewing angle corresponding to the line segment, and then uses the first direction vector and the normal vector of the plane determined by the first direction vector as the width extension direction, and renders along the direction of the line segment and the width extension direction to obtain a line segment with width, so that all the line segments with width are spliced ​​and displayed as a 3D arc with width. In the above-mentioned method of the embodiment of the present disclosure, since the camera position coordinates and the direction of the line segment itself are used to determine the width extension direction of each line segment constituting the 3D arc, without the need to adopt a complex perspective conversion algorithm, the calculation amount of the CPU and GPU can be reduced, computing resources can be saved, and the rendering efficiency of the 3D arc can be improved; in addition, since the CPU only needs to calculate the vertex coordinates and direction vector of the line segment, and the GPU calculates the width extension direction based on the vertex coordinates, direction vector and direction vector from the camera position coordinates to the vertex coordinates of the line segment, the CPU does not need to pass additional or repeated calculation data to the GPU during the entire calculation process. Therefore, compared with the prior art in which the CPU needs to pass repeated line segment vertex coordinates to the GPU, the calculation amount is further reduced, computing resources are saved, and the rendering efficiency of the 3D arc is improved.

[0046] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Other features, objectives and advantages of the present disclosure will become more apparent through the following detailed description of non-limiting embodiments in conjunction with the accompanying drawings. In the accompanying drawings:

[0048] Figure 1 A flowchart showing a method for rendering a 3D arc with width according to an embodiment of the present disclosure is shown;

[0049] Figure 2(a)-Figure 2(b) A schematic diagram showing the width extension direction and two triangles spliced ​​into a line segment with width according to an embodiment of the present disclosure;

[0050] Figure 3 A schematic diagram showing the vertical distance from a pixel point in a triangle to the side where the first vertex coordinates are located according to an embodiment of the present disclosure;

[0051] Figure 4 A flowchart showing a map rendering method according to an embodiment of the present disclosure is shown;

[0052] Figure 5 A structural block diagram of a 3D arc rendering device with width according to an embodiment of the present disclosure is shown;

[0053] Figure 6 A display effect diagram of a 3D arc with width in a map rendering scene according to an embodiment of the present disclosure is shown;

[0054] Figure 7 It is a structural schematic diagram of an electronic device suitable for implementing the method for 3D arc rendering and / or map rendering with width according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0055] Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. In addition, for the sake of clarity, parts not related to the description of the exemplary embodiments are omitted in the accompanying drawings.

[0056] In the present disclosure, it should be understood that terms such as "include" or "have" are intended to indicate the presence of features, numbers, steps, behaviors, components, parts, or a combination thereof disclosed in the specification, and do not exclude the possibility that one or more other features, numbers, steps, behaviors, components, parts, or a combination thereof exist or are added.

[0057] It should also be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0058] In the prior art, the solutions for drawing 3D arcs with width mainly include the following:

[0059] The drawing process of the first solution is as follows:

[0060] 1. The CPU calculates the direction vector of the line segments that make up the arc segment, and then calculates the cross product of the direction vector and the vertical direction vector of the earth to obtain the line segment normal vector.

[0061] 2. The normal vector is passed to the GPU, and the coordinates of the triangle vertices extending along this normal vector are calculated in the vertex shader of the GPU.

[0062] 3. Based on the triangle vertices, the GPU draws the triangle and obtains an arc with width.

[0063] Although the first solution can be calculated, the rendering effect is poor, and it is easy for the width to be invisible from the sensory point of view. In addition, it is impossible to render the animation rendering effect and dotted line rendering effect of the arc with width through this solution.

[0064] The drawing process of the second solution is as follows:

[0065] 1. The CPU calculates the angle bisectors of the two line segments before and after each triangle point, and calculates the normal vector of each angle bisector.

[0066] 2. The CPU passes the normal vector of each angle bisector to the GPU.

[0067] 3. The GPU calculates the MVP matrix transformation of each angle bisector and obtains the two-dimensional direction vector of this direction vector mapped on the screen in 2D.

[0068] 4. The GPU uses the two-dimensional direction vector to calculate the actual vertex position of the line width according to the line width, and then draws an arc with width based on the vertex position.

[0069] In the second solution, since MVP matrix conversion is required, the GPU calculation amount is large, and it is easy to lose the width at the top of the arc, resulting in poor 3D perception.

[0070] Based on the above defects in the prior art, the embodiment of the present disclosure proposes a method for rendering 3D arcs with width, which can be implemented in WebGL to render 3D arcs with width, and the method includes: determining the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc; the line segment has no width; for each line segment, determining the second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates; determining the normal vector of the plane where the first direction vector and the second direction vector are located; for each line segment, using the direction of the normal vector as the width extension direction, obtaining the line segment with width based on the first vertex coordinates and the width extension direction of the line segment, and rendering the 3D arc with width based on the line segment to be width. This method of the embodiment of the present disclosure is relatively simple to calculate, and by adding the known camera position coordinates to the calculation process, the sensory effect of the 3D arc with width is improved without requiring a lot of calculations.

[0071] The details of the embodiments of the present disclosure are described in detail below through specific examples.

[0072] Figure 1 FIG. 4 is a flow chart showing a method for rendering a 3D arc with width according to an embodiment of the present disclosure. Figure 1 As shown, the 3D arc rendering method with width includes the following steps:

[0073] In step S101, the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc are determined; the line segment has no width;

[0074] In step S102, for each of the line segments, a second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates is determined;

[0075] In step S103, determining the normal vector of the plane where the first direction vector and the second direction vector are located;

[0076] In step S104, for each of the line segments, the direction of the normal vector is used as a width extension direction, and a line segment with width is obtained based on the first vertex coordinates of the line segment and the width extension direction;

[0077] In step S105, based on the line segment to be widened, the 3D arc with width is rendered.

[0078] In this embodiment, the 3D arc is an arc with altitude in a 3D scene, which is usually used to describe air routes in the field of electronic map rendering. A wide line is a line with width. In the WebGL (Web Graphics Library) drawing protocol, since it does not support rendering of lines with width, a triangle solution is usually used to construct the width, that is, a line with width is rendered by splicing two triangles.

[0079] In the disclosed embodiment, in the process of rendering a 3D arc with width based on WebGL, a 3D arc with width between two points is split into multiple line segments with width and spliced ​​together to finally form a 3D arc with width, and each line segment with width is spliced ​​using two triangles. Therefore, when rendering the 3D arc with width, it is necessary to determine the vertex coordinates of the two triangles in each line segment with width that constitutes the 3D arc, and then each line segment with width that constitutes the 3D arc can be rendered based on the vertex coordinates of the two triangles.

[0080] In order to determine the vertex coordinates of the triangle mentioned above, we can first determine the arc segment without width corresponding to the 3D arc based on the two end points of the 3D arc, that is, the starting point and the ending point of the 3D arc (the starting point and the ending point can be the midpoints of the two end edges of the 3D arc with width), and the curvature of the 3D arc or the coordinates of the highest point of the 3D arc. The length and curvature of the arc segment without width are consistent with those of the 3D arc with width. The arc segment without width can be regarded as the central arc of the 3D arc with width.

[0081] After the above-mentioned arc segment without width is determined based on the two endpoints and the curvature of the 3D arc (or the coordinates of the highest point of the arc), the arc segment without curvature can be divided into multiple line segments. The length of each line segment can be set based on the GPU rendering capability used for rendering the image or other actual needs, and no specific restrictions are made here.

[0082] After determining the multiple line segments after division, the first vertex coordinates of each line segment can also be determined. Each line segment has two first vertex coordinates. Since the 3D arc to be rendered is a line segment with curvature, and the corresponding arc segment without width is also curvature, the directions of the multiple line segments obtained by dividing the arc segment without width are not necessarily the same, so it is also necessary to determine the direction vector of each line segment. The direction vector can be determined based on the two first vertex coordinates of the line segment.

[0083] For each line segment, the second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates of the line segment can also be calculated. Since each line segment has two first vertex coordinates, two second direction vectors can be calculated. The viewing angle and camera position coordinates at the displayed position of the line segment are pre-set values.

[0084] Based on the first direction vector and the corresponding second direction vector of the same line segment, a plane can be determined, and the normal vector of the plane can be determined as the width extension direction of the 3D arc. Then, the GPU can render from one first vertex coordinate of the line segment to another first vertex coordinate in the width extension direction. After all line segments are rendered in the above manner, a 3D arc with width can be obtained. Moreover, since the width extension direction of the 3D arc is obtained based on the viewing angle at the rendered position of the line segment and the direction of the line segment (that is, the first direction vector), and the width extension direction is always perpendicular to the viewing angle and the direction of the line segment, the rendered 3D arc can always see the extended width at all viewing angles, and the situation where the arc width cannot be seen at certain viewing angles will not occur.

[0085] Figure 2(a)-Figure 2(b) A schematic diagram showing the width extension direction and two triangles spliced ​​into a line segment with width according to an embodiment of the present disclosure. As shown in FIG2(a), for the line segment P0P1, its first vertex coordinates are P0 and P1 respectively. Taking vertex P1 as an example, the normal vector n is perpendicular to the line segment, and two vertices P0′ and P0″ are obtained after extending the preset distances along the positive direction n and negative direction -n of the normal vector respectively. Similarly, for another first vertex coordinate P, after deriving the preset distances along the positive direction n and negative direction -n of the normal vector respectively, two vertices P1′ and P1″ are obtained.

[0086] As shown in FIG. 2( b ), after obtaining the vertices P0′, P0″, P1′ and P1″, it can be determined that the two triangles that can be spliced ​​into a line segment of the band width are ΔP0′P0″P1′ and ΔP1″P0″P1′.

[0087] In the process of rendering a 3D arc with width, the disclosed embodiment calculates the first vertex coordinates and the first direction vector of the line segments without width that constitute the 3D arc, determines the second direction vector to the first vertex coordinates of each line segment according to the camera position coordinates under the viewing angle corresponding to the line segment, and then uses the first direction vector and the normal vector of the plane determined by the first direction vector as the width extension direction, and renders along the direction of the line segment and the width extension direction to obtain a line segment with width, so that all the line segments with width are spliced ​​and displayed as a 3D arc with width. In the above-mentioned method of the embodiment of the present disclosure, since the camera position coordinates and the direction of the line segment itself are used to determine the width extension direction of each line segment constituting the 3D arc, without the need to adopt a complex perspective conversion algorithm, the calculation amount of the CPU and GPU can be reduced, computing resources can be saved, and the rendering efficiency of the 3D arc can be improved; in addition, since the CPU only needs to calculate the vertex coordinates and direction vector of the line segment, and the GPU calculates the width extension direction based on the vertex coordinates, direction vector and direction vector from the camera position coordinates to the vertex coordinates of the line segment, the CPU does not need to pass additional or repeated calculation data to the GPU during the entire calculation process. Therefore, compared with the prior art in which the CPU needs to pass repeated line segment vertex coordinates to the GPU, the calculation amount is further reduced, computing resources are saved, and the rendering efficiency of the 3D arc is improved.

[0088] In an optional implementation of this embodiment, the first direction vector is a direction vector of the line segment from the starting point to the end point, and step S103, i.e., the step of determining the normal vector of the plane where the first direction vector and the second direction vector are located, further includes the following steps:

[0089] The normal vector is obtained by cross-multiplying the first direction vector and the second direction vector.

[0090] In this optional implementation, the normal vector of the plane defined by the first direction vector and the second direction vector can be obtained by cross-producting the first direction vector and the second direction vector, and the normal vector is always perpendicular to the first direction vector and the second direction vector, and the first direction vector is the line segment direction, and the second direction vector is the viewing direction, so the normal vector is always perpendicular to the viewing direction and the line segment direction. Therefore, the width of the 3D arc rendered based on the normal vector as the width extension direction can be displayed at all positions.

[0091] In an optional implementation of this embodiment, step S104, i.e., for each of the line segments, taking the direction of the normal vector as the width extension direction, and obtaining a line segment with width based on the first vertex coordinates of the line segment and the width extension direction, further includes the following steps:

[0092] For each of the line segments, the two first vertex coordinates of the line segment are translated by a preset distance along the positive direction and the negative direction of the normal vector respectively to obtain four second vertex coordinates; the preset distance is half the width of the 3D arc;

[0093] Determine the four second vertex coordinates as vertex coordinates of two triangles that are spliced ​​to form the line segment with width, so as to render the two triangles;

[0094] Step S105, i.e., the step of rendering the 3D arc with width based on the line segment with width, further comprises the following steps:

[0095] For each of the line segments, two corresponding triangles are rendered based on the vertex coordinates of the two triangles, thereby obtaining the 3D arc with width.

[0096] In this optional implementation, for each line segment, after determining the four second vertex coordinates of the corresponding line segment with width, since the line segment with width is rendered in the GPU through two spliced ​​triangles, the GPU can determine the actual vertex coordinates of the triangle to be rendered based on the four vertex coordinates, and then render two spliced ​​triangles according to the vertex coordinates of the two triangles. From a sensory perspective, the two spliced ​​triangles form a line segment with width, and the line segment with width is part of the 3D arc with width to be rendered. After the line segments with width corresponding to all line segments are rendered, the 3D arc with width that has been rendered can be seen from a sensory perspective.

[0097] In an optional implementation of this embodiment, the step of determining the four second vertex coordinates as vertex coordinates of two triangles that are spliced ​​to form the line segment with width, so as to render the two triangles, further includes the following steps:

[0098] For each of the line segments, determine the vertical distance from each pixel point in the triangle to the side where the first vertex coordinates are located away from one end of the viewing angle;

[0099] The pixel is colored with different transparency levels based on the vertical distance and / or the first vertex coordinates of the line segment.

[0100] In this optional implementation, in order to achieve animation rendering effects and dotted line rendering effects, the GPU can render different pixels into different transparencies in each rendering process.

[0101] In some embodiments, in order to achieve an animation rendering effect, such as gradually rendering an arc with width from near to far in the viewing angle, the GPU can determine the transparency of the pixel based on the relative position of the pixel in the 3D arc, and then shade and render the pixel based on the transparency. For example, the distance between the pixel and the viewing angle can be determined based on the relative position of the pixel in the 3D arc. In the rendering process, the pixels closer to the viewing angle can be rendered as points with lower transparency, while the pixels farther away can be rendered as points with higher transparency. As the number of rendering times increases, the pixels farther away are slowly rendered as points with lower transparency. In this way, the animation effect of displaying a 3D arc with width from near to far can be achieved.

[0102] In the above embodiment, the relative position of a pixel point in a 3D arc can be determined based on the vertical distance of the pixel point from the edge of the first vertex coordinate of the line segment far away from the viewing angle and the relative position of the line segment in the 3D arc, and the relative position of the line segment in the 3D arc can be determined based on the first vertex coordinate of the line segment.

[0103] In other embodiments, a dotted line rendering effect of a 3D arc with width can also be achieved. In order to achieve the dotted line rendering effect, the GPU can render the pixel points at one end of each line segment as completely transparent or with a higher transparency, and render the other pixel points as opaque or with a lower transparency. Therefore, the vertical distance from the pixel point to the side where the first vertex coordinate at one end of the line segment is located can be determined first, and the required transparency of the pixel point can be determined based on the vertical distance, and then rendering can be performed based on the transparency of the pixel point.

[0104] In the above manner, the animation rendering effect of the arc with width and the dotted line rendering effect can be realized in WebGL.

[0105] Figure 3 FIG. 1 is a schematic diagram showing the vertical distance from a pixel point in a triangle to the side where the first vertex coordinates are located according to an embodiment of the present disclosure. Figure 3 As shown in the figure, if the pixel point x is any pixel point in the triangle, the first vertex coordinates are P0 and P1 respectively, and the viewing angle is at the position of the eye pattern, then P0 is the first vertex coordinate away from the viewing angle, and the vertical distance from the pixel point x to the side where P0 is located is shown as the line segment L in the figure. In an optional implementation of this embodiment, for each of the line segments, the step of determining the vertical distance from each pixel point in the triangle to the side where the first vertex coordinate is located away from one end of the viewing angle further includes the following steps:

[0106] determining the actual geographic distance of the line segment;

[0107] The vertical distance corresponding to each pixel point in the triangle is determined based on the actual geographic distance.

[0108] In this optional implementation, in the map rendering application scenario, the actual geographic distance can be used as a ruler to determine the vertical distance from the pixel point to the side where the first vertex coordinate of the line segment is located. Since the endpoint coordinates of the 3D arc with width are in the map rendering scenario, the first vertex coordinates of the line segment can also be geographic coordinates. In order to determine the above vertical distance corresponding to the pixel point, the actual geographic distance can also be used to determine it.

[0109] In an optional implementation of this embodiment, before step S101, i.e. the step of determining the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc, the method further includes the following steps:

[0110] Obtaining the starting point coordinates, the ending point coordinates and the radian of the 3D arc with width;

[0111] Determine an arc segment from the starting point coordinates to the ending point coordinates, and the arc is consistent with the arc of the 3D arc; the arc segment has no width;

[0112] The arc segment is divided into a plurality of line segments.

[0113] In this optional implementation, in the process of rendering a 3D arc with width based on WebGL, a 3D arc with width between two points is split into multiple line segments with width and spliced ​​together to finally form a 3D arc with width, and each line segment with width is spliced ​​using two triangles. Therefore, when rendering the 3D arc with width, it is necessary to determine the vertex coordinates of the two triangles in each line segment with width that constitutes the 3D arc, and then each line segment with width that constitutes the 3D arc can be rendered based on the vertex coordinates of the two triangles.

[0114] In order to determine the vertex coordinates of the triangle mentioned above, we can first determine the arc segment without width corresponding to the 3D arc based on the two end points of the 3D arc, that is, the starting point and the ending point of the 3D arc (the starting point and the ending point can be the midpoints of the two end edges of the 3D arc with width), and the curvature of the 3D arc (the curvature can be directly specified by the user or other rendering objects or determined based on the specified coordinates of the highest point of the 3D arc). The length and curvature of the arc segment without width are consistent with those of the 3D arc with width, and the arc segment without width can be regarded as the central arc of the 3D arc with width.

[0115] After the above-mentioned arc segment without width is determined based on the two endpoints and the curvature of the 3D arc (or the coordinates of the highest point of the arc), the arc segment without curvature can be divided into multiple line segments. The length of each line segment can be set based on the GPU rendering capability used for rendering the image or other actual needs, and no specific restrictions are made here.

[0116] Figure 4 FIG. 1 is a flowchart of a map rendering method according to an embodiment of the present disclosure. Figure 3 As shown, the map rendering method includes the following steps:

[0117] In step S401, map rendering data is obtained;

[0118] In step S402, when rendering a map based on the map rendering data, a virtual aerial track is rendered on the map based on the 3D arc rendering method with width.

[0119] In this embodiment, in the map rendering process, 3D arcs with width are usually used to describe air routes. Therefore, in the map rendering process that requires rendering air routes, the map rendering data can be obtained first, and then when the map is rendered using the map rendering data, the air routes can be rendered based on the above-mentioned 3D arc rendering method with width after the map rendering is completed, or together with the map rendering. The coordinates of the two end points of the 3D arc can be the coordinates on the map, so the coordinates of the first vertex of each segment after division can also be the coordinates on the map. For specific details, please refer to the above description of the 3D arc rendering method with width, which will not be repeated here.

[0120] Figure 5 FIG. 2 shows a block diagram of a 3D arc rendering device with width according to an embodiment of the present disclosure. Figure 5 As shown, the 3D arc rendering device with width includes: a CPU 501 and a GPU 502;

[0121] The CPU 501 determines the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc, and transmits the first vertex coordinates and the first direction vector to the GPU 502; the line segment has no width;

[0122] The GPU 502 determines, for each of the line segments, a second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates, and determines a normal vector of the plane where the first direction vector and the second direction vector are located; and the GPU 502 also uses, for each of the line segments, the direction of the normal vector as a width extension direction, obtains a line segment with width based on the first vertex coordinates of the line segment and the width extension direction, and renders the 3D arc with width based on the line segment to be widened.

[0123] In this embodiment, the 3D arc is an arc with altitude in a 3D scene, which is usually used to describe air routes in the field of electronic map rendering. A wide line is a line with width. In the WebGL (Web Graphics Library) drawing protocol, since it does not support rendering of lines with width, a triangle solution is usually used to construct the width, that is, a line with width is rendered by splicing two triangles.

[0124] In the disclosed embodiment, in the process of rendering a 3D arc with width based on WebGL, a 3D arc with width between two points is split into multiple line segments with width and spliced ​​together to finally form a 3D arc with width, and each line segment with width is spliced ​​using two triangles. Therefore, when rendering the 3D arc with width, it is necessary to determine the vertex coordinates of the two triangles in each line segment with width that constitutes the 3D arc, and then the GPU 502 can render each line segment with width that constitutes the 3D arc based on the vertex coordinates of the two triangles.

[0125] In order to determine the vertex coordinates of the triangle mentioned above, in this embodiment, CPU 501 can first determine the arc segment without width corresponding to the 3D arc based on the two end points of the 3D arc, that is, the starting point and the ending point of the 3D arc (the starting point and the ending point can be the midpoints of the two end edges of the 3D arc with width), and the curvature of the 3D arc or the coordinates of the highest point of the 3D arc. The length and curvature of the arc segment without width are consistent with those of the 3D arc with width, and the arc segment without width can be regarded as the central arc of the 3D arc with width.

[0126] After the above-mentioned arc segment without width is determined based on the two endpoints and the curvature of the 3D arc (or the coordinates of the highest point of the arc), the arc segment without curvature can be divided into multiple line segments. The length of each line segment can be set based on the rendering capability of the GPU 502 or other actual needs, and no specific restrictions are made here.

[0127] After determining the multiple line segments after division, the CPU 501 can also determine the first vertex coordinates of each line segment, and each line segment has two first vertex coordinates. Since the 3D arc to be rendered is a line segment with curvature, and the corresponding arc segment without width is also curvature, the directions of the multiple line segments obtained by dividing the arc segment without width are not necessarily the same, so the CPU 501 can also determine the first direction vector of each line segment. The first direction vector can be determined based on the two first vertex coordinates of the line segment.

[0128] The CPU 501 transmits the calculated first vertex coordinates and first direction vector of each line segment to the GPU 502 .

[0129] For each line segment, the GPU 502 can calculate the second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates of the line segment. Since each line segment has two first vertex coordinates, two second direction vectors can be calculated. The viewing angle and camera position coordinates at the displayed position of the line segment are preset values.

[0130] Based on the first direction vector and the corresponding second direction vector of the same line segment, a plane can be determined, and the normal vector of the plane can be determined as the width extension direction of the 3D arc. Then, GPU 502 can render from one first vertex coordinate of the line segment to another first vertex coordinate in the width extension direction. After all line segments are rendered in the above manner, a 3D arc with width can be obtained. Moreover, since the width extension direction of the 3D arc is obtained based on the viewing angle at the rendered position of the line segment and the direction of the line segment (that is, the first direction vector), and the width extension direction is always perpendicular to the viewing angle and the direction of the line segment, the rendered 3D arc can always be seen with an extended width at all viewing angles, and the situation where the arc width cannot be seen at certain viewing angles will not occur.

[0131] In the process of rendering a 3D arc with width in the embodiment of the present disclosure, the CPU calculates the first vertex coordinates and the first direction vector of the line segments without width that constitute the 3D arc, and transmits the calculated first vertex coordinates and the first direction vector to the GPU, which determines the second direction vector to the first vertex coordinates of each line segment based on the camera position coordinates under the viewing angle corresponding to the line segment, and then uses the first direction vector and the normal vector of the plane determined by the first direction vector as the width extension direction, and renders along the direction of the line segment and the width extension direction to obtain a line segment with width, so that all the line segments with width are spliced ​​and displayed as a 3D arc with width. In the above-mentioned method of the embodiment of the present disclosure, since the camera position coordinates and the direction of the line segment itself are used to determine the width extension direction of each line segment constituting the 3D arc, without the need to adopt a complex perspective conversion algorithm, the calculation amount of the CPU and GPU can be reduced, computing resources can be saved, and the rendering efficiency of the 3D arc can be improved; in addition, since the CPU only needs to calculate the vertex coordinates and direction vector of the line segment, and the GPU calculates the width extension direction based on the vertex coordinates, direction vector and direction vector from the camera position coordinates to the vertex coordinates of the line segment, the CPU does not need to pass additional or repeated calculation data to the GPU during the entire calculation process. Therefore, compared with the prior art in which the CPU needs to pass repeated line segment vertex coordinates to the GPU, the calculation amount is further reduced, computing resources are saved, and the rendering efficiency of the 3D arc is improved.

[0132] In an optional implementation of this embodiment, the GPU 502 obtains the normal vector by cross-multiplying the first direction vector and the second direction vector.

[0133] In this optional implementation, the normal vector of the plane defined by the first direction vector and the second direction vector can be obtained by cross-producting the first direction vector and the second direction vector, and the normal vector is always perpendicular to the first direction vector and the second direction vector, and the first direction vector is the line segment direction, and the second direction vector is the viewing direction, so the normal vector is always perpendicular to the viewing direction and the line segment direction. Therefore, the width of the 3D arc rendered based on the normal vector as the width extension direction can be displayed at all positions.

[0134] In an optional implementation of the present embodiment, the GPU 502 translates the two first vertex coordinates of each line segment by a preset distance along the positive and negative directions of the normal vector respectively to obtain four second vertex coordinates; the preset distance is half the width of the 3D arc; the GPU 502 also determines the four second vertex coordinates as the vertex coordinates of two triangles that are spliced ​​to form the line segment with width, and then renders the two triangles.

[0135] In this optional implementation, for each line segment, after determining the four second vertex coordinates of the corresponding line segment with width, since GPU 502 supports rendering line segments with width by two spliced ​​triangles, GPU 502 can determine the actual vertex coordinates of the triangle to be rendered based on the four vertex coordinates, and then render two spliced ​​triangles according to the vertex coordinates of the two triangles. From a sensory perspective, the two spliced ​​triangles form a line segment with width, and the line segment with width is a part of the 3D arc with width to be rendered. After the line segments with width corresponding to all line segments are rendered, the 3D arc with width that has been rendered can be seen from a sensory perspective.

[0136] In an optional implementation of this embodiment, GPU 502 determines, for each of the line segments, a vertical distance from each pixel point in the triangle to the side where the first vertex coordinates are located away from one end of the viewing angle, and GPU 502 also colors the pixels with different levels of transparency based on the vertical distance and / or the first vertex coordinates of the line segment.

[0137] In this optional implementation, in order to achieve animation rendering effects and dashed line rendering effects, the GPU 502 may render different pixels into different transparencies in each rendering process.

[0138] In some embodiments, in order to achieve an animation rendering effect, such as gradually rendering an arc with width from near to far in the viewing angle, GPU 502 can determine the transparency of the pixel based on the relative position of the pixel in the 3D arc, and then shade and render the pixel based on the transparency. For example, the distance between the pixel and the viewing angle can be determined based on the relative position of the pixel in the 3D arc. In the rendering process, the pixel closer to the viewing angle can be rendered as a point with lower transparency, while the pixel farther away can be rendered as a point with higher transparency. As the number of rendering times increases, the pixel farther away can be slowly rendered as a point with lower transparency. In this way, the animation effect of displaying a 3D arc with width from near to far can be achieved.

[0139] In the above embodiment, the relative position of a pixel point in a 3D arc can be determined based on the vertical distance of the pixel point from the edge of the first vertex coordinate of the line segment far away from the viewing angle and the relative position of the line segment in the 3D arc, and the relative position of the line segment in the 3D arc can be determined based on the first vertex coordinate of the line segment.

[0140] In other embodiments, a dotted line rendering effect of a 3D arc with width can also be achieved. In order to achieve the dotted line rendering effect, the GPU 502 can render the pixel points at one end of each line segment as completely transparent or with a higher transparency, and render the other pixel points as opaque or with a lower transparency. Therefore, the vertical distance from the pixel point to the side where the first vertex coordinate at one end of the line segment is located can be determined first, and the required transparency of the pixel point can be determined based on the vertical distance, and then rendering can be performed based on the transparency of the pixel point.

[0141] In the above manner, the animation rendering effect of the arc with width and the dotted line rendering effect can be realized in WebGL.

[0142] In an optional implementation of this embodiment, the GPU 502 may determine the actual geographic distance of the line segment, and determine the vertical distance corresponding to each pixel point in the triangle based on the actual geographic distance.

[0143] In this optional implementation, in a map rendering application scenario, the GPU 502 may use the actual geographic distance as a scale to determine the vertical distance from the pixel to the side where the first vertex coordinate of the line segment is located. Since the endpoint coordinates of the 3D arc with width are in geographic coordinates in the map rendering scenario, the first vertex coordinates of the line segment may also be geographic coordinates. In order to determine the vertical distance corresponding to the pixel, the actual geographic distance may also be used to determine it.

[0144] In an optional implementation of the present embodiment, the CPU 501 obtains the starting point coordinates, the ending point coordinates and the curvature of the 3D arc with width, and determines an arc segment from the starting point coordinates to the ending point coordinates and whose curvature is consistent with the curvature of the 3D arc, and divides the arc segment into multiple line segments; the arc segment does not have width.

[0145] In this optional implementation, in the process of rendering a 3D arc with width based on WebGL, GPU 502 splits a 3D arc with width between two points into multiple line segments with width and then splices them to finally form a 3D arc with width, and each line segment with width is rendered by splicing two triangles. Therefore, when rendering the 3D arc with width, GPU 502 can determine the vertex coordinates of the two triangles in each line segment with width that constitutes the 3D arc, and then can render each line segment with width that constitutes the 3D arc based on the vertex coordinates of the two triangles.

[0146] In order to determine the vertex coordinates of the triangle mentioned above, CPU 501 can determine the arc segment without width corresponding to the 3D arc based on the two end points of the 3D arc, that is, the starting point and the ending point of the 3D arc (the starting point and the ending point can be the midpoints of the two end edges of the 3D arc with width), and the curvature of the 3D arc (the curvature can be directly specified by the user or other rendering objects or determined based on the specified coordinates of the highest point of the 3D arc). The length and curvature of the arc segment without width are consistent with those of the 3D arc with width, and the arc segment without width can be regarded as the central arc of the 3D arc with width.

[0147] After determining the above-mentioned arc segment without width based on the two endpoints and the curvature of the 3D arc (or the coordinates of the highest point of the arc), the CPU 501 can divide the arc segment without curvature into multiple line segments. The length of each line segment can be set based on the rendering capability of the GPU 502 used for rendering the image or other actual needs, and no specific restrictions are made here.

[0148] Figure 6 FIG. 4 shows a display effect diagram of a 3D arc with width in a map rendering scene according to an embodiment of the present disclosure. Figure 6 As shown, the 3D arc with width rendered by the method proposed in the embodiment of the present disclosure can show its width at each display position, and also achieves a dotted line rendering effect.

[0149] The following are embodiments of the apparatus of the present disclosure, which can be used to execute embodiments of the method of the present disclosure.

[0150] According to an embodiment of the present disclosure, a 3D arc rendering device with width can be implemented as part or all of an electronic device through software, hardware, or a combination of both. The 3D arc rendering device with width includes:

[0151] A first determination module is configured to determine the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc; the line segment has no width;

[0152] A second determination module is configured to determine, for each of the line segments, a second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates;

[0153] A third determination module is configured to determine a normal vector of a plane where the first direction vector and the second direction vector are located;

[0154] An extension module is configured to, for each of the line segments, use the direction of the normal vector as a width extension direction, and obtain a line segment with width based on the first vertex coordinates of the line segment and the width extension direction;

[0155] The rendering module is configured to render the 3D arc with width based on the line segment to be widened.

[0156] In an optional implementation of this embodiment, the second determining module includes:

[0157] The cross multiplication submodule is configured to perform a cross multiplication on the first direction vector and the second direction vector to obtain the normal vector.

[0158] In an optional implementation of this embodiment, the extension module includes:

[0159] The translation submodule is configured to translate the two first vertex coordinates of each line segment by a preset distance along the positive direction and the negative direction of the normal vector respectively to obtain four second vertex coordinates; the preset distance is half the width of the 3D arc;

[0160] A first determining submodule is configured to determine the four second vertex coordinates as vertex coordinates of two triangles that are spliced ​​to form the line segment with width;

[0161] The rendering module includes:

[0162] The rendering submodule is configured to render two corresponding triangles for each line segment based on the vertex coordinates of the two triangles, thereby obtaining the 3D arc with width.

[0163] In an optional implementation of this embodiment, the first determining submodule includes:

[0164] A second determination submodule is configured to determine, for each line segment, a vertical distance from each pixel point in the triangle to the side where the first vertex coordinates are located away from one end of the viewing angle;

[0165] The shading submodule is configured to color the pixels with different transparency levels based on the vertical distance.

[0166] In an optional implementation of this embodiment, the second determining submodule includes:

[0167] A third determination submodule is configured to determine the actual geographical distance of the line segment;

[0168] The fourth determination submodule is configured to determine the vertical distance corresponding to each pixel point in the triangle based on the actual geographic distance.

[0169] In an optional implementation of this embodiment, before the first determining module, the device further includes:

[0170] A first acquisition module is configured to acquire the starting point coordinates, the ending point coordinates and the radian of the 3D arc with width;

[0171] A fourth determination module is configured to determine an arc segment from the starting point coordinates to the ending point coordinates, and the arc is consistent with the arc of the 3D arc; the arc segment has no width;

[0172] The dividing module is configured to divide the arc segment into a plurality of line segments.

[0173] The 3D arc rendering device with width in this embodiment corresponds to the 3D arc rendering method with width in the above text. For specific details, please refer to the description of the 3D arc rendering method with width in the above text, which will not be repeated here.

[0174] According to a map rendering device of an embodiment of the present disclosure, the device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. The map rendering device includes:

[0175] A second acquisition module is configured to acquire map rendering data;

[0176] The map rendering module is configured to render a virtual aerial track on the map based on the arc rendering device with width when rendering the map based on the map rendering data.

[0177] The map rendering device in this embodiment corresponds to the map rendering method described above. For specific details, please refer to the description of the map rendering method described above, which will not be repeated here.

[0178] Figure 7 It is a structural schematic diagram of an electronic device suitable for implementing the method for 3D arc rendering and / or map rendering with width according to an embodiment of the present disclosure.

[0179] like Figure 7 As shown, the electronic device 700 includes a processing unit 701, which can be implemented as a processing unit such as a CPU, a GPU, an FPGA, and an NPU. The processing unit 701 can perform various processes in the embodiments of any of the above methods of the present disclosure according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0180] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0181] In particular, according to an embodiment of the present disclosure, any method in the above referenced embodiment of the present disclosure may be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program tangibly contained on a machine-readable medium, and the computer program includes a program code for executing any method in the embodiment of the present disclosure. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 709, and / or installed from a removable medium 711.

[0182] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the road map or block diagram can represent a part of a module, program segment or code, and the part of the module, program segment or code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a different order from the order marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0183] The units or modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The units or modules described may also be arranged in a processor, and the names of these units or modules do not constitute limitations on the units or modules themselves in some cases.

[0184] As another aspect, the present disclosure further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the device described in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into the device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the method described in the present disclosure.

[0185] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.

Claims

1. A method for rendering 3D arcs with width, wherein: include: Determine the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc; wherein the first direction vector is the direction vector of the line segment, and the line segment has no width; For each of the line segments, determine a second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates; wherein the second direction vector is a viewing angle direction vector; Determine a normal vector of a plane where the first direction vector and the second direction vector are located; For each of the line segments, taking the direction of the normal vector as a width extension direction, and obtaining a line segment with width based on the first vertex coordinates of the line segment and the width extension direction; Based on the line segment with width, the 3D arc with width is rendered.

2. The method according to claim 1, wherein: The first direction vector is a direction vector of the line segment from the starting point to the end point, and determining the normal vector of the plane where the first direction vector and the second direction vector are located includes: The normal vector is obtained by cross-multiplying the first direction vector and the second direction vector.

3. The method according to claim 1 or 2, wherein: For each of the line segments, the direction of the normal vector is used as a width extension direction, and a line segment with width is obtained based on the first vertex coordinates of the line segment and the width extension direction, including: For each of the line segments, the two first vertex coordinates of the line segment are translated by a preset distance along the positive direction and the negative direction of the normal vector respectively to obtain four second vertex coordinates; the preset distance is half the width of the 3D arc; Determine the four second vertex coordinates as vertex coordinates of two triangles that are joined to form the line segment with width; Rendering the 3D arc with width based on the line segment with width includes: For each of the line segments, two corresponding triangles are rendered based on the vertex coordinates of the two triangles, thereby obtaining the 3D arc with width.

4. The method according to claim 3, wherein: Determining the four second vertex coordinates as vertex coordinates of two triangles that are concatenated to form the line segment with width, so as to render the two triangles, comprises: For each of the line segments, determine the vertical distance from each pixel point in the triangle to the side where the first vertex coordinates are located away from one end of the viewing angle; The pixels are colored with different transparency levels based on the vertical distance.

5. The method according to claim 4, wherein: For each of the line segments, determining a vertical distance from each pixel point in the triangle to the side where the first vertex coordinates are located away from one end of the viewing angle includes: determining the actual geographic distance of the line segment; The vertical distance corresponding to each pixel point in the triangle is determined based on the actual geographic distance.

6. The method according to any one of claims 1 to 2 and 5, wherein: Before determining the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc, the method further includes: Obtaining the starting point coordinates, the ending point coordinates and the radian of the 3D arc with width; Determine an arc segment from the starting point coordinates to the ending point coordinates, and the arc is consistent with the arc of the 3D arc; the arc segment has no width; The arc segment is divided into a plurality of line segments.

7. A map rendering method, wherein: include: Get map rendering data; When rendering a map based on the map rendering data, a virtual aerial track is rendered on the map based on the arc rendering method with width described in any one of claims 1 to 6.

8. A 3D arc rendering device with width, wherein: include: CPU and GPU; The CPU determines the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc, and transmits the first vertex coordinates and the first direction vector to the GPU; wherein the first direction vector is the direction vector of the line segment, and the line segment has no width; The GPU determines, for each of the line segments, a second direction vector from the camera position coordinates under the viewing angle corresponding to the line segment to the first vertex coordinates, and determines a normal vector of a plane where the first direction vector and the second direction vector are located; wherein the second direction vector is a viewing angle direction vector; Furthermore, the GPU uses the direction of the normal vector as the width extension direction for each of the line segments, obtains a line segment with width based on the first vertex coordinates of the line segment and the width extension direction, and renders the 3D arc with width based on the line segment with width.

9. A computer-readable storage medium having computer instructions stored thereon, wherein: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer program product comprising computer instructions, wherein: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Navigation road surface generation method and system

    CN107481300A

  • A map road rendering method and device

    CN109598672A