CN114723864A - Arc rendering method of bandwidth and computer program product - Google Patents

Arc rendering method of bandwidth and computer program product Download PDF

Info

Publication number
CN114723864A
CN114723864A CN202210112994.0A CN202210112994A CN114723864A CN 114723864 A CN114723864 A CN 114723864A CN 202210112994 A CN202210112994 A CN 202210112994A CN 114723864 A CN114723864 A CN 114723864A
Authority
CN
China
Prior art keywords
arc
line segment
width
rendering
line
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210112994.0A
Other languages
Chinese (zh)
Inventor
吴康宁
杜萌萌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Alibaba China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Priority to CN202210112994.0A priority Critical patent/CN114723864A/en
Publication of CN114723864A publication Critical patent/CN114723864A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/05Geographic models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/20Finite element generation, e.g. wire-frame surface description, tesselation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T19/00Manipulating 3D models or images for computer graphics
    • G06T19/20Editing of 3D images, e.g. changing shapes or colours, aligning objects or positioning parts
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/66Analysis of geometric attributes of image moments or centre of gravity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2219/00Indexing scheme for manipulating 3D models or images for computer graphics
    • G06T2219/20Indexing scheme for editing of 3D models
    • G06T2219/2016Rotation, translation, scaling

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Computer Graphics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Remote Sensing (AREA)
  • Architecture (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The embodiment of the disclosure discloses a 3D arc rendering method with width and a computer program product, wherein the method comprises the following steps: determining first vertex coordinates and a first direction vector for each line segment that makes up the 3D arc; the line segments have no width; for each line segment, determining a second direction vector from the camera position coordinate to the first vertex coordinate under the view angle corresponding to the line segment; determining a normal vector of a plane where the first direction vector and the second direction vector are located; for each line segment, taking the direction of the normal vector as a width extension direction, and obtaining a line segment with a width based on the first vertex coordinates of the line segment and the width extension direction; and rendering the 3D arc line of the bandwidth based on the line segment of the bandwidth. The technical scheme can save computing resources and improve drawing efficiency.

Description

Arc rendering method of bandwidth and computer program product
Technical Field
The present disclosure relates to the field of image technology, and in particular, to a 3D arc rendering method with width and a computer program product.
Background
In the field of map visualization, a line with a width is an indispensable rendering type in a visualized scene. The wide line types are roughly classified into three types: wide lines of ground-attaching strips, wide lines of radian strips and wide lines of radian columns. The wide strip-shaped line is mainly applied to describing data attached to the land and the ground such as roads, navigation lines and the like; the radian strip-shaped wide lines are used for describing virtual aerial tracks, and because the radian strip-shaped wide lines are usually in a silk strip shape and have no thickness, poor appearance under a 3D visual angle can be caused in an actual rendering scene; the radian column-shaped wide line is an improved form of a radian strip-shaped wide line and is mainly used for solving the problem of poor impression of the radian strip-shaped wide line under a 3D visual angle. However, in the prior art, rendering of the radian column-shaped wide line is either complicated and requires a large amount of GPU calculation, or the calculation is simple, but the 3D look is poor and errors are easy. Therefore, how to improve rendering efficiency of an arc with a width and reduce the amount of computation while ensuring a 3D rendering effect is one of the main problems that needs to be solved currently in the art.
Disclosure of Invention
The embodiment of the disclosure provides a 3D arc rendering method with width and a computer program product.
In a first aspect, an embodiment of the present disclosure provides a method for rendering a 3D arc with a width, where the method includes:
determining first vertex coordinates and a first direction vector for each line segment comprising the 3D arc; the line segments have no width;
for each line segment, determining a second direction vector from the camera position coordinate to the first vertex coordinate under the view angle corresponding to the line segment;
determining a normal vector of a plane where the first direction vector and the second direction vector are located;
for each line segment, taking the direction of the normal vector as a width extension direction, and obtaining a line segment with a width based on the first vertex coordinates of the line segment and the width extension direction;
and rendering the 3D arc with the width based on the line segment with the width to be obtained.
Further, the determining a normal vector of a plane where the first direction vector and the second direction vector are located includes:
and performing cross multiplication on the first direction vector and the second direction vector to obtain the normal vector.
Further, for each line segment, taking the direction of the normal vector as a width extending direction, and obtaining a line segment with a width based on the first vertex coordinates of the line segment and the width extending direction, the method includes:
for each line segment, respectively translating two first vertex coordinates of the line segment by preset distances along the positive direction and the negative direction of the normal vector to obtain four second vertex coordinates; the preset distance is half of the width of the 3D arc line;
determining the four second vertex coordinates as the vertex coordinates of two triangles of the line segment which is spliced to form the width of the tape so as to render the two triangles;
rendering the 3D arc of bandwidth based on the line segment of bandwidth, comprising:
and for each line segment, rendering two corresponding triangles based on the vertex coordinates of the two triangles, and further obtaining the 3D arc line with the width.
Further, determining the four second vertex coordinates as vertex coordinates of two triangles joining the line segment forming the tape width to render the two triangles includes:
determining the vertical distance from each pixel point in the triangle to the side of the first vertex coordinate far away from one end of the visual angle for each line segment;
rendering the pixels with different degrees of transparency based on the vertical distance.
Further, for each line segment, determining a vertical distance from each pixel point in the triangle to an edge where the first vertex coordinate is located at an end far away from the viewing angle, including:
determining an actual geographic distance of the line segment;
determining the vertical distance corresponding to each pixel point within the triangle based on the actual geographic distance.
Further, prior to determining the first vertex coordinates and the first direction vector for each of the line segments that make up the 3D arc, the method further comprises:
acquiring the coordinates of a starting point and a terminating point of the 3D arc line with the width and the radian of the 3D arc line;
determining an arc segment from the start point coordinate to the end point coordinate with a radian consistent with that of the 3D arc; the arc segment has no width;
dividing the arc segment into a plurality of segments.
In a second aspect, an embodiment of the present invention provides a map rendering method, where the method includes:
obtaining map rendering data;
when rendering a map based on the map rendering data, rendering a virtual air track on the map based on the arc rendering method with the bandwidth according to the first aspect.
In a third aspect, an embodiment of the present invention provides a 3D arc rendering device with a width, where the device includes: a CPU and a GPU;
the CPU determining first vertex coordinates and a first direction vector for each line segment comprising the 3D arc, and passing the first vertex coordinates and the first direction vector into the GPU; the line segments have no width;
the GPU determines a second direction vector from the camera position coordinate under the visual angle corresponding to each line segment to the first vertex coordinate, and determines a normal vector of a plane where the first direction vector and the second direction vector are located; and the GPU also takes the direction of the normal vector as a width extension direction for each line segment, obtains a line segment with a bandwidth based on the first vertex coordinate of the line segment and the width extension direction, and obtains the 3D arc line with the bandwidth based on the line segment to be widened through rendering.
In a fourth aspect, an embodiment of the present invention provides a 3D arc rendering apparatus with a width, including:
a first determination module configured to determine first vertex coordinates and a first direction vector for each line segment that makes up the 3D arc; the line segments have no width;
a second determining module configured to determine, for each of the line segments, a second direction vector from the camera position coordinate to the first vertex coordinate at the view angle corresponding to the line segment;
a third determining module configured to determine a normal vector of a plane in which the first direction vector and the second direction vector are located;
the extension module is configured to take the direction of the normal vector as a width extension direction for each line segment, and obtain a line segment with a width based on the first vertex coordinates of the line segment and the width extension direction;
a rendering module configured to render the 3D arc with the width based on the line segment to be wide.
The functions can be realized by hardware, and the functions can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the above-described functions.
In one possible design, the apparatus includes a memory configured to store one or more computer instructions that enable the apparatus to perform the corresponding method, and a processor configured to execute the computer instructions stored in the memory. The apparatus may also include a communication interface for the apparatus to communicate with other devices or a communication network.
In a fifth aspect, the disclosed embodiments provide an electronic device comprising a memory, a processor, and a computer program stored on the memory, wherein the processor executes the computer program to implement the method of any of the above aspects.
In a sixth aspect, the disclosed embodiments provide a computer-readable storage medium for storing computer instructions for use by any of the above apparatuses, the computer instructions, when executed by a processor, being configured to implement the method of any of the above aspects.
In a seventh aspect, the disclosed embodiments provide a computer program product comprising computer instructions, which when executed by a processor, are configured to implement the method of any one of the above aspects.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
in the process of rendering the 3D arc of the bandwidth, the first vertex coordinates and the first direction vectors of the line segments without the bandwidth of the 3D arc are calculated, the second direction vectors of the first vertex coordinates of each line segment are determined according to the camera position coordinates of the line segment at the corresponding view angle, then the normal vectors of the planes determined by the first direction vectors and the first direction vectors are used as the width extending direction, and the rendering is performed along the direction of the line segments and the width extending direction, the line segments of the bandwidth are obtained, and the line segments of all the bandwidth are spliced and displayed to be the 3D arc of one bandwidth. In the above manner of the embodiment of the present disclosure, since the width extension direction of each line segment forming the 3D arc is determined by using the camera position coordinates and the direction of the line segment itself, and a complex view angle conversion algorithm is not required, the calculation amount of the CPU and the GPU can be reduced, the calculation resources can be saved, and the rendering efficiency of the 3D arc can be improved; in addition, the CPU only needs to calculate the vertex coordinates and the direction vectors of the line segments, the GPU calculates the width extension direction based on the vertex coordinates and the direction vectors of the line segments and the direction vectors from the camera position coordinates to the vertex coordinates of the line segments, and the CPU does not need to transmit extra or repeated calculation data to the GPU in the whole calculation process, so that the calculation amount is further reduced compared with the prior art that the CPU needs to transmit repeated vertex coordinates of the line segments to the GPU and the like, the calculation resources are saved, and the rendering efficiency of the 3D arc line is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
Other features, objects, and advantages of the present disclosure will become more apparent from the following detailed description of non-limiting embodiments when taken in conjunction with the accompanying drawings. In the drawings:
fig. 1 illustrates a flow diagram of a method of 3D arc rendering with a width according to an embodiment of the present disclosure;
2(a) -2 (b) show schematic views of the width extension direction and two triangles spliced into line segments of the tape width according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating a vertical distance from a pixel point in a triangle to an edge at which a first vertex coordinate is located according to an embodiment of the present disclosure;
FIG. 4 illustrates a flow diagram of a map rendering method according to an embodiment of the present disclosure;
FIG. 5 illustrates a block diagram of a 3D arc rendering device with a width according to an embodiment of the present disclosure;
fig. 6 illustrates a display effect diagram of a 3D arc with a width in a map rendering scene according to an embodiment of the present disclosure;
fig. 7 is a schematic structural diagram of an electronic device suitable for implementing a 3D arc rendering and/or map rendering method with a width according to an embodiment of the present disclosure.
Detailed Description
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. Also, for the sake of clarity, parts not relevant to the description of the exemplary embodiments are omitted in the drawings.
In the present disclosure, it is to be understood that terms such as "including" or "having," etc., are intended to indicate the presence of the disclosed features, numbers, steps, actions, components, parts, or combinations thereof, and do not preclude the possibility that one or more other features, numbers, steps, actions, components, parts, or combinations thereof are present or added.
It should be further noted that the embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
In the prior art, the solution for drawing 3D arcs with a width mainly includes the following steps:
the drawing process of the first scheme is as follows:
1. the CPU calculates the direction vector of the line segment forming the arc line segment, and then calculates cross multiplication of the direction vector and the earth vertical direction vector to obtain a line segment normal vector.
2. The normal vector is passed into the GPU, and the triangle vertex coordinates extending along this vector are computed in the GPU's vertex shader.
3. And drawing the triangle by the GPU based on the vertex of the triangle, and further obtaining an arc with the width.
Although the first scheme is calculated, the rendering effect is poor, the width is easily invisible from the sense, and the animation rendering effect and the dotted line rendering effect of the arc line with the width cannot be rendered through the first scheme.
The drawing flow of the second scheme is as follows:
1. the CPU calculates the angular bisector of the front line segment and the rear line segment of each triangular point and calculates the normal vector of each angular bisector.
2. And the CPU transmits the normal vector of each angular bisector into the GPU.
3. And the GPU calculates the MVP matrix conversion of each angular bisector and obtains a two-dimensional direction vector of the direction vector in the 2D mapping of the screen.
4. And the GPU calculates the actual vertex position of the line width of the two-dimensional direction vector according to the width of the line, and then draws an arc line with the width based on the vertex position.
In the second scheme, because MVP matrix conversion is required, the GPU has a large calculation amount, and the situation that the width cannot be seen easily occurs on the arc top of the arc, and the 3D sense is poor.
Based on the above defects in the prior art, the embodiment of the present disclosure provides a method for rendering a 3D arc with a width, which can be implemented in WebGL for rendering a 3D arc with a width, and includes: determining first vertex coordinates and a first direction vector for each line segment comprising the 3D arc; the line segments have no width; for each line segment, determining a second direction vector from the camera position coordinate to the first vertex coordinate under the view angle corresponding to the line segment; determining a normal vector of a plane where the first direction vector and the second direction vector are located; and aiming at each line segment, taking the direction of the normal vector as a width extension direction, obtaining a line segment of the bandwidth based on the first vertex coordinate of the line segment and the width extension direction, and rendering to obtain the 3D arc of the bandwidth based on the line segment to be widened. This way of this disclosed embodiment, the calculation is comparatively simple to through adding known camera position coordinate into the computational process, improved the sensory effect of the 3D arc of bandwidth under the prerequisite that does not need a large amount of calculations.
The details of the embodiments of the present disclosure are described in detail below with reference to specific embodiments.
Fig. 1 illustrates a flowchart of a method for 3D arc rendering with a width according to an embodiment of the present disclosure. As shown in fig. 1, the method for rendering 3D arcs with a width includes the following steps:
in step S101, determining a first vertex coordinate and a first direction vector of each line segment constituting the 3D arc; the line segments have no width;
in step S102, for each line segment, determining a second direction vector from the camera position coordinate to the first vertex coordinate at the view angle corresponding to the line segment;
in step S103, determining a normal vector of a plane in which the first direction vector and the second direction vector are located;
in step S104, regarding a direction of the normal vector as a width extending direction for each line segment, and obtaining a line segment with a width based on the first vertex coordinates of the line segment and the width extending direction;
in step S105, rendering the 3D arc with the width based on the line segment to be wide.
In this embodiment, the 3D arc is an arc with an altitude in a 3D scene, and is generally used to describe an airline in the field of electronic map rendering. In a webgl (web Graphics library) drawing protocol, because a line with a rendering bandwidth is not supported, a triangle scheme is usually adopted to construct a width, that is, a line with a certain bandwidth is rendered by splicing two triangles.
In the embodiment of the disclosure, in the process of rendering a 3D arc line with a width based on WebGL, the 3D arc line with a width between two points is split into segments with multiple widths to be spliced, and the 3D arc line with a width is finally formed, and each segment with a width is spliced by using two triangles, so that when the 3D arc line with a width is rendered, the vertex coordinates of the two triangles in each segment with a width forming the 3D arc line need to be determined, and then the segment with a width forming the 3D arc line can be rendered based on the vertex coordinates of the two triangles.
To determine the coordinates of the vertex of the triangle mentioned above, first, an arc segment without width corresponding to the 3D arc may be determined based on the two end points of the 3D arc, that is, the start point and the end point of the 3D arc (the start point and the end point may be the middle points on the two end edges of the 3D arc with the width), and the arc degree of the 3D arc or the coordinates of the highest point of the 3D arc, the length and the arc degree of the arc segment without width may be identical to those of the 3D arc with the width, and the arc segment without width may be regarded as the central arc of the 3D arc with the width.
After the arc segment without width is determined based on the two end points of the 3D arc and the radian (or the coordinates of the highest point of the arc), the arc segment without radian may be divided into a plurality of segments, and the length of each segment to be divided may be set based on the GPU rendering capability for rendering the graph or other actual requirements, which is not particularly limited herein.
After the plurality of divided line segments are determined, the first vertex coordinates of each line segment can be further determined, and each line segment has two first vertex coordinates. Since the 3D arc to be rendered is a line segment with a radian and the corresponding arc line segment without width is also with a radian, the directions of a plurality of line segments obtained by dividing the arc line segment without width are not necessarily the same, and therefore, a direction vector of each line segment also needs to be determined. The direction vector may be determined based on the two first vertex coordinates of the line segment.
For each line segment, a second direction vector from the camera position coordinate at the view angle corresponding to the line segment to the first vertex coordinate of the line segment can be calculated. The viewing angle and the camera position coordinates at the position displayed by the line segment are preset values.
The method includes the steps that a plane can be determined based on a first direction vector and a corresponding second direction vector of the same line segment, a normal vector of the plane can be determined as the width extending direction of a 3D arc, a GPU can render from one first vertex coordinate to another first vertex coordinate of the line segment in the width extending direction, after all the line segments are rendered in the manner, the 3D arc with the width can be obtained, the 3D arc width extending direction is obtained based on the view angle of the rendering position of the line segment and the direction of the line segment (namely the first direction vector), and the width extending direction is always perpendicular to the view angle and the direction of the line segment, so that the rendered 3D arc can always see the extending width in all the view angles, and the situation that the arc width cannot be seen in some view angles can be avoided.
Fig. 2(a) -2 (b) show schematic views of the width extension direction and two triangles spliced into line segments of the tape width according to an embodiment of the present disclosure. As shown in FIG. 2(a), for line segment P0P1The first vertex coordinates are respectively P0And P1With the vertex P1For example, a normal vector n is perpendicular to a line segment, and two vertices P are obtained after extending a predetermined distance along a positive direction n and a negative direction-n of the normal vector0' and P0". Similarly, after a preset distance is derived along the positive direction n and the negative direction-n of the normal vector for another first vertex coordinate P, two vertexes P are obtained1' and P1″。
As shown in FIG. 2(b), the vertex P is obtained0′、P0″、P1' and P1"thereafter, it can be determined that the two triangles that can be spliced into line segments of the bandwidth are each Δ P0′P0″P1' and Δ P1″P0″P1′。
In the process of rendering the 3D arc of the bandwidth, the first vertex coordinate and the first direction vector of the line segment without the bandwidth of the 3D arc are calculated, the second direction vector of the first vertex coordinate of each line segment is determined according to the camera position coordinate at the view angle corresponding to the line segment, the normal vector of the plane determined by the first direction vector and the first direction vector is taken as the width extension direction, the rendering is performed along the direction of the line segment and the width extension direction, the line segment of the bandwidth is obtained, and the line segments of all the bandwidth are spliced and displayed to be the 3D arc of the bandwidth. In the above manner of the embodiment of the present disclosure, since the width extension direction of each line segment forming the 3D arc is determined by using the camera position coordinates and the direction of the line segment itself, and a complex view angle conversion algorithm is not required, the calculation amount of the CPU and the GPU can be reduced, the calculation resources can be saved, and the rendering efficiency of the 3D arc can be improved; in addition, the CPU only needs to calculate the vertex coordinates and the direction vectors of the line segments, the GPU calculates the width extension direction based on the vertex coordinates and the direction vectors of the line segments and the direction vectors from the camera position coordinates to the vertex coordinates of the line segments, and the CPU does not need to transmit extra or repeated calculation data to the GPU in the whole calculation process, so that the calculation amount is further reduced compared with the prior art that the CPU needs to transmit repeated vertex coordinates of the line segments to the GPU, the calculation resources are saved, and the rendering efficiency of the 3D arc line is improved.
In an optional implementation manner of this embodiment, the first direction vector is a direction vector of the line segment from a starting point to an end point, and step S103, that is, the step of determining a normal vector of a plane where the first direction vector and the second direction vector are located, further includes the following steps:
and performing cross multiplication on the first direction vector and the second direction vector to obtain the normal vector.
In this optional implementation manner, a normal vector of a plane defined by the first direction vector and the second direction vector can be obtained by cross-multiplying the first direction vector and the second direction vector, where the normal vector is always perpendicular to the first direction vector and the second direction vector, the first direction vector is a line segment direction, and the second direction vector is a view angle direction, and therefore the normal vector is always perpendicular to the view angle direction and the line segment direction. Therefore, the width of the rendered 3D arc can be displayed at each position based on the normal vector as the width extending direction.
In an optional implementation manner of this embodiment, in step S104, taking the direction of the normal vector as a width extending direction for each line segment, and obtaining a line segment with a width based on the first vertex coordinates of the line segment and the width extending direction, the method further includes the following steps:
for each line segment, respectively translating two first vertex coordinates of the line segment by preset distances along the positive direction and the negative direction of the normal vector to obtain four second vertex coordinates; the preset distance is half of the width of the 3D arc line;
determining the four second vertex coordinates as the vertex coordinates of two triangles which are spliced to form the line segment with the width so as to render the two triangles;
step S105, namely, the step of rendering the 3D arc with the bandwidth based on the line segment with the bandwidth further includes the following steps:
and for each line segment, rendering two corresponding triangles based on the vertex coordinates of the two triangles, and further obtaining the 3D arc line with the width.
In this optional implementation manner, after determining, for each line segment, four second vertex coordinates of the corresponding line segment with the bandwidth, because the line segment with the bandwidth is rendered by two connected triangles in the GPU, the GPU may determine, based on the four vertex coordinates, actual vertex coordinates of the triangle to be rendered, and then render two connected triangles according to the vertex coordinates of the two triangles, the two connected triangles form a line segment with the bandwidth from the sense, and the line segment with the bandwidth is a part of a 3D arc of the bandwidth to be rendered. After the line segments of the tape width corresponding to all the line segments are rendered, the 3D arc of the rendered tape width can be seen organoleptically.
In an optional implementation manner 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 the width to render the two triangles further includes the following steps:
determining the vertical distance from each pixel point in the triangle to the side of the first vertex coordinate far away from one end of the visual angle for each line segment;
coloring the pixel with different transparency based on the vertical distance and/or the first vertex coordinates of the line segment.
In this optional implementation manner, in order to implement an animation rendering effect and a dotted line rendering effect, the GPU may render different pixel points into different transparencies in each rendering process.
In some embodiments, in order to achieve an animation rendering effect, for example, an arc of a bandwidth is gradually rendered in a direction from near to far in a viewing angle, the GPU may determine a transparency of a pixel point based on a relative position of the pixel point in a 3D arc, and then perform rendering on the pixel point based on the transparency, for example, a distance between the pixel point and the viewing angle may be determined based on the relative position of the pixel point in the 3D arc, and then in a rendering process, the pixel point closer to the viewing angle may be rendered as a point with a smaller transparency, and the pixel point farther from the viewing angle may be rendered as a point with a larger transparency, and as the number of rendering times increases, the pixel point farther from the viewing angle is also gradually rendered as a point with a smaller transparency, and the animation effect of displaying the 3D arc of the bandwidth from near to far may be achieved by this manner.
In the above embodiment, the relative position of the pixel point in the 3D arc line may be determined based on the vertical distance between the pixel point and the edge of the line segment where the first vertex coordinate far from the viewing angle is located, and the relative position of the line segment in the 3D arc line may be determined based on the first vertex coordinate of the line segment.
In other embodiments, a dashed rendering effect of 3D arcs with width may also be implemented. In order to achieve the effect of rendering the dotted lines, the GPU may render the pixel points at one end of each line segment as completely transparent or points with greater transparency, and render other pixel points as opaque or points with lesser transparency. Therefore, the vertical distance from the pixel point to the edge where the first vertex coordinate at one end of the line segment is located can be determined, the transparency of the pixel point is determined according to the vertical distance, and then rendering is performed based on the transparency of the pixel point.
By the method, the animation rendering effect and the dotted line rendering effect of the arc with the width can be achieved in the WebGL.
Fig. 3 is a schematic diagram illustrating a vertical distance from a pixel point in a triangle to an edge where a first vertex coordinate is located according to an embodiment of the disclosure. As shown in FIG. 3, if the pixel x is any pixel in the triangle, the first vertex coordinates are P0And P1The visual angle position is at the position of the eye pattern, then P0Pixel point x to P as the first vertex coordinate far from visual angle0The vertical distance of the edge is shown by the line segment L in the figure. In an optional implementation manner of this embodiment, for each line segment, the step of determining a vertical distance from each pixel point in the triangle to an edge where the first vertex coordinate is located at an end far from the viewing angle further includes the following steps:
determining an actual geographic distance of the line segment;
determining the vertical distance corresponding to each pixel point within the triangle based on the actual geographic distance.
In this optional implementation manner, in a map rendering application scene, the vertical distance from the pixel point to the edge of the first vertex coordinate of the line segment may be determined by using the actual geographic distance as a scale. In a map rendering scene, the coordinates of the end points of the 3D arc with the width are geographic coordinates, so the coordinates of the first vertex of the line segment may also be geographic coordinates, and in order to determine the vertical distance corresponding to the pixel point, the actual geographic distance may also be used for determination.
In an optional implementation manner of this embodiment, before the step of determining the first vertex coordinates and the first direction vector of each line segment constituting the 3D arc in step S101, the method further includes the following steps:
acquiring the coordinates of a starting point and a terminating point of the 3D arc line with the width and the radian of the 3D arc line;
determining an arc line segment from the starting point coordinates to the ending point coordinates, wherein the radian of the arc line segment is consistent with that of the 3D arc line; the arc segments have no width;
dividing the arc segment into a plurality of segments.
In this optional implementation manner, in the process of rendering a 3D arc line with a bandwidth based on WebGL, the 3D arc line with a bandwidth between two points is split into segments with multiple bandwidths to be spliced, the 3D arc line with a bandwidth is finally formed, and each segment with a bandwidth is spliced by using two triangles, so that when the 3D arc line with a bandwidth is rendered, it is necessary to determine the segment with a bandwidth forming the 3D arc line, the vertex coordinates of the two triangles, and then the segment with a bandwidth forming the 3D arc line can be rendered based on the vertex coordinates of the two triangles.
To determine the vertex coordinates of the triangle mentioned above, an arc segment without width corresponding to the 3D arc may be first determined based on the two endpoints of the 3D arc, i.e., the starting point and the ending point of the 3D arc (which may be the midpoint on the two end edges of the 3D arc with the width), and the arc degree of the 3D arc (which may be directly specified by a user or other rendering object or determined based on the specified coordinates of the highest point of the 3D arc), the length and the arc degree of the arc segment without width coinciding with the 3D arc with the width, and the arc segment without width may be regarded as the central arc of the 3D arc with the width.
After the arc segment without width is determined based on the two end points of the 3D arc and the radian (or the coordinates of the highest point of the arc), the arc segment without radian may be divided into a plurality of segments, and the length of each segment to be divided may be set based on the GPU rendering capability for rendering the graph or other actual requirements, which is not particularly limited herein.
Fig. 4 illustrates a flowchart of a map rendering method according to an embodiment of the present disclosure. As shown in fig. 3, the map rendering method includes the steps of:
in step S401, map rendering data is acquired;
in step S402, when rendering a map based on the map rendering data, a virtual air track is rendered on the map based on the 3D arc rendering method of the bandwidth.
In this embodiment, a 3D arc of the bandwidth is typically used to describe an airline during the map rendering process. Therefore, in the process of map rendering needing to render the airline, map rendering data can be obtained firstly, and then when the map is rendered by using the map rendering data, the airline can be rendered by the 3D arc rendering method based on the bandwidth after the map rendering is finished or together with the map rendering. The coordinates of the two end points of the 3D arc may be coordinates on a map, and thus the coordinates of the first vertex of each divided line segment may also be coordinates on the map. For specific details, reference may be made to the above description of the method for rendering a 3D arc with a width, and details are not described herein again.
Fig. 5 illustrates a block diagram of a 3D arc rendering device with a width according to an embodiment of the present disclosure. As shown in fig. 5, the 3D arc rendering device with a bandwidth includes: a CPU 501 and a GPU 502;
the CPU 501 determines a first vertex coordinate and a first direction vector of each line segment constituting the 3D arc, and transmits the first vertex coordinate and the first direction vector to the GPU 502; the line segments have no width;
for each line segment, the GPU 502 determines a second direction vector from the camera position coordinate to the first vertex coordinate at the view angle corresponding to the line segment, and determines a normal vector of a plane where the first direction vector and the second direction vector are located; and the GPU 502 further takes the direction of the normal vector as a width extension direction for each line segment, obtains a line segment of a bandwidth based on the first vertex coordinate of the line segment and the width extension direction, and obtains the 3D arc of the bandwidth based on the line segment to be widened by rendering.
In this embodiment, the 3D arc is an arc with an altitude in a 3D scene, and is generally used to describe an airline in the field of electronic map rendering. In a webgl (web Graphics library) drawing protocol, because a line with a rendering bandwidth is not supported, a triangle scheme is usually used to construct a width, that is, a line with a certain bandwidth is rendered by splicing two triangles.
In the embodiment of the present disclosure, in the process of rendering a 3D arc line with a bandwidth based on WebGL, the 3D arc line with a bandwidth between two points is split into segments with multiple bandwidths to be spliced, and the 3D arc line with a bandwidth is finally formed, and each segment with a bandwidth is spliced by using two triangles, so that when the 3D arc line with a bandwidth is rendered, it is necessary to determine the vertex coordinates of the two triangles in each segment with a bandwidth forming the 3D arc line, and then GPU 502 may render each segment with a bandwidth forming the 3D arc line based on the vertex coordinates of the two triangles.
To determine the coordinates of the vertex of the triangle mentioned above, in this embodiment, the CPU 501 may first determine an arc segment without width corresponding to the 3D arc based on the two end points of the 3D arc, that is, the start point and the end point of the 3D arc (the start point and the end point may be the middle points on the two end edges of the 3D arc with the width), and the radian of the 3D arc or the coordinates of the highest point of the 3D arc, where the length and the radian of the arc segment without width are consistent with those of the 3D arc with the width, and the arc segment without width may be regarded as the central arc of the 3D arc with the width.
After the arc segment without width is determined based on the two ends of the 3D arc and the arc (or the coordinates of the highest point of the arc), the arc segment without arc may be divided into a plurality of segments, and the length of each segment to be divided may be set based on the rendering capability for the GPU 502 or other practical requirements, which is not particularly limited herein.
After the CPU 501 determines a plurality of line segments after division, it is also possible to determine the first vertex coordinates of each line segment, each line segment having two first vertex coordinates. Since the 3D arc to be rendered is a line segment with an arc and the corresponding arc line segment without width is also with an arc, the directions of the plurality of line segments obtained by dividing the arc line segment without width are not necessarily the same, and therefore the CPU 501 may also determine the first direction vector of each line segment. The first direction vector may be determined based on two first vertex coordinates of the line segment.
The CPU 501 transmits the calculated first vertex coordinates and first direction vector of each line segment to the GPU 502.
The GPU 502 may calculate, for each line segment, a second direction vector from the camera position coordinate at the viewing angle corresponding to the line segment to the first vertex coordinate of the line segment, and since each line segment has two first vertex coordinates, two second direction vectors may be calculated. The viewing angle and the camera position coordinates at the position displayed by the line segment are preset values.
A plane can be determined based on the first direction vector and the corresponding second direction vector of the same line segment, a normal vector of the plane can be determined as a width extending direction of the 3D arc, and then the GPU 502 can render from one first vertex coordinate to another first vertex coordinate of the line segment in the width extending direction, after all the line segments are rendered in the manner described above, a 3D arc with a width can be obtained, and since the 3D arc width extending direction is obtained based on a view angle at a rendering position of the line segment and a direction of the line segment (i.e., the first direction vector), and the width extending direction is always perpendicular to the view angle and the direction of the line segment, the rendered 3D arc can always see the extending width at each view angle, and the situation that the arc width cannot be seen at some view angles does not occur.
In the process of rendering the 3D arc with the bandwidth, the CPU calculates the first vertex coordinates and the first direction vectors of the line segments without the bandwidth that form the 3D arc, and transmits the calculated first vertex coordinates and the first direction vectors into the GPU, and the GPU determines the second direction vectors to the first vertex coordinates of each line segment according to the camera position coordinates at the view angle corresponding to the line segment, and then takes the normal vectors of the planes determined by the first direction vectors and the first direction vectors as the width extension direction, and renders along the direction of the line segment and the width extension direction to obtain the line segments with the bandwidth, so that the line segments with all the bandwidth are spliced and displayed as the 3D arc with one bandwidth. In the above manner of the embodiment of the present disclosure, since the width extension direction of each line segment forming the 3D arc is determined by using the camera position coordinates and the direction of the line segment itself, and a complex view angle conversion algorithm is not required, the calculation amount of the CPU and the GPU can be reduced, the calculation resources can be saved, and the rendering efficiency of the 3D arc can be improved; in addition, the CPU only needs to calculate the vertex coordinates and the direction vectors of the line segments, the GPU calculates the width extension direction based on the vertex coordinates and the direction vectors of the line segments and the direction vectors from the camera position coordinates to the vertex coordinates of the line segments, and the CPU does not need to transmit extra or repeated calculation data to the GPU in the whole calculation process, so that the calculation amount is further reduced compared with the prior art that the CPU needs to transmit repeated vertex coordinates of the line segments to the GPU, the calculation resources are saved, and the rendering efficiency of the 3D arc line is improved.
In an optional implementation manner of this embodiment, the GPU 502 obtains the normal vector by performing cross multiplication on the first direction vector and the second direction vector.
In this optional implementation manner, a normal vector of a plane defined by the first direction vector and the second direction vector can be obtained by cross-multiplying the first direction vector and the second direction vector, where the normal vector is always perpendicular to the first direction vector and the second direction vector, the first direction vector is a line segment direction, and the second direction vector is a view angle direction, and therefore the normal vector is always perpendicular to the view angle direction and the line segment direction. So that the width of the rendered 3D arc can be shown at various positions based on the normal vector as the width extension direction.
In an optional implementation manner of this embodiment, for each line segment, the GPU 502 translates two first vertex coordinates of the 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 of the width of the 3D arc line; the GPU 502 also determines the four second vertex coordinates as the vertex coordinates of two triangles that are joined to form the line segment of tape width, thereby rendering the two triangles.
In this optional implementation, after determining, for each line segment, four second vertex coordinates of a corresponding line segment with a width, since the GPU 502 supports rendering the line segment with a width by two connected triangles, the GPU 502 may determine, based on the four vertex coordinates, actual vertex coordinates of a triangle to be rendered, and further render two connected triangles according to the vertex coordinates of the two triangles, and form, organoleptically, a line segment with a width from the two connected triangles, where the line segment with a width is a part of a 3D arc with a width to be rendered. After the line segments of the bandwidth corresponding to all the line segments are rendered, the 3D arc of the rendered bandwidth can be organoleptically seen.
In an optional implementation manner of this embodiment, for each line segment, the GPU 502 determines a vertical distance from each pixel point in the triangle to an edge where the first vertex coordinate is located at an end away from the viewing angle, and the GPU 502 further performs coloring of different transparencies on the pixel based on the vertical distance and/or the first vertex coordinate of the line segment.
In this optional implementation, in order to implement an animation rendering effect and a dotted line rendering effect, the GPU 502 may render different pixel points into different transparencies in each rendering process.
In some embodiments, in order to achieve an animation rendering effect, for example, an arc of a bandwidth is gradually rendered in a direction from near to far in a viewing angle, the GPU 502 may determine a transparency of a pixel point based on a relative position of the pixel point in a 3D arc, and then perform rendering on the pixel point based on the transparency, for example, a distance between the pixel point and the viewing angle may be determined based on the relative position of the pixel point in the 3D arc, and then in a rendering process, the pixel point closer to the viewing angle may be rendered as a point with smaller transparency, and the pixel point farther away may be rendered as a point with larger transparency, and as the number of rendering times increases, the pixel point farther away may be also rendered as a point with smaller transparency, and in this way, an animation effect of displaying the arc of the bandwidth from near to far may be achieved.
In the above embodiment, the relative position of the pixel point in the 3D arc line may be determined based on the vertical distance between the pixel point and the edge of the line segment where the first vertex coordinate far from the viewing angle is located, and the relative position of the line segment in the 3D arc line may be determined based on the first vertex coordinate of the line segment.
In other embodiments, a dashed rendering effect of 3D arcs with width may also be implemented. In order to implement the dotted line rendering effect, the GPU 502 may render the pixel point at one end of each line segment as a completely transparent or a point with greater transparency, and render other pixel points as opaque or a point with smaller transparency. Therefore, the vertical distance from the pixel point to the edge where the first vertex coordinate at one end of the line segment is located can be determined, the transparency of the pixel point is determined according to the vertical distance, and then rendering is performed based on the transparency of the pixel point.
By the method, the animation rendering effect and the dotted line rendering effect of the arc with the width can be achieved in the WebGL.
In an optional implementation manner of this embodiment, the GPU 502 may determine an 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.
In this optional implementation, in a map rendering application scenario, the GPU 502 may determine a vertical distance from a pixel point to an edge of a first vertex coordinate of a line segment by using the actual geographic distance as a scale. In a map rendering scene, the coordinates of the end points of the 3D arc with the width are geographic coordinates, so the coordinates of the first vertex of the line segment may also be geographic coordinates, and in order to determine the vertical distance corresponding to the pixel point, the actual geographic distance may also be used for determination.
In an optional implementation manner of this embodiment, the CPU 501 obtains a start point coordinate, an end point coordinate, and a radian of the 3D arc line of the tape width, determines an arc line segment from the start point coordinate to the end point coordinate, where the radian is consistent with the radian of the 3D arc line, and divides the arc line segment into a plurality of line segments; the arc segment has no width.
In this optional implementation manner, in the process of rendering the 3D arc line with the bandwidth based on the WebGL, the GPU 502 splits the 3D arc line with one bandwidth between two points into segments with multiple bandwidths and then splices the segments, and finally forms the 3D arc line with one bandwidth, and each segment with the bandwidth is spliced and rendered by using two triangles, so that when the 3D arc line with the bandwidth is rendered, the GPU 502 can determine the segment with the width of each segment forming the 3D arc line, the vertex coordinates of the two triangles, and then the segment with the width of each segment forming the 3D arc line can be rendered based on the vertex coordinates of the two triangles.
To determine the vertex coordinates of the triangle mentioned above, the CPU 501 may determine an arc segment without width corresponding to the 3D arc based on the two end points of the 3D arc, that is, the start point and the end point of the 3D arc (which may be the middle points on the two end edges of the 3D arc with the width), and the arc degree of the 3D arc (which may be directly specified by a user or other rendering object or determined based on the specified coordinates of the highest point of the 3D arc), the length and the arc degree of the arc segment without width coinciding with the 3D arc with the width, and the arc segment without width may be regarded as the center arc of the 3D arc with the width.
After determining the arc segment without width based on the two end points of the 3D arc and the arc (or the coordinates of the highest point of the arc), the CPU 501 may divide the arc segment without arc into a plurality of segments, and the length of each segment to be divided may be set based on the GPU 502 rendering capability for rendering the graph or other practical requirements, which is not specifically limited herein.
Fig. 6 illustrates a display effect diagram of a 3D arc with a width in a map rendering scene according to an embodiment of the present disclosure. As shown in fig. 6, the width of the 3D arc with the width rendered by the method proposed by the embodiment of the present disclosure can be seen at each display position, and the dotted rendering effect is also achieved.
The following are embodiments of the disclosed apparatus that may be used to perform embodiments of the disclosed methods.
According to the 3D arc rendering device with the bandwidth of the embodiment of the present disclosure, the device may be implemented as part or all of an electronic device through software, hardware or a combination of the two. This 3D arc rendering device of bandwidth includes:
a first determination module configured to determine first vertex coordinates and a first direction vector for each line segment making up the 3D arc; the line segments have no width;
a second determining module configured to determine, for each of the line segments, a second direction vector from the camera position coordinate to the first vertex coordinate at the view angle corresponding to the line segment;
a third determining module configured to determine a normal vector of a plane in which the first direction vector and the second direction vector are located;
the extension module is configured to take the direction of the normal vector as a width extension direction for each line segment, and obtain a line segment with a width based on the first vertex coordinates of the line segment and the width extension direction;
a rendering module configured to render the 3D arc with the width based on the line segment to be wide.
In an optional implementation manner of this embodiment, the second determining module includes:
and the cross multiplication sub-module is configured to cross multiply the first direction vector and the second direction vector to obtain the normal vector.
In an optional implementation manner of this embodiment, the extension module includes:
the translation sub-module is configured to translate 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 of the width of the 3D arc line;
a first determination submodule configured to determine the four second vertex coordinates as vertex coordinates of two triangles that stitch together the line segments forming the strip width;
the rendering module includes:
and the rendering submodule is configured to render the two corresponding triangles based on the vertex coordinates of the two triangles for each line segment, so as to obtain the 3D arc with the width.
In an optional implementation manner of this embodiment, the first determining sub-module includes:
the second determining submodule is configured to determine, for each line segment, the vertical distance from each pixel point in the triangle to the side where the first vertex coordinate far away from one end of the visual angle is located;
a shading submodule configured to shade the pixels with different degrees of transparency based on the vertical distance.
In an optional implementation manner of this embodiment, the second determining sub-module includes:
a third determination submodule configured to determine an actual geographic distance of the line segment;
a fourth determination submodule configured to determine the vertical distance corresponding to each pixel point within the triangle patch based on the actual geographic distance.
In an optional implementation manner of this embodiment, before the first determining module, the apparatus further includes:
a first obtaining module configured to obtain start point coordinates, end point coordinates of the 3D arc and a radian of the 3D arc of a bandwidth;
a fourth determining module configured to determine an arc segment from the start point coordinate to the end point coordinate with a radian consistent with a radian of the 3D arc; the arc segments have no width;
a dividing module configured to divide the arc segment into a plurality of segments.
The 3D arc rendering device with bandwidth in this embodiment corresponds to and is consistent with the 3D arc rendering method with bandwidth in the foregoing, and for specific details, reference may be made to the description of the 3D arc rendering method with bandwidth in the foregoing, which is not described herein again.
According to the map rendering apparatus of an embodiment of the present disclosure, the apparatus may be implemented as a part or all of an electronic device by software, hardware, or a combination of both. The map rendering apparatus includes:
a second obtaining module configured to obtain map rendering data;
a map rendering module configured to render a virtual air trajectory on a map based on the bandwidth arc rendering device when rendering the map based on the map rendering data.
The map rendering device in this embodiment corresponds to the map rendering method in the foregoing, and specific details may refer to the description of the map rendering method in the foregoing, which is not described herein again.
Fig. 7 is a schematic structural diagram of an electronic device suitable for implementing a 3D arc rendering and/or map rendering method with a width according to an embodiment of the present disclosure.
As shown in fig. 7, electronic device 700 includes a processing unit 701, which may be implemented as a CPU, GPU, FPGA, NPU, or other processing unit. The processing unit 701 may execute various processing in the embodiment of any one of the methods described above of the present disclosure according to a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data necessary for the operation of the electronic apparatus 700 are also stored. The processing unit 701, the ROM702, and the RAM703 are connected to each other by a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. 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, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to embodiments of the present disclosure, any of the methods described above with reference to embodiments of the present disclosure may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing any of the methods of the embodiments of the present disclosure. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams may represent a module, a program segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present disclosure may be implemented by software or hardware. The units or modules described may also be provided in a processor, and the names of the units or modules do not in some cases constitute a limitation of the units or modules themselves.
As another aspect, the present disclosure also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus in the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present disclosure.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is possible without departing from the inventive concept. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (10)

1. A method for rendering a 3D arc with width, comprising:
determining first vertex coordinates and a first direction vector for each line segment comprising the 3D arc; the line segments have no width;
for each line segment, determining a second direction vector from the camera position coordinate to the first vertex coordinate under the view angle corresponding to the line segment;
determining a normal vector of a plane where the first direction vector and the second direction vector are located;
for each line segment, taking the direction of the normal vector as a width extension direction, and obtaining a line segment with a width based on the first vertex coordinates of the line segment and the width extension direction;
and rendering the 3D arc line of the bandwidth based on the line segment of the bandwidth.
2. The method of claim 1, wherein the first direction vector is a direction vector of the line segment from a starting point to an end point, and determining a normal vector of a plane in which the first direction vector and the second direction vector lie comprises:
and performing cross multiplication on the first direction vector and the second direction vector to obtain the normal vector.
3. The method according to claim 1 or 2, wherein, for each of the line segments, taking a direction of the normal vector as a width extension direction, deriving a line segment with a width based on the first vertex coordinates of the line segment and the width extension direction comprises:
for each line segment, respectively translating two first vertex coordinates of the line segment by preset distances along the positive direction and the negative direction of the normal vector to obtain four second vertex coordinates; the preset distance is half of the width of the 3D arc line;
determining the four second vertex coordinates as the vertex coordinates of two triangles of the line segment which is spliced to form the width of the belt;
rendering the 3D arc of bandwidth based on the segment of bandwidth, comprising:
and for each line segment, rendering two corresponding triangles based on the vertex coordinates of the two triangles, and further obtaining the 3D arc line with the width.
4. The method of claim 1 or 2, wherein determining the four second vertex coordinates as vertex coordinates of two triangles joining the line segment forming a width of the tape to render the two triangles comprises:
determining the vertical distance from each pixel point in the triangle to the side of the first vertex coordinate far away from one end of the visual angle for each line segment;
rendering the pixel with different transparency based on the vertical distance.
5. The method of claim 4, wherein for each of the line segments, determining a vertical distance from each pixel point within the triangle to an edge of the first vertex coordinate away from the view angle comprises:
determining an actual geographic distance of the line segment;
determining the vertical distance corresponding to each pixel point within the triangle based on the actual geographic distance.
6. The method of any of claims 1-2, 5, wherein prior to determining the first vertex coordinates and the first direction vector for each of the line segments making up the 3D arc, the method further comprises:
acquiring the coordinates of a starting point and a terminating point of the 3D arc line with the width and the radian of the 3D arc line;
determining an arc segment from the start point coordinate to the end point coordinate with a radian consistent with that of the 3D arc; the arc segments have no width;
dividing the arc segment into a plurality of segments.
7. A map rendering method, comprising:
obtaining map rendering data;
rendering a virtual air trajectory on a map based on the bandwidth arc rendering method of any one of claims 1-6 when rendering the map based on the map rendering data.
8. A 3D arc rendering device with width, comprising: a CPU and a GPU;
the CPU determining first vertex coordinates and a first direction vector for each line segment comprising the 3D arc, and passing the first vertex coordinates and the first direction vector into the GPU; the line segments have no width;
the GPU determines a second direction vector from the camera position coordinate to the first vertex coordinate under the view angle corresponding to each line segment, and determines a normal vector of a plane where the first direction vector and the second direction vector are located; and the GPU further takes the direction of the normal vector as a width extension direction for each line segment, obtains a line segment of the bandwidth based on the first vertex coordinate of the line segment and the width extension direction, and renders the 3D arc of the bandwidth based on the line segment of the bandwidth.
9. A computer readable storage medium having computer instructions stored thereon, wherein the computer instructions, when executed by a processor, implement the method of any of claims 1-7.
10. A computer program product comprising computer instructions, wherein the computer instructions, when executed by a processor, implement the method of any one of claims 1-7.
CN202210112994.0A 2022-01-29 2022-01-29 Arc rendering method of bandwidth and computer program product Pending CN114723864A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210112994.0A CN114723864A (en) 2022-01-29 2022-01-29 Arc rendering method of bandwidth and computer program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210112994.0A CN114723864A (en) 2022-01-29 2022-01-29 Arc rendering method of bandwidth and computer program product

Publications (1)

Publication Number Publication Date
CN114723864A true CN114723864A (en) 2022-07-08

Family

ID=82236226

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210112994.0A Pending CN114723864A (en) 2022-01-29 2022-01-29 Arc rendering method of bandwidth and computer program product

Country Status (1)

Country Link
CN (1) CN114723864A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115359146A (en) * 2022-07-22 2022-11-18 北京城市网邻信息技术有限公司 Line drawing method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115359146A (en) * 2022-07-22 2022-11-18 北京城市网邻信息技术有限公司 Line drawing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US10593096B2 (en) Graphics processing employing cube map texturing
US9275493B2 (en) Rendering vector maps in a geographic information system
US9437034B1 (en) Multiview texturing for three-dimensional models
US9495767B2 (en) Indexed uniform styles for stroke rendering
US8115783B2 (en) Methods of and apparatus for processing computer graphics
US7236169B2 (en) Geometric processing stage for a pipelined graphic engine, corresponding method and computer program product therefor
US20060114262A1 (en) Texture mapping apparatus, method and program
US9153065B2 (en) System and method for adjusting image pixel color to create a parallax depth effect
WO2012094076A1 (en) Morphological anti-aliasing (mlaa) of a re-projection of a two-dimensional image
US6978230B1 (en) Apparatus, system, and method for draping annotations on to a geometric surface
US20120176367A1 (en) Morphological anti-aliasing (mlaa) of a re-projection of a two-dimensional image
CN114758051A (en) Image rendering method and related equipment thereof
CN114723864A (en) Arc rendering method of bandwidth and computer program product
She et al. A parallelized screen-based method for rendering polylines and polygons on terrain surfaces
KR101227155B1 (en) Graphic image processing apparatus and method for realtime transforming low resolution image into high resolution image
CN110363860B (en) 3D model reconstruction method and device and electronic equipment
Borshukov New algorithms for modeling and rendering architecture from photographs
JP4714919B2 (en) Rendering device, recording medium, and program
CN111127589A (en) Vector map circular dotted line symbol drawing method considering line width consistency
CN111145302A (en) Vector map square dotted line symbol drawing method considering line width consistency
CN111145298A (en) Vector map fence dotted line symbol drawing method considering line width consistency
Gjøl et al. Inexpensive antialiasing of simple objects
Pérez et al. Geometry-based methods for general non-planar perspective projections on curved displays
US11941746B2 (en) Accurate smooth occluding contours
US20190311522A1 (en) Vertex shift for rendering 360 stereoscopic content

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination