CN118096986A - Rendering method, device, equipment and program product - Google Patents

Rendering method, device, equipment and program product Download PDF

Info

Publication number
CN118096986A
CN118096986A CN202311781358.8A CN202311781358A CN118096986A CN 118096986 A CN118096986 A CN 118096986A CN 202311781358 A CN202311781358 A CN 202311781358A CN 118096986 A CN118096986 A CN 118096986A
Authority
CN
China
Prior art keywords
vertex
rendered
building
height
screen
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
CN202311781358.8A
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.)
Beijing Autonavi Yunmap Technology Co ltd
Original Assignee
Beijing Autonavi Yunmap Technology 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 Beijing Autonavi Yunmap Technology Co ltd filed Critical Beijing Autonavi Yunmap Technology Co ltd
Priority to CN202311781358.8A priority Critical patent/CN118096986A/en
Publication of CN118096986A publication Critical patent/CN118096986A/en
Pending legal-status Critical Current

Links

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The application provides a rendering method, a device, equipment and a program product, wherein the rendering method is applied to software with a three-dimensional electronic map rendering function, and comprises the following steps: responding to the software entering the three-dimensional electronic map rendering scene, and acquiring rendering data of a building to be rendered contained in the three-dimensional electronic map to be rendered; obtaining vertex coordinates of vertices of the building to be rendered based on rendering data of the building to be rendered; acquiring a projection distance between the vertex and the screen anchor point in a set direction based on the vertex coordinates of the vertex and the screen coordinates of the screen anchor point; and determining the height coefficient of the vertex of the building to be rendered based on the projection distance corresponding to the vertex of the building to be rendered, so that the screen height of the vertex of the building to be rendered is reduced based on the height coefficient when the building to be rendered is rendered, and the effect of the three-dimensional electronic map when the multi-building is displayed is optimized.

Description

Rendering method, device, equipment and program product
Technical Field
The present application relates to the field of map rendering technologies, and in particular, to a rendering method, apparatus, device, and program product.
Background
With the continuous development of rendering technology, more and more software with map navigation function supports three-dimensional electronic map rendering, and the three-dimensional electronic map has better real world reduction degree than the two-dimensional electronic map, so that the gap between the electronic map and the real world is reduced, and the sense of reality of the electronic map is enhanced.
The inventor of the present application has found that, when studying the display effect of the existing three-dimensional electronic map, although the overall display effect of the three-dimensional electronic map is better than that of the two-dimensional electronic map, when the three-dimensional electronic map in the visual area of the user contains denser map elements (such as buildings), the map elements displayed by the existing three-dimensional electronic map are not emphasized, and a large number of map elements are mixed together and displayed to the user, so that the user cannot quickly find the interested map elements in the three-dimensional electronic map. Therefore, there is a need to provide a rendering method for improving the display effect of a three-dimensional electronic map.
Disclosure of Invention
The application provides a rendering method, a device, equipment and a program product, which provide a rendering strategy for adjusting building height coefficients during rendering based on projection distance between building vertexes and screen anchor points, solve the problems of building mixing and unobtrusive emphasis in a three-dimensional electronic map rendered in the prior art, and optimize the display effect of the three-dimensional electronic map.
In a first aspect, the present application provides a rendering method applied to software having a three-dimensional electronic map rendering function, the method comprising:
Responding to the software entering a three-dimensional electronic map rendering scene, and acquiring rendering data of a building to be rendered contained in the three-dimensional electronic map to be rendered;
obtaining vertex coordinates of vertices of the building to be rendered based on the rendering data of the building to be rendered;
Acquiring a projection distance between a vertex and a screen anchor point in a set direction based on the vertex coordinates of the vertex and the screen coordinates of the screen anchor point;
and determining the height coefficient of the vertex of the building to be rendered based on the projection distance corresponding to the vertex of the building to be rendered, so as to reduce the screen height of the vertex of the building to be rendered based on the height coefficient when the building to be rendered is rendered.
In a second aspect, the present application provides a rendering apparatus applied to software having a three-dimensional electronic map rendering function, the apparatus comprising:
the rendering data acquisition module is used for responding to the software to enter a three-dimensional electronic map rendering scene and acquiring rendering data of a building to be rendered contained in the three-dimensional electronic map to be rendered;
The vertex coordinate acquisition module is used for acquiring vertex coordinates of the vertices of the building to be rendered based on the rendering data of the building to be rendered;
the projection distance calculation module is used for obtaining the projection distance between the vertex and the screen anchor point in a set direction based on the vertex coordinates of the vertex and the screen coordinates of the screen anchor point;
The height coefficient determining module is used for determining the height coefficient of the vertex of the building to be rendered based on the projection distance corresponding to the vertex of the building to be rendered, so that the screen height of the vertex of the building to be rendered is reduced based on the height coefficient when the building to be rendered is rendered.
In a third aspect, the present application provides an electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the electronic device to perform the method provided by the first aspect of the application.
In a fourth aspect, the present application provides a computer readable storage medium having stored therein computer executable instructions which, when executed by a processor, implement a method as provided in the first aspect of the application.
In a fifth aspect, the application provides a program product comprising a computer program which, when executed by a processor, implements a method as provided in the first aspect of the application.
The method, the device, the equipment and the program product for rendering the scene of the three-dimensional building, provided by the application, are used for configuring the height coefficient for the vertex based on the projection distance between the vertex of the building to be rendered and the screen anchor point in the set direction, and adjusting the height of the building through the configured height coefficient; the height coefficient is determined by the projection distance in the set direction, so that the heights of the three-dimensional buildings in the direction perpendicular to the set direction are consistent, the phenomenon of uneven heights of the three-dimensional buildings when the lengths of the three-dimensional buildings perpendicular to the set direction are long can be avoided, and the rendering effect of the three-dimensional buildings is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic diagram of three-dimensional electronic map rendering according to an embodiment of the present application;
Fig. 2 is a flow chart of a rendering method according to an embodiment of the present application;
FIG. 3 is a schematic view of the projection distance in the embodiment of FIG. 2 according to the present application;
FIG. 4 is a flowchart of another rendering method according to an embodiment of the present application;
FIG. 5 is a schematic view of the projection distance provided in the embodiment of FIG. 4 according to the present application;
FIG. 6 is a schematic diagram of a projection distance partitioning result according to an embodiment of the present application;
FIG. 7 is a schematic diagram of height coefficient adjustment according to an embodiment of the present application;
FIG. 8 is a flowchart of another rendering method according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
It should be noted that, the user information (including but not limited to user equipment information, user attribute information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or fully authorized by each party, and the collection, use and processing of the related data need to comply with related laws and regulations and standards, and provide corresponding operation entries for the user to select authorization or rejection.
The software supporting the Three-dimensional electronic map rendering function triggers Three-dimensional scene rendering when a user enters a scene which needs to render a Three-dimensional electronic map, namely, when the user enters an interface which needs to render the Three-dimensional electronic map, and renders feature elements (also called map elements) in the electronic map, such as buildings, into Three-dimensional (3D) so as to provide the user with the electronic map which is more close to the real scene. The software of the present application may be an application program installed in a mobile terminal, or may be software installed in a vehicle device, or may be a subroutine or applet built in another application program.
By way of example, the software may be map navigation software, taxi taking software, take-away software, and the like.
The scene needing to render the three-dimensional electronic map can comprise 1) after a user opens software with a three-dimensional electronic map rendering function, the first interface displayed to the user by the software comprises the electronic map and the rendering mode of the electronic map is a three-dimensional rendering mode, 2) when the user browses the electronic map displayed by the software, the three-dimensional electronic map is triggered to render by means of amplifying, dragging, selecting a 3D mode and the like, or 3) the software of the user works in a 3D navigation mode, and the electronic map in a navigation guiding interface of the 3D navigation mode is the three-dimensional electronic map. The scene is here only an example and should not be considered as limiting the application.
In rendering a three-dimensional electronic map, in order to reduce the rendering cost, details of a building may not correspond exactly to those of the building in the real world in some cases, for example, a simple geometry into which the building may be abstracted, such as a cuboid, a cylinder, etc., in which case the building may also be referred to as a building block.
For example, fig. 1 is a schematic diagram of three-dimensional electronic map rendering provided in an embodiment of the present application, as shown in fig. 1, after a user enters a home page of a map application program, the map application program displays an electronic map near a location where the user is located to the user, and if the displayed electronic map is two-dimensional, the user may trigger the three-dimensional electronic map rendering by selecting "3D" in the lower right corner of the electronic map, or by gesture instructions such as double-finger zoom, drag, and the like. After triggering the rendering of the three-dimensional electronic map, the user can adjust the displayed three-dimensional electronic map through operations such as dragging, rotating and the like.
After triggering the three-dimensional electronic map rendering, the user can exit the three-dimensional electronic map rendering by selecting the '2D' of the right lower corner of the electronic map or by triggering a gesture instruction, and return to the two-dimensional electronic map.
In a scene rendered by the three-dimensional electronic map, the buildings in the electronic map are three-dimensional, and the height of the rendered buildings is determined based on the actual heights of the buildings and the current scale or zoom scale of the electronic map, namely, the heights of the three-dimensional buildings rendered in the electronic map are related to the actual heights of the buildings.
When the buildings displayed in the three-dimensional electronic map are denser, the buildings displayed in the three-dimensional electronic map (also referred to as a drawing) are more chaotic due to the difference in height of the buildings in the real world, and the emphasis cannot be highlighted, such as the area where the user's viewpoint (solid dots in fig. 1) is located (i.e., the focal area in fig. 1), so that the drawing is displayed chaotic, and the user cannot quickly locate the interested building, such as the target building in fig. 1.
Based on the method, the scheme of determining the height coefficient of the vertex based on the projection of the distance between the vertex of the building to be rendered and the screen anchor point (such as the user viewpoint) in the set direction is realized, so that the height of the building is adjusted through the height coefficient, the unified adjustment of the height of the building based on the same reference, namely the projection distance obtained by taking the screen anchor point as the reference is realized, for example, the height of the building with long projection distance is reduced, the display effect of the three-dimensional building is optimized, and under the scene displayed by the dense three-dimensional building, the user can quickly position the interested building, and the user experience is improved.
Fig. 2 is a schematic flow chart of a rendering method according to an embodiment of the present application, where the method is applied to software with a three-dimensional electronic map rendering function, and may be executed by an electronic device with a corresponding data processing capability, such as a user terminal, where the user terminal may be a mobile phone, a tablet computer, a vehicle, or the like. The rendering method can be specifically executed by a rendering engine of the user terminal in cooperation with a GPU (Graphics Processing Unit, graphics processor).
As shown in fig. 2, the rendering method includes the steps of:
step S201, in response to the software entering the three-dimensional electronic map rendering scene, the rendering data of the building to be rendered contained in the three-dimensional electronic map to be rendered is obtained.
Step S202, obtaining vertex coordinates of vertices of the building to be rendered based on the rendering data of the building to be rendered.
The building to be rendered is a building to be rendered, and can be a building near the target position or near the position where the user is located. The target location may be a location of interest to the user, such as a location of a search. The number of buildings to be rendered may be one or more.
The rendering data stores data required for rendering the one or more buildings to be rendered, including positions or vertex coordinates of each vertex of the buildings to be rendered, which may be longitude and latitude of the vertex, or coordinates of the vertex under a world coordinate system.
In some embodiments, the longitude and latitude of the building vertex to be rendered may be read from the rendering data as vertex coordinates to calculate the projection distance corresponding to the vertex.
In other embodiments, if the locations of vertices in the rendering data are described in terms of longitudes and latitudes, the locations of the vertices are converted to vertex coordinates in a world coordinate system.
Step S203, calculating the projection distance between the vertex and the screen anchor point in the set direction based on the vertex coordinates of the vertex and the screen coordinates of the screen anchor point.
The screen anchor point can be a default position point on the screen, and can also be the position of the user viewpoint on the screen when the three-dimensional electronic map is rendered. The screen coordinates are coordinates in a screen coordinate system, and the screen coordinate system is a coordinate system corresponding to a user terminal screen.
For example, the screen coordinate system may take the upper left corner of the screen as the origin, take two adjacent edges of the screen as two coordinate axes, take the coordinates of the lower right corner of the screen as (1, 1) as an example, the screen coordinates of the screen anchor point may be (0.5,0.85) or (0.85,0.5), and the coordinate axis corresponding to 0.85 is the coordinate axis in the direction approaching to the vertical direction.
In order to calculate the projection distance, the screen coordinates of the screen anchor point need to be converted from the screen coordinate system to the world coordinate system to perform distance calculation with the vertex coordinates under the world coordinate system.
The set direction is a direction described by a coordinate system in which the vertex coordinates are located, and the corresponding screen direction (a direction described by a screen coordinate system), that is, the set screen direction, may be a horizontal axis, a vertical axis or other directions of the screen coordinate system.
The set direction may be a default direction, or may be configured in a customized manner, or determined based on a rendering scene corresponding to the building to be rendered. The rendering scene can be determined by the main direction of the building to be rendered, i.e. the screen direction where the longest edge is located, for example, the rendering scene is divided into a longitudinal rendering scene and a transverse rendering scene.
In some embodiments, the set direction may be determined by the direction of each building to be rendered that needs to be rendered, and the direction of the building to be rendered may be the direction calibrated for the building to be rendered, and may also be the main direction of the building to be rendered. If the set direction is determined to be the most direction of the corresponding building to be rendered, the set direction can be determined by setting weights for the building to be rendered and weighting the direction of the building to be rendered.
In the vertical rendering scene, the main direction of the building to be rendered in the screen coordinate system is the longitudinal axis direction of the screen coordinate system or the direction close to the longitudinal axis direction of the screen coordinate system, and the set screen direction (the direction in the screen coordinate system corresponding to the set direction) may be the longitudinal axis direction of the screen coordinate system. In the horizontal rendering scene, the main direction of the building to be rendered in the screen coordinate system is the horizontal axis direction of the screen coordinate system or the direction close to the horizontal axis direction of the screen coordinate system, and the set screen direction can be the horizontal axis direction of the screen coordinate system.
For example, the screen coordinate system takes the side of the screen close to the vertical direction as the longitudinal axis, and the set screen direction can be the positive direction or the negative direction of the longitudinal axis of the screen coordinate system.
The vertex coordinates are usually coordinates under a world coordinate system, and the screen coordinates of the screen anchor points are coordinates under the screen coordinate system, so that the screen coordinates of the screen anchor points can be subjected to coordinate conversion firstly in order to save calculation cost when calculating the distance due to the large number of the vertices. Specifically, the screen coordinates of the screen anchor point can be converted into coordinates under the world coordinates based on the conversion relation between the screen coordinate system and the world coordinate system. And further, calculating the distance between the screen anchor point and the vertex based on the coordinates of the screen anchor point and the vertex under the world coordinates. After the distance between the screen anchor point and the vertex is obtained, the projection of the distance to the set direction is carried out, and the projection distance corresponding to the vertex is obtained.
Fig. 3 is a schematic view of projection distances in the embodiment of fig. 2 according to the present application, and as shown in fig. 3, a screen anchor point v0 is a default point on a screen, three vertexes of a building to be rendered (a top view of the building to be rendered is shown in fig. 3) are v1, v2 and v3, respectively, and for convenience of illustration, fig. 3 converts vertex coordinates and setting directions of the vertexes into a screen coordinate system. The distances between the vertexes v1, v2 and v3 and the screen anchor point v0 are shown as D1 to D3 in fig. 3, the distances D1 to D3 are projected in a set screen direction (in fig. 3, the screen longitudinal direction is taken as an example), and the projection distances D1 to D3 are obtained, so that the height coefficients can be respectively configured for the vertexes v1, v2 and v3 based on the lengths of the projection distances D1 to D3.
Step S204, determining a height coefficient of the vertex of the building to be rendered based on the projection distance corresponding to the vertex of the building to be rendered, so as to reduce the screen height of the vertex of the building to be rendered based on the height coefficient when the building to be rendered is rendered.
Wherein the height coefficient is greater than 0 and less than or equal to 1, and the height coefficient is used to depress (less than 1) or maintain (equal to 1) the screen height of the vertex. Depression of the building may be achieved by configuring the vertices of the building with a high-low coefficient of less than 1.
The projection distance corresponding to the vertex is the projection distance between the vertex and the screen anchor point in the set direction. The screen height is the height under the screen coordinate system.
For example, the height coefficient and the projection distance may be in a negative correlation, that is, the longer the projection distance corresponding to the vertex is, the smaller the height coefficient of the vertex is, so as to reduce the height of a building with longer projection of the screen anchor point in the set direction, and if the screen anchor point is a user viewpoint, the low height of the distant view building can be realized.
In other embodiments, the height coefficient and the projection distance may have a positive correlation, so as to reduce the height of a building with a shorter projection of the screen anchor point in the set direction, and if the screen anchor point is a user viewpoint, the depression of the close-range building may be achieved.
Specifically, the height coefficient of the vertex may be calculated based on a functional expression between the projection distance and the height coefficient, and the projection distance corresponding to the vertex. The functional expression between projection distance and height coefficient may be a linear function or a nonlinear function, such as a logarithmic function, a parabolic function, etc.
In some embodiments, the functional expression between the projection distance and the height coefficient may be a piecewise function, in which a portion of the expression may be a constant, and the portion of the expression indicates that the height coefficient has a negative correlation with the projection distance when the projection distance is in a corresponding interval, such as the height coefficient decreases linearly with an increase in the projection distance.
Optionally, determining the height coefficient of the vertex based on the projection distance corresponding to the vertex includes:
And determining the height coefficient of the vertex based on a comparison result of the projection distance corresponding to the vertex and at least one preset distance threshold.
Optionally, the determining the height coefficient of the vertex of the building to be rendered based on the projection distance corresponding to the vertex of the building to be rendered includes:
Comparing the projection distance corresponding to the vertex with a preset distance threshold value to obtain a comparison result; and determining the height coefficient of the vertex based on the comparison result.
When the embodiment of the application is implemented, the distance threshold may be one or more, such as two.
The interval in which the projection distance corresponding to the vertex is located may be determined based on a result of comparing the projection distance corresponding to the vertex with at least one distance threshold, and the height coefficient of the vertex may be determined based on a height coefficient expression corresponding to the interval. When the height coefficient expression corresponding to the interval is a constant, determining the constant as the height coefficient of the vertex; when the height expression corresponding to the interval is not constant, substituting the projection distance corresponding to the vertex into the height expression corresponding to the interval to obtain the height coefficient of the vertex.
For example, the projection distance may be divided into a plurality of sections based on a plurality of preset distance thresholds, and corresponding height coefficient constants are configured for different sections, so that the height coefficient constant corresponding to a section is determined as the height coefficient of the vertex corresponding to the projection distance in the section. The larger the upper limit value of the section is, the smaller the height coefficient constant corresponding to the section is.
Take 2 distance thresholds d1 and d2 as examples, where d1< d2. The 2 distance thresholds divide the projection distance into a plurality of 3 sections, the 3 sections respectively correspond to 3 height coefficient constants, such as 1 (d less than or equal to d 1), 0.85 (d 1< d < d 2), 0.65 (d less than or equal to d 2), and d is the projection distance corresponding to the vertex.
In other embodiments, when d1< d < d2, the height coefficient of the vertex may be inversely related, such as linearly inversely related, to the projection distance corresponding to the vertex.
The rendering method provided by the application is used for configuring the height coefficient for the vertex based on the projection distance between the vertex of the building to be rendered and the screen anchor point in the set direction aiming at the scene of the rendering three-dimensional building, and carrying out height adjustment on the building by the configured height coefficient; the height coefficient is determined by the projection distance in the set direction, so that the heights of the three-dimensional buildings in the direction perpendicular to the set direction are consistent, the phenomenon of uneven heights of the three-dimensional buildings when the lengths of the three-dimensional buildings perpendicular to the set direction are long can be avoided, and the rendering effect of the three-dimensional buildings is improved.
Fig. 4 is a flowchart of another rendering method according to an embodiment of the present application, where steps S203 and S204 are further refined based on the embodiment shown in fig. 2, and the embodiment uses vertex coordinates as coordinates of a world coordinate system and a preset distance threshold includes a first threshold and a second threshold as an example.
As shown in fig. 4, the rendering method provided in this embodiment may specifically include the following steps:
Step S401, responding to the software entering the three-dimensional electronic map rendering scene, obtaining rendering data of a building to be rendered contained in the three-dimensional electronic map to be rendered, and obtaining vertex coordinates of vertices of the building to be rendered based on the rendering data of the building to be rendered.
Triangulating the building to be rendered through upstream equipment to obtain a plurality of vertexes of the building to be rendered and longitudes and latitudes of the vertexes, and packaging the vertexes in combination with the height of the building to be rendered to obtain rendering data of the building to be rendered.
The rendering data may also include an identification of the building to be rendered, descriptive information, etc.
The rendering data may also include color, texture, etc. data.
The vertex coordinates are three-dimensional coordinates in the world coordinate system. The world coordinate system may be, for example, a geocentric coordinate system such as the WGS-84 coordinate system.
Optionally, obtaining vertex coordinates of vertices of the building to be rendered based on rendering data of the building to be rendered includes:
Reading longitude and latitude of vertexes of the building to be rendered from rendering data of the building to be rendered, wherein the vertexes of the building to be rendered are vertexes obtained by triangulating polygons where the building to be rendered is located; vertex coordinates of the vertices are determined based on the longitudes and latitudes of the vertices.
The longitude and latitude of the vertex can be converted into coordinates in the world coordinate system based on the conversion relation between the world coordinate system and the longitude and latitude (i.e., the geographic coordinate system), and the vertex coordinates of the vertex can be obtained.
In some embodiments, the rendering data of the multiple buildings to be rendered may be packaged in a data packet, and the longitude and latitude of each vertex of the multiple buildings to be rendered are obtained through parsing the data packet, and the vertex coordinates of each vertex of the multiple buildings to be rendered are obtained through coordinate transformation.
Step S402, obtaining coordinates of the screen anchor point in the world coordinate system and the unit vector of the set direction based on the screen coordinates of the screen anchor point and the conversion relation between the screen target coordinate system and the world coordinate system.
The set direction is the direction corresponding to the set screen direction in the world coordinate system in the screen coordinate system. The set screen direction may be any direction in the screen coordinate system, such as the direction of the horizontal axis or the vertical axis of the screen coordinate system.
In order to calculate the distance between the screen anchor point and the vertex, the screen anchor point needs to be converted into a coordinate point under the world coordinate system, and specifically, the screen coordinate of the screen anchor point can be subjected to coordinate conversion based on the conversion relation between the screen target coordinate system and the world coordinate system, so that the coordinate of the screen anchor point under the world coordinate system is obtained.
In order to obtain a unit vector of a set direction, a point is selected on a screen to be marked as an auxiliary point, and the direction of a vector formed by the auxiliary point and a screen anchor point in a screen coordinate system is the set screen direction.
Illustratively, taking the coordinates of the screen anchor point v0 as (x 0, y 0) and setting the screen direction as the longitudinal axis direction of the screen coordinate system as an example, the auxiliary point may be a point in the screen coordinate system which is the same as the abscissa of the screen anchor point and different from the ordinate, for example, as (x 0, y 1), and y1 is not equal to y0, for example, as y1> y0, so that the direction of the vector of the screen anchor point v0 pointing to the auxiliary point is the set screen direction.
When determining the unit vector of the set screen direction under the world coordinate system, that is, the unit vector of the set direction, the screen anchor point and the auxiliary point may be converted into coordinate points under the world coordinate system based on the conversion relationship between the screen coordinate system and the world coordinate system, and the coordinate difference between the screen anchor point and the coordinate point corresponding to the auxiliary point under the world coordinate system may be unitized to obtain the unit vector of the set direction.
The coordinate point corresponding to the screen anchor point in the world coordinate system is denoted as w0, the coordinate point corresponding to the auxiliary point in the world coordinate system is denoted as w 0', and the unit vector VectorV for setting the screen direction in the world coordinate system or the unit vector for setting the direction can be expressed as: (w 0-w0 ')/L, wherein L is ||w0-w 0'.
Step S403, for the vertex of the building to be rendered, obtaining a vertex vector of the vertex based on a difference between the vertex coordinate of the vertex and the coordinate of the screen anchor point in the world coordinate system.
It should be understood that, step S402 and step S403 may be executed in series or in parallel, and the execution order of step S403 and step S403 is not limited in the present application, as an example of parallel execution in fig. 4.
Step S404, obtaining the result of the dot multiplication of the vertex vector of the vertex and the unit vector, and using the result as the projection distance of the vertex in the set direction.
Vector dot multiplication is also known as vector inner product or number product, and the result of dot multiplication is a scalar. Since one of the vectors of the dot product is a unit vector and the modular length is 1, the meaning represented by the result of dot product of the vertex vector and the unit vector is the projection length of the vertex vector in the direction of the unit vector, namely the projection distance corresponding to the vertex.
The unit vector is denoted VectorV and the projected distance of the vertex w1 can be expressed as: d1 = (w 1-w 0) VectorV = ||w0-w1||cosθ, where w0 is a coordinate point corresponding to the screen anchor point in the world coordinate system, and θ is an included angle between the vertex vector (w 1-w 0) and the unit vector VectorV.
Fig. 5 is a schematic diagram of a projection distance provided in the embodiment of fig. 4, in which a direction of a unit vector VectorV, a vertex w1 of a building to be rendered, and a coordinate point corresponding to a screen anchor point in world coordinates are points w0 as shown in fig. 5, points v0 and v0 ' (auxiliary points) are two coordinate points in a screen coordinate system, point v0 is a screen anchor point, a coordinate point corresponding to point v0 ' in world coordinates is point w0 ', a direction of a line L50 connecting point w0 ' and point w0 is a direction of a unit vector VectorV, and unit vector VectorV is a vector obtained by unitizing vectors (w 0 ' to w 0). The line connecting the vertex w1 and the point w0 is L51, and the angle between the line L51 and the unit vector VectorV or the line L50 is θ. As shown in fig. 5, the projection distance D1 corresponding to the vertex w1 has an expression of d1= |w0-w1|x cos θ= (w 1-w0) · VectorV.
When the length of the building along the vertical setting direction is longer, the number of the vertexes of the building along the vertical setting direction is multiple, and the projection distances corresponding to the vertexes along the vertical setting direction are equal, so that the height coefficients of the vertexes along the vertical setting direction are the same, and the heights of the rendered buildings along the vertical setting direction are consistent.
Step S405, comparing the projection distance corresponding to the vertex with a preset distance threshold, to obtain a comparison result.
The preset distance threshold value comprises the following steps: a first threshold and a second threshold, the second threshold being greater than the first threshold.
In step S406, if the comparison result indicates that the projection distance corresponding to the vertex is less than or equal to the first threshold, the height coefficient of the vertex is determined to be the first coefficient.
Step S407, if the comparison result is that the projection distance corresponding to the vertex is greater than or equal to the second threshold, determining the height coefficient of the vertex as the second coefficient.
Wherein the second coefficient is less than the first coefficient, and the first coefficient is less than or equal to 1. Illustratively, the first coefficient may be 1 and the second coefficient 0.65.
In step S408, if the comparison result is that the projection distance corresponding to the vertex is smaller than the second threshold and larger than the first threshold, determining a height coefficient of the vertex between the first coefficient and the second coefficient, where the value of the height coefficient and the projection distance corresponding to the vertex are in a negative correlation.
If the projection distance of the vertex is smaller than the second threshold and larger than the first threshold, the height coefficient of the vertex is a gradient coefficient, and the gradient coefficient and the projection distance corresponding to the vertex are in a negative correlation.
The projection distance is divided into 3 subareas by two distance thresholds, namely a first threshold d1 and a second threshold d2, and the subareas are marked as a focus fixing area a, a near-focus gradual change area b and a far-focus fixing area c. In the focus fixing area a, the projection distance is smaller than or equal to a first distance d1; in the near-focus gradual change region b, the projection distance is smaller than a second threshold d2 and larger than a first threshold d1; in the far focus fixed zone c, the projection distance is greater than or equal to the second threshold d2. The height coefficient of the vertex of the corresponding projection distance positioned in the focal point fixed area a or the far focal point fixed area c is a fixed value, namely a first coefficient s1 or a second coefficient s2; the height coefficient of the corresponding projection distance at the vertex of the near-focus gradient region b is a value which changes along with the projection distance, in particular a value which gradually decreases along with the increase of the projection distance, and is positioned between the first coefficient s1 and the second coefficient s 2.
Fig. 6 is a schematic diagram of a projection distance partitioning result provided by an embodiment of the present application, and fig. 6 is an example of two distance thresholds d1 and d2 in a world coordinate system. As shown in fig. 6, the distance thresholds d1 and d2 divide the display area of the screen-displayed electronic map into 3 partitions, which are partition a, partition B, and partition C, respectively. The partition A, the partition B and the partition C are the corresponding partitions of the focus fixing area a, the near-focus gradual change area B and the far-focus fixing area C under a screen coordinate system. Since the projection distance between the vertex and the screen anchor point v0 is adopted for partitioning, the obtained partition is a parallelogram, one parallel side of the parallelogram is perpendicular to the direction of the set direction under the screen coordinate system, namely the set screen direction, and if the set screen direction is the screen longitudinal direction or the direction of the screen coordinate system longitudinal axis (namely the direction indicated by the dotted arrow in fig. 6), the partition a, the partition B and the partition C are rectangles. The projection distance between the vertex in the partition A and the screen anchor point v0 in the longitudinal direction of the screen is smaller than or equal to d 1', the projection distance between the vertex in the partition C and the screen anchor point v0 in the longitudinal direction of the screen is larger than or equal to d 2', the projection between the vertex in the partition B and the screen anchor point v0 in the longitudinal direction of the screen is located between d1 'and d 2', namely smaller than d2 'and larger than d 1', and d1 'and d 2' are distances obtained by converting distance thresholds d1 and d2 in a world coordinate system into a screen coordinate system respectively.
If three vertexes are positioned on a straight line perpendicular to the longitudinal direction of the screen (the set screen direction) on the building block A to be rendered, namely, the connecting line of the three vertexes is parallel to the transverse direction of the screen, the projection distances corresponding to the three vertexes are the same, so that the height coefficients of the three vertexes are equal, the heights of the rendered building block A in all positions in the transverse direction of the screen are the same, and the problem that the heights of the building block A in the transverse direction of the screen are inconsistent, such as the problem that the middle height and the two sides are low, is avoided.
In other embodiments, more than two distance thresholds may be provided, such as 3,4, or other numbers, to divide into more zones, such as more fade areas, more anchor areas, etc. The height coefficient of the corresponding vertex with the projection distance in the fixed area is a fixed value, such as the above-mentioned focal point fixed area a and far focus fixed area c, and the height coefficient of the corresponding vertex with the projection distance in the gradual change area is a gradual change coefficient, that is, a value changing with the projection distance, such as the above-mentioned near focus gradual change area b.
Taking 3 distance thresholds as an example, the 3 distance thresholds are d1, d2 and d3 from small to large in sequence, 2 gradient regions and 2 fixed regions can be obtained through the 3 distance thresholds, wherein the gradient coefficients corresponding to the near-focus gradient region b and the far-focus gradient region d are different from the projection distance, and the focal point fixed region a (d less than or equal to d 1), the near-focus gradient region b (d 1< d 2), the far-focus gradient region d (d 2 less than or equal to d 3) and the far-focus fixed region c (d more than or equal to d 3) are respectively different.
The distance threshold may be a default value, may be configured in a self-defined manner, or may be a value dynamically adjusted according to the electronic map scaling.
Optionally, the method further comprises:
Obtaining the scaling of the three-dimensional electronic map to be displayed; and determining the preset distance threshold based on the scaling.
Specifically, a correspondence between the scaling ratio and the distance threshold may be pre-established, so that the value of each distance threshold in the preset distance threshold, such as the values of the first distance d1 and the second distance d2, is determined based on the scaling ratio of the three-dimensional electronic map to be displayed, such as the scaling ratio when the three-dimensional scene is triggered or rendered, and the correspondence.
Illustratively, the scaling may be described by a scale, where the scale includes a plurality of levels, the higher the level, the higher the degree of magnification of the electronic map, and the smaller the actual distance represented by a pixel in the electronic map. The distance threshold may be inversely related to the level of the scale.
In some embodiments, an upper and lower limit of the distance threshold may also be set.
Illustratively, when the scale is 20 in level, the first threshold d1 may be 100m (lower limit value), and the second distance may be 1000m (lower limit value); when the scale is 19, the first threshold d1 may be 200m and the second distance may be 1000m; when the scale is 18 in level, the first threshold d1 may be 400m and the second distance may be 1500m; when the scale is 17 in level, the first threshold d1 may be 800m and the second distance may be 2000m; when the scale is 16 in level, the first threshold d1 may be 2000m and the second distance may be 3000m.
In some embodiments, the distance threshold may be represented by the product of the actual distance represented by a single pixel at the scale and a preset coefficient. The preset coefficients corresponding to different distance thresholds may be different, and the preset coefficients are positive numbers, such as positive integers.
By dynamically determining the distance threshold based on the scaling, dynamic partitioning based on the scaling is realized, the height coefficients corresponding to different partitions or the determination modes of the height coefficients are different, and the accuracy of the height coefficient configuration is improved.
In the embodiment, the screen anchor point in the world coordinate system and the unit vector of the set direction in the world coordinate system are obtained by carrying out coordinate conversion on the screen anchor point, and the projection distance corresponding to the projection of the vertex in the set direction, namely the vertex, is obtained by carrying out dot multiplication operation on the coordinate difference between the vertex and the screen anchor point in the world coordinate system, so that the operation logic is simple, the calculated amount is small, and the occupation of GPU resources is less; the space is divided into a plurality of subareas through a plurality of distance thresholds, different subareas are provided with different height coefficient determining strategies, the height coefficient is in an attenuation trend along with the increase of the projection distance, and is in gradual attenuation, so that the continuity of depression of a building is improved while depression of a distant view building is realized, and the visual effect of rendering of the building is improved.
Optionally, the method further comprises:
And determining the set direction based on main directions of a plurality of buildings to be rendered, wherein the main directions are directions in which longer ones of the length or the width of the buildings to be rendered are located.
The building includes a length, a width and a height, the length and the width being two sides on the top surface of the building.
The length and width of the building to be rendered can be determined based on the coordinates of the vertices in the rendering data of the building to be rendered, and if the length of the building to be rendered is greater than or equal to the width, the direction in which the length of the building to be rendered is located is determined as the main direction; and otherwise, determining the direction in which the width of the building to be rendered is positioned as the main direction, wherein the length of the building to be rendered is smaller than the width. The target direction may be determined based on the main direction of the building to be rendered, and then rotated by 90 ° to obtain the set direction.
For example, voting may be used to determine the main direction of the corresponding maximum number of buildings to be rendered as the target direction, which is at an angle of 90 ° to the set direction.
Before voting, the approaching main directions can be regarded as one main direction, for example, the main directions with included angles smaller than a preset angle are regarded as the same main direction, and the preset angle can be 10 degrees, 15 degrees and the like. And further counting the number of main directions of the building to be rendered in each direction, and selecting the direction with the largest number as the target direction.
When a three-dimensional electronic map rendering scene is entered, the main direction of each building to be rendered and the length of the edge in the main direction can be counted; and further determining a target direction from the main directions based on the main directions of the respective buildings to be rendered and the lengths of the sides in the main directions.
The weight of the main direction may be determined based on the length of the side of the building to be rendered in the main direction, and the target direction may be determined based on a weighted average of the main directions of the plurality of buildings to be rendered.
The sum of the lengths of the sides of the buildings to be rendered in the same main direction can be calculated, the total side length corresponding to the main direction is obtained, and the main direction with the longest corresponding total side length is determined as the target direction.
In some embodiments, the target direction may include a plurality of alternative directions, such as directions of a horizontal axis and a vertical axis under the screen coordinate system converted to directions behind the world coordinate system, such as both a west direction and a north direction, respectively. One of the plurality of alternative directions may be selected as the target direction based on a projection of an edge of each building to be rendered in the main direction in the plurality of alternative directions or based on an angle of each main direction of each building to be rendered with each alternative direction.
The main direction with the included angle smaller than the preset included angle with the alternative direction can be determined as the main direction corresponding to the alternative direction; and selecting one of the multiple alternative directions as a target direction based on the number of main directions corresponding to the alternative directions or the sum of the lengths of the edges of each building to be rendered in the main directions corresponding to the alternative directions, wherein the most number of alternative directions are determined as the target directions.
The setting direction is flexibly and dynamically set based on the main direction of the building to be rendered, so that after the more buildings in the electronic map are rendered, the heights of the more buildings in the corresponding directions in the screen such as the transverse directions of the screen are consistent along the vertical setting direction, the number of the buildings with uneven heights (such as high middle and low two sides) in the electronic map is reduced, namely the number of defective buildings in the electronic map caused by adopting a high-voltage strategy is reduced, and the rendering quality of the buildings is improved.
Optionally, if the same building to be rendered has two or more vertices, the method further includes:
If the height coefficients respectively corresponding to the vertexes of the building to be rendered are not completely the same, determining one height coefficient from the height coefficients respectively corresponding to the vertexes of the building to be rendered as a target height coefficient; and updating the height coefficients respectively corresponding to the vertexes of the building to be rendered into the target height coefficients.
For a building to be rendered with multiple vertexes, if the vertexes of the building to be rendered correspond to the multiple height coefficients, one or one height coefficient is selected from the multiple vertexes to serve as a target height system, so that the height coefficient of each vertex of the building to be rendered is adjusted or updated to be the target height coefficient, and the height uniformity of the building to be rendered is ensured.
Optionally, the method further comprises:
If a plurality of vertexes of the same building to be rendered correspond to a plurality of height coefficients, determining a target height coefficient based on the plurality of height coefficients; and updating the height coefficients of the vertexes to the target height coefficients.
When the method provided by the application is adopted, after the height coefficients are configured for the vertexes of the building to be rendered, if the situation that the height coefficients of different vertexes of the same building to be rendered are different exists, namely, if the situation that the same building to be rendered corresponds to a plurality of height coefficients exists, in order to avoid the phenomenon that the height of the building to be rendered is uneven, the flatness of the rendering of the building is improved, a target height coefficient is required to be determined based on the plurality of height coefficients corresponding to the building to be rendered, and the height coefficients of the vertexes of the building to be rendered are updated to be the target height coefficient, so that the heights of building blocks corresponding to the building to be rendered obtained through rendering are consistent.
For example, the target height coefficient may be any one of a plurality of height coefficients corresponding to the building to be rendered, such as a minimum value, a median value, a maximum value, and the like of the plurality of height coefficients.
In some embodiments, the target height coefficient may be an average of a plurality of height coefficients corresponding to the building to be rendered.
For example, fig. 7 is a schematic diagram of height coefficient adjustment provided in the embodiment of the present application, as shown in fig. 7, the height coefficients of three vertices v71, v72 and v73 in a building to be rendered are s71, s72 and s73 respectively, where s72 is the largest, and if the height coefficients are not adjusted, the heights of the vertices are the same, and after the heights are multiplied by the corresponding height coefficients, the problem that the rendered building has middle height and two sides are low is caused, that is, the heights h71 and h73 of the left side and the right side of the building are both smaller than the middle height h72. To avoid this problem, the height coefficients s71, s72, and s73 may be adjusted to be target height coefficients, and in fig. 7, the target height coefficient s72 is taken as an example, so that the heights of the buildings rendered after the adjustment of the height coefficients are uniform, that is, h71, h72, and h73 are all equal. The rendering effect of the building to be rendered before and after the height coefficient adjustment is as shown in fig. 7.
The target height coefficient may be any one of s71, s72 and s73, or a value calculated from s71, s72 and s73, such as an average value.
Fig. 8 is a flowchart of another rendering method according to an embodiment of the present application, where the rendering method provided in the embodiment may be performed by a GPU, and as shown in fig. 8, the rendering method includes:
Step S801, a height coefficient of each vertex of a building to be rendered is obtained.
Wherein the height coefficient is determined based on the method provided by the previous embodiment of the application.
Step S802, updating the height of the corresponding vertex based on the product of the height coefficient and the height of the corresponding vertex, and obtaining updated vertex coordinates.
Step 803, rendering the building to be rendered based on the vertex coordinates of the updated vertices of the building to be rendered.
Specifically, when an application program enters a three-dimensional electronic map rendering scene, determining one or more buildings to be rendered, and determining the height coefficient of each vertex of the buildings to be rendered by the method provided by the embodiment; updating the height in the vertex coordinates of each vertex of the building to be rendered to be the product of the height and the determined height coefficient; and rendering the building to be rendered based on the vertex coordinates of the updated vertices of the building to be rendered.
The embodiment of the application also provides a rendering device which is applied to software with the three-dimensional electronic map rendering function, and the device comprises:
The rendering data acquisition module is used for responding to the software to enter a three-dimensional electronic map rendering scene and acquiring rendering data of a building to be rendered contained in the three-dimensional electronic map to be rendered; the vertex coordinate acquisition module is used for acquiring vertex coordinates of the vertices of the building to be rendered based on the rendering data of the building to be rendered; the projection distance calculation module is used for obtaining the projection distance between the vertex and the screen anchor point in a set direction based on the vertex coordinates of the vertex and the screen coordinates of the screen anchor point; the height coefficient determining module is used for determining the height coefficient of the vertex of the building to be rendered based on the projection distance corresponding to the vertex of the building to be rendered, so that the screen height of the vertex of the building to be rendered is reduced based on the height coefficient when the building to be rendered is rendered.
Optionally, the height coefficient determining module is specifically configured to:
And determining the height coefficient of the vertex based on a comparison result of the projection distance corresponding to the vertex and at least one distance threshold.
Optionally, the height coefficient determining module includes:
The comparison unit is used for comparing the projection distance corresponding to the vertex with a preset distance threshold value to obtain a comparison result; and the height coefficient determining unit is used for determining the height coefficient of the vertex based on the comparison result.
Optionally, the preset distance threshold includes: the height coefficient determining unit is specifically configured to:
If the comparison result shows that the projection distance corresponding to the vertex is smaller than or equal to a first threshold value, determining the height coefficient of the vertex as a first coefficient; if the comparison result shows that the projection distance corresponding to the vertex is larger than or equal to a second threshold value, determining the height coefficient of the vertex as a second coefficient; wherein the second coefficient is less than the first coefficient, the first coefficient is less than or equal to 1; and if the comparison result shows that the projection distance corresponding to the vertex is smaller than the second threshold and larger than the first threshold, determining the height coefficient of the vertex between the first coefficient and the second coefficient, wherein the value of the height coefficient and the projection distance corresponding to the vertex are in a negative correlation.
Optionally, the apparatus further includes:
the distance threshold configuration module is used for obtaining the scaling of the three-dimensional electronic map to be displayed and determining the preset distance threshold based on the scaling.
Optionally, the apparatus further includes:
the setting direction determining module is used for determining the setting direction based on main directions of a plurality of buildings to be rendered, wherein the main directions are directions in which longer ones of the length and the width of the buildings to be rendered are located.
Optionally, the vertex coordinates are coordinates in a world coordinate system, and the projection distance calculating module is specifically configured to:
Obtaining coordinates of the screen anchor point under the world coordinate system and unit vectors of the set direction based on the screen coordinates of the screen anchor point and the conversion relation between the screen target coordinate system and the world coordinate system; aiming at the vertex of the building to be rendered, obtaining a vertex vector of the vertex based on the difference between the vertex coordinate of the vertex under the world coordinate system and the coordinate of the screen anchor point under the world coordinate system; and obtaining the result of dot multiplication of the vertex vector of the vertex and the unit vector as the projection distance of the vertex in the set direction.
Optionally, the vertex coordinate acquisition module is specifically configured to:
reading longitude and latitude of vertexes of the building to be rendered from rendering data of the building to be rendered, wherein the vertexes of the building to be rendered are vertexes obtained by triangulating polygons where the building to be rendered is located; vertex coordinates of the vertices are determined based on the longitudes and latitudes of the vertices.
Optionally, the apparatus further includes:
and the height coefficient adjustment module is used for determining a target height coefficient based on a plurality of height coefficients if a plurality of vertexes of the same building to be rendered correspond to the plurality of height coefficients, and updating the height coefficients of the plurality of vertexes to the target height coefficient.
Optionally, the apparatus further includes:
The target height coefficient determining module is used for determining a height coefficient from the height coefficients respectively corresponding to the vertexes of the buildings to be rendered as the target height coefficient if the same building to be rendered has two or more vertexes and if the height coefficients respectively corresponding to the vertexes of the buildings to be rendered are not completely the same; and the height coefficient updating module is used for updating the height coefficients respectively corresponding to the vertexes of the building to be rendered into the target height coefficients.
The embodiment of the application also provides a rendering device, which comprises:
the height coefficient acquisition module is used for acquiring the height coefficient of each vertex of the building to be rendered, wherein the height coefficient is determined based on the method provided by any embodiment; the vertex height updating module is used for updating the height of the corresponding vertex based on the product of the height coefficient and the height of the corresponding vertex to obtain updated vertex coordinates; and the building rendering module is used for rendering the building to be rendered based on the vertex coordinates of the updated vertices of the building to be rendered.
The rendering device provided by the embodiment of the present application may be used to execute the technical scheme of the rendering method provided in any of the above embodiments of the present application, and its implementation principle and technical effect are similar, and the embodiment is not repeated here.
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 9, the electronic device of the present embodiment may include: at least one processor 901; and a memory 902 communicatively coupled to the at least one processor; wherein the memory 902 stores instructions executable by the at least one processor 901 to cause the electronic device to perform the method according to any one of the embodiments described above.
Alternatively, the memory 902 may be separate or integrated with the processor 901.
The implementation principle and technical effects of the electronic device provided in this embodiment may be referred to the foregoing embodiments, and will not be described herein again.
The embodiment of the application also provides a computer readable storage medium, wherein computer executable instructions are stored in the computer readable storage medium, and when a processor executes the computer executable instructions, the method of any of the previous embodiments is realized.
Embodiments of the present application also provide a computer program product comprising a computer program which, when executed by a processor, implements a method as described in any of the preceding embodiments.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules may be combined or integrated into another system, or some features may be omitted or not performed.
The integrated modules, which are implemented in the form of software functional modules, may be stored in a computer readable storage medium. The software functional modules described above are stored in a storage medium and include instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or processor to perform some of the steps of the methods described in the various embodiments of the application.
It should be appreciated that the Processor may be a processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution. The Memory may include RAM (Random Access Memory ), and may further include NVM (Non-Volatile Memory), such as at least one magnetic disk Memory, and may also be a U-disk, a removable hard disk, a read-only Memory, a magnetic disk, or an optical disk.
The storage medium may be implemented by any type or combination of volatile or non-volatile Memory devices, such as Static Random-Access Memory (SRAM), electrically erasable programmable Read-Only Memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ ONLY MEMORY, EEPROM), erasable programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), programmable Read-Only Memory (Programmable Read Only Memory, PROM), read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an Application SPECIFIC INTEGRATED Circuits (ASIC). It is also possible that the processor and the storage medium reside as discrete components in an electronic device or a master device.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the application, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (10)

1. A rendering method, characterized in that it is applied to software having a three-dimensional electronic map rendering function, the method comprising:
Responding to the software entering a three-dimensional electronic map rendering scene, and acquiring rendering data of a building to be rendered contained in the three-dimensional electronic map to be rendered;
obtaining vertex coordinates of vertices of the building to be rendered based on the rendering data of the building to be rendered;
Acquiring a projection distance between a vertex and a screen anchor point in a set direction based on the vertex coordinates of the vertex and the screen coordinates of the screen anchor point;
and determining the height coefficient of the vertex of the building to be rendered based on the projection distance corresponding to the vertex of the building to be rendered, so as to reduce the screen height of the vertex of the building to be rendered based on the height coefficient when the building to be rendered is rendered.
2. The method of claim 1, wherein the determining the height coefficient of the vertex of the building to be rendered based on the projection distance corresponding to the vertex of the building to be rendered comprises:
comparing the projection distance corresponding to the vertex with a preset distance threshold value to obtain a comparison result;
And determining the height coefficient of the vertex based on the comparison result.
3. The method of claim 2, wherein the preset distance threshold comprises: a first threshold and a second threshold, the second threshold being greater than the first threshold, the determining the height coefficient of the vertex based on the comparison result comprising:
If the comparison result shows that the projection distance corresponding to the vertex is smaller than or equal to a first threshold value, determining the height coefficient of the vertex as a preset first coefficient;
If the comparison result shows that the projection distance corresponding to the vertex is greater than or equal to a second threshold value, determining that the height coefficient of the vertex is a preset second coefficient; wherein the second coefficient is less than the first coefficient, the first coefficient is less than or equal to 1;
And if the comparison result shows that the projection distance corresponding to the vertex is smaller than the second threshold and larger than the first threshold, determining the height coefficient of the vertex between the first coefficient and the second coefficient, wherein the value of the height coefficient and the projection distance corresponding to the vertex are in a negative correlation.
4. The method according to claim 2, wherein the method further comprises:
Obtaining the scaling of the three-dimensional electronic map to be displayed;
and determining the preset distance threshold based on the scaling.
5. The method according to claim 1, wherein the method further comprises:
And determining the set direction based on main directions of a plurality of buildings to be rendered, wherein the main directions are directions in which longer ones of the length or the width of the buildings to be rendered are located.
6. The method of any one of claims 1-5, wherein the vertex coordinates are coordinates of a world coordinate system;
The obtaining the projection distance between the vertex and the screen anchor point in the set direction based on the vertex coordinates of the vertex of the building to be rendered and the screen coordinates of the screen anchor point comprises the following steps:
obtaining coordinates of the screen anchor point under the world coordinate system and unit vectors of the set direction based on the screen coordinates of the screen anchor point and the conversion relation between the screen target coordinate system and the world coordinate system;
aiming at the vertex of the building to be rendered, obtaining a vertex vector of the vertex based on the difference between the vertex coordinate of the vertex and the coordinate of the screen anchor point under a world coordinate system;
and obtaining the result of dot multiplication of the vertex vector of the vertex and the unit vector as the projection distance of the vertex in the set direction.
7. The method of any of claims 1-5, wherein if there are two or more vertices of the same building to be rendered, the method further comprises:
if the height coefficients respectively corresponding to the vertexes of the building to be rendered are not completely the same, determining one height coefficient from the height coefficients respectively corresponding to the vertexes of the building to be rendered as a target height coefficient;
And updating the height coefficients respectively corresponding to the vertexes of the building to be rendered into the target height coefficients.
8. A rendering device applied to software having a three-dimensional electronic map rendering function, the device comprising:
the rendering data acquisition module is used for responding to the software to enter a three-dimensional electronic map rendering scene and acquiring rendering data of a building to be rendered contained in the three-dimensional electronic map to be rendered;
The vertex coordinate acquisition module is used for acquiring vertex coordinates of the vertices of the building to be rendered based on the rendering data of the building to be rendered;
the projection distance calculation module is used for obtaining the projection distance between the vertex and the screen anchor point in a set direction based on the vertex coordinates of the vertex and the screen coordinates of the screen anchor point;
The height coefficient determining module is used for determining the height coefficient of the vertex of the building to be rendered based on the projection distance corresponding to the vertex of the building to be rendered, so that the screen height of the vertex of the building to be rendered is reduced based on the height coefficient when the building to be rendered is rendered.
9. An electronic device, comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor;
wherein the memory stores instructions executable by the at least one processor to cause the electronic device to perform the method of any one of claims 1-7.
10. A computer program product, characterized in that the computer program product comprises a computer program which, when executed by a processor, implements the method according to any of claims 1-7.
CN202311781358.8A 2023-12-22 2023-12-22 Rendering method, device, equipment and program product Pending CN118096986A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311781358.8A CN118096986A (en) 2023-12-22 2023-12-22 Rendering method, device, equipment and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311781358.8A CN118096986A (en) 2023-12-22 2023-12-22 Rendering method, device, equipment and program product

Publications (1)

Publication Number Publication Date
CN118096986A true CN118096986A (en) 2024-05-28

Family

ID=91146341

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311781358.8A Pending CN118096986A (en) 2023-12-22 2023-12-22 Rendering method, device, equipment and program product

Country Status (1)

Country Link
CN (1) CN118096986A (en)

Similar Documents

Publication Publication Date Title
US6323874B1 (en) System and method for rendering an image
US7275219B2 (en) Fast and accurate rendering of pliable display technology distortions using pre-calculated texel coverages
JP2002529868A (en) Shading of 3D computer generated images
KR101994317B1 (en) Navigation device, method of determining a height coordinate and method of generating a database
CN112288873B (en) Rendering method and device, computer readable storage medium and electronic equipment
CN110704770B (en) Display method and device for expansion tile map based on WebGIS environment
US8675013B1 (en) Rendering spherical space primitives in a cartesian coordinate system
CN112308969B (en) Three-dimensional map generation method and device
EP2589933B1 (en) Navigation device, method of predicting a visibility of a triangular face in an electronic map view
CN105447815A (en) Method and device for processing image of mobile terminal equipment
CN115409957A (en) Map construction method based on illusion engine, electronic device and storage medium
CN113724331B (en) Video processing method, video processing apparatus, and non-transitory storage medium
CN110458954B (en) Contour line generation method, device and equipment
US20210201522A1 (en) System and method of selecting a complementary image from a plurality of images for 3d geometry extraction
CN111275611B (en) Method, device, terminal and storage medium for determining object depth in three-dimensional scene
CN118096986A (en) Rendering method, device, equipment and program product
CN111862342A (en) Texture processing method and device for augmented reality, electronic equipment and storage medium
CN115511701A (en) Method and device for converting geographic information
CN114663615A (en) Electronic map display method and device and electronic equipment
CN114549775A (en) Rendering method, device and computer program product of electronic map
CN110910482B (en) Method, system and readable storage medium for video data organization and scheduling
CN110119458B (en) Grid retrieval method and device
CN109410304B (en) Projection determination method, device and equipment
CN109215134B (en) Occlusion determination method and device for three-dimensional model, computer equipment and storage medium
CN117218257A (en) Rendering method and device and electronic equipment

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