CN114494622A - Data processing method and device for optimizing terrain rendering - Google Patents

Data processing method and device for optimizing terrain rendering Download PDF

Info

Publication number
CN114494622A
CN114494622A CN202210068891.9A CN202210068891A CN114494622A CN 114494622 A CN114494622 A CN 114494622A CN 202210068891 A CN202210068891 A CN 202210068891A CN 114494622 A CN114494622 A CN 114494622A
Authority
CN
China
Prior art keywords
data
terrain
rendered
rendering
preset
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
CN202210068891.9A
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 Avic Shuangxing Technology Co ltd
Original Assignee
Beijing Avic Shuangxing 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 Avic Shuangxing Technology Co ltd filed Critical Beijing Avic Shuangxing Technology Co ltd
Priority to CN202210068891.9A priority Critical patent/CN114494622A/en
Publication of CN114494622A publication Critical patent/CN114494622A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/50Depth or shape recovery
    • G06T7/529Depth or shape recovery from texture
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping

Landscapes

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

Abstract

The application discloses a data processing method and device for optimizing terrain rendering. The method comprises the following steps: in the method, the data of the terrain blocks with different texture levels are obtained by performing hierarchical cutting processing on the acquired terrain data to be rendered, rendering operation is performed on the corresponding terrain block data according to different texture levels to obtain rendering structure data, optimization is performed in the terrain data rendering process by utilizing cutting mapping running in a GPU (graphics processing unit) of a computer, the technical problem of low efficiency in the process of rendering the terrain data in the prior art is solved, and the technical effects of effectively utilizing computer resources and improving the rendering efficiency are realized.

Description

Data processing method and device for optimizing terrain rendering
Technical Field
The application relates to the field of computer graphics, in particular to a data processing method and device for optimizing terrain rendering.
Background
The landform visualization is visual graphic expression of landforms, so that the original landforms and landforms are conveniently expressed, and data analysis is more conveniently carried out. In the prior art, when terrain rendering is carried out, the GPU is not sufficiently utilized, the performance of a CPU is influenced, and the problem of low efficiency in the process of terrain data rendering exists.
Therefore, the prior art has the technical problem of low efficiency in terrain data rendering.
Disclosure of Invention
The main purpose of the present application is to provide a data processing method and device for optimizing terrain rendering, so as to solve the technical problem of low efficiency in terrain data rendering in the prior art, and improve the efficiency in terrain data rendering.
In order to achieve the above object, a first aspect of the present application provides a data processing method for optimizing terrain rendering, including:
acquiring terrain data to be rendered and viewpoint data, wherein the terrain data to be rendered is data waiting for terrain rendering, and the viewpoint data is data used for observing the position of the terrain to be rendered;
performing hierarchical clipping processing on the terrain data to be rendered by using the viewpoint data to obtain rendering grade data, wherein the rendering grade data comprises a plurality of texture grades and data of terrain blocks corresponding to the texture grades; and
and mapping and rendering the rendering grade data to obtain rendering result data.
Preferably, the step of performing hierarchical clipping processing on the terrain data to be rendered by using the viewpoint data to obtain rendering level data includes:
determining preset texture grade data corresponding to the viewpoint data according to a preset viewpoint distance, wherein the preset texture grade data comprise a plurality of preset texture grades and a plurality of preset terrain blocks corresponding to the preset texture grades, the preset terrain blocks are concentric squares with viewpoints as centers, and the preset viewpoint distance is the distance between the viewpoints and the terrain blocks;
segmenting the terrain data to be rendered according to the plurality of preset terrain blocks to obtain a plurality of terrain blocks to be rendered; and
and matching a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered to obtain the rendering level data, wherein the rendering level data comprises a plurality of terrain block data to be rendered and a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered.
Preferably, the mapping rendering processing is performed on the rendering level data, and obtaining rendering result data includes:
identifying the rendering grade data to obtain a plurality of terrain block data to be rendered and a plurality of preset texture grades corresponding to the plurality of terrain blocks to be rendered;
sequencing the plurality of terrain block data to be rendered according to the plurality of preset texture levels to obtain rendering sequencing data;
extracting two adjacent terrain block data to be rendered from the rendering sequencing data to obtain first terrain block data to be rendered and second terrain block data to be rendered, wherein the first terrain block data to be rendered is terrain block data to be rendered corresponding to a higher preset texture level, and the second terrain block data to be rendered is terrain block data to be rendered corresponding to a lower preset texture level;
extracting first vertex cache data and second vertex cache data from the plurality of terrain block data to be rendered, wherein the first vertex cache data are data of vertexes of the plurality of terrain blocks to be rendered, and the second vertex cache data are data of vertexes corresponding to the second terrain block to be rendered; and
rendering the terrain block to be rendered according to the first vertex cache data and the second vertex cache data to obtain rendering result data, and the rendering result data comprises:
rendering the first terrain block data to be rendered according to the first vertex cache data to obtain first rendered terrain block data;
and rendering the second terrain block data to be rendered according to the second vertex cache data to obtain second rendered terrain block data.
Preferably, after obtaining the first to-be-rendered terrain block data and the second to-be-rendered terrain block data, the method further comprises:
identifying the first terrain block data to be rendered to obtain first edge vertex data, wherein the first edge vertex data is data of an outer edge vertex of the first terrain block to be rendered;
judging whether the first edge vertex data is in a preset gradual change area or not, if so, mixing the first terrain block data to be rendered and the second terrain block data to be rendered according to the first edge vertex data to obtain an edge fusion area; and
if not, the mixing treatment is not carried out.
Preferably, after matching a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered to obtain rendering level data, the method further comprises:
when the viewpoint is updated, acquiring updated viewpoint data, wherein the updated viewpoint data is updated data used for observing the position of the terrain to be rendered;
determining updated preset texture data corresponding to the updated viewpoint data according to the preset viewpoint distance data, wherein the updated preset texture data comprise the plurality of preset texture grades and a plurality of updated preset terrain blocks corresponding to the plurality of preset texture grades;
and cutting the terrain data to be rendered according to the updated preset texture data to obtain updated rendering grade data.
Preferably, the clipping processing is performed on the terrain data to be rendered according to the updated preset texture data, and obtaining updated rendering level data includes:
performing loopback addressing operation on the terrain data to be rendered according to the updated preset texture grade data to obtain updated terrain block data, wherein the updated terrain block data is data which is corresponding to the updated preset texture and updates the two-dimensional terrain of the terrain block to be rendered;
performing height updating on the terrain data to be rendered according to the updated preset texture grade data to obtain updated height data, wherein the updated height data is data of the height of the terrain block to be rendered, which corresponds to the updated preset texture;
performing normal updating on the terrain data to be rendered according to the updated preset texture grade data to obtain updated normal data, wherein the updated normal data is data of a normal of the terrain block to be rendered, which corresponds to the updated preset texture; and
and acquiring the updated rendering level data, wherein the updated rendering level data comprises the updated terrain block data, the updated altitude data and the updated normal data.
According to a second aspect of the application, a data processing apparatus for optimizing terrain rendering is proposed, comprising:
the data acquisition module is used for acquiring terrain data to be rendered and viewpoint data, wherein the terrain data to be rendered is data waiting for terrain rendering, and the viewpoint data is data used for observing the position of the terrain to be rendered;
the cutting module is used for carrying out hierarchical cutting processing on the terrain data to be rendered by utilizing the viewpoint data to obtain rendering grade data, wherein the rendering grade data comprises a plurality of texture grades and data of terrain blocks corresponding to the texture grades; and
and the rendering module is used for mapping and rendering the rendering grade data to obtain rendering result data.
Preferably, the cropping module comprises:
the device comprises a preset texture grade determining module, a preset texture grade determining module and a display module, wherein the preset texture grade determining module is used for determining preset texture grade data corresponding to viewpoint data according to a preset viewpoint distance, the preset texture grade data comprise a plurality of preset texture grades and a plurality of preset terrain blocks corresponding to the preset texture grades, the preset terrain blocks are concentric quadrate with a viewpoint as a center, and the preset viewpoint distance is the distance between the viewpoint and the terrain blocks;
the terrain segmentation module is used for segmenting the terrain data to be rendered according to the preset terrain blocks to obtain a plurality of terrain blocks to be rendered; and
and the texture matching module is used for matching a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered to obtain the rendering level data, wherein the rendering level data comprises a plurality of terrain block data to be rendered and a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered.
According to a third aspect of the present application, a computer-readable storage medium is presented, which stores computer instructions for causing the computer to perform the above-mentioned data processing method for optimizing terrain rendering.
According to a fourth aspect of the present application, there is provided an electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to cause the at least one processor to perform the above-mentioned data processing method for optimizing terrain rendering.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
in the method, the data of the terrain blocks with different texture levels are obtained by performing hierarchical cutting processing on the acquired terrain data to be rendered, rendering operation is performed on the corresponding terrain block data according to different texture levels to obtain rendering structure data, optimization is performed in the terrain data rendering process by utilizing cutting mapping running in a GPU (graphics processing unit) of a computer, the technical problem of low efficiency in the process of rendering the terrain data in the prior art is solved, and the technical effects of effectively utilizing computer resources and improving the rendering efficiency are realized.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, serve to provide a further understanding of the application and to enable other features, objects, and advantages of the application to be more apparent. The drawings and their description illustrate the embodiments of the invention and do not limit it. In the drawings:
fig. 1 is a schematic flowchart of a data processing method for optimizing terrain rendering according to the present application;
fig. 2 is a schematic flowchart of a data processing method for optimizing terrain rendering according to the present application;
fig. 3 is a schematic flowchart of a data processing method for optimizing terrain rendering according to the present application;
fig. 4 is a schematic flowchart of a data processing method for optimizing terrain rendering according to the present application;
fig. 5 is a schematic flowchart of a data processing method for optimizing terrain rendering according to the present application;
FIG. 6 is a flowchart illustrating a data processing method for optimizing terrain rendering according to the present application
FIG. 7 is a schematic structural diagram of a data processing apparatus for optimizing terrain rendering according to the present application;
fig. 8 is a schematic structural diagram of another data processing apparatus for optimizing terrain rendering according to the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In this application, the terms "upper", "lower", "left", "right", "front", "rear", "top", "bottom", "inner", "outer", "middle", "vertical", "horizontal", "lateral", "longitudinal", and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings. These terms are used primarily to better describe the present application and its embodiments, and are not used to limit the indicated devices, elements or components to a particular orientation or to be constructed and operated in a particular orientation.
Moreover, some of the above terms may be used to indicate other meanings besides the orientation or positional relationship, for example, the term "on" may also be used to indicate some kind of attachment or connection relationship in some cases. The specific meaning of these terms in this application will be understood by those of ordinary skill in the art as appropriate.
Furthermore, the terms "mounted," "disposed," "provided," "connected," and "sleeved" are to be construed broadly. For example, "connected" may be a fixed connection, a detachable connection, or a unitary construction; can be a mechanical connection, or an electrical connection; may be directly connected, or indirectly connected through intervening media, or may be in internal communication between two devices, elements or components. The specific meaning of the above terms in the present application can be understood by those of ordinary skill in the art as appropriate.
Fig. 1 is a schematic flowchart of a data processing method for optimizing terrain rendering according to the present application, and as shown in fig. 1, the method includes the following steps:
s101: acquiring terrain data and viewpoint data to be rendered;
the terrain data to be rendered is data waiting for terrain rendering, and the viewpoint data is data for observing the position of the terrain to be rendered.
S102: grading and cutting the terrain data to be rendered by using the viewpoint data to obtain rendering grade data;
the rendering level data includes a plurality of texture levels and data of terrain blocks corresponding to the plurality of texture levels. The method comprises the steps of determining texture levels of terrain data to be rendered through viewpoint data, processing the terrain data to be rendered into a mipmap pyramid (texture mapping pyramid) through a terrain block corresponding to the texture levels, wherein the terrain data to be rendered comprises a plurality of concentric squares, each concentric square corresponds to a level clipmap (cutting texture), the clipmap of the innermost level closest to the viewpoint corresponds to the highest level of terrain details in height map data to be rendered, and the clipmap of the continuous level far away from the viewpoint in radiation corresponds to the terrain details which are reduced step by step in the height map data to be rendered.
Fig. 2 is a schematic flowchart of a data processing method for optimizing terrain rendering according to the present application, and as shown in fig. 2, the method includes the following steps:
s201: determining preset texture grade data corresponding to the viewpoint data according to the preset viewpoint distance;
the preset texture grade data comprise a plurality of preset texture grades and a plurality of preset terrain blocks corresponding to the preset texture grades, the preset terrain blocks are concentric quadrate with a viewpoint as a center, and the preset viewpoint distance is the distance between the viewpoint and the terrain blocks; calculating a mipmap pyramid model corresponding to a current viewpoint, wherein a clipmap (clipping texture) of each level corresponds to a distance between the viewpoint and a preset terrain block, the number of clipmaps in the mipmap pyramid model is set according to rendering requirements, for example, the viewpoint distance is [0, a ], the clipmap of the innermost level corresponding to the terrain block is provided, and the terrain detail is the highest level in the rendering process; and determining the terrain blocks corresponding to the preset texture levels according to the preset texture levels and the viewpoint distances corresponding to the preset texture levels, wherein a, b and c are constants, and a is more than 0 and less than b and less than c.
S202: segmenting terrain data to be rendered according to a plurality of preset terrain blocks to obtain a plurality of terrain blocks to be rendered; and
and segmenting the terrain data to be rendered according to the mipmap pyramid model corresponding to the current viewpoint, and segmenting the terrain to be rendered according to the clipmaps of multiple levels in the mipmap pyramid model to obtain terrain blocks to be rendered corresponding to different clipmap levels.
S203: and matching a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered to obtain rendering level data.
The rendering grade data comprises a plurality of terrain block data to be rendered and a plurality of preset texture grades corresponding to the terrain blocks to be rendered, the terrain to be rendered is matched with the mipmap model determined according to the viewpoint according to the mipmap model determined by the current viewpoint and having a plurality of grades, the terrain to be rendered is divided into a plurality of terrain blocks to be rendered, and each terrain block to be rendered corresponds to a preset texture grade.
S103: and mapping and rendering the rendering grade data to obtain rendering result data.
Fig. 3 is a schematic flowchart of a data processing method for optimizing terrain rendering according to the present application, and as shown in fig. 3, the method includes the following steps:
s301: identifying rendering grade data to obtain a plurality of terrain block data to be rendered and a plurality of preset texture grades corresponding to the plurality of terrain blocks to be rendered;
s302: sequencing the data of the plurality of terrain blocks to be rendered according to the plurality of preset texture levels to obtain rendering sequencing data;
the preset texture grade data are sequenced according to preset texture grades corresponding to the innermost layer to the outermost layer of the concentric square, and data of a plurality of terrain blocks to be rendered are obtained, wherein the data are sequenced according to the preset texture grades.
S303: extracting two adjacent terrain block data to be rendered from the rendering sequencing data to obtain first terrain block data to be rendered and second terrain block data to be rendered;
the first to-be-rendered terrain block data is to-be-rendered terrain block data corresponding to a higher preset texture level, and the second to-be-rendered terrain block data is to-be-rendered terrain block data corresponding to a lower preset texture level;
s304: extracting first vertex cache data and second vertex cache data from a plurality of terrain block data to be rendered;
the first vertex cache data is data of vertexes of a plurality of terrain blocks to be rendered, and the second vertex cache data is data of vertexes corresponding to a second terrain block to be rendered;
the first vertex cache data is used for rendering a clipmap of the finest level in two adjacent terrain blocks to be rendered at preset texture levels, the first vertex cache data comprises vertexes required by all levels of clipmap grids, when the terrain data to be rendered is processed, each clipmap sets texture map resolution n multiplied by n according to the texture levels, wherein n is an odd number, each clipmap is divided into a plurality of terrain meshes according to the resolution corresponding to the texture levels, the first vertex cache data is data of vertexes in the plurality of divided terrain meshes in the terrain blocks to be rendered, and the second vertex data is data of vertexes in the plurality of divided terrain meshes in the second terrain block to be rendered.
S305: rendering the terrain block to be rendered according to the first vertex cache data and the second vertex cache data to obtain rendering result data, and the rendering result data comprises the following steps:
rendering the first terrain block data to be rendered according to the first vertex cache data to obtain first rendered terrain block data;
and rendering the first terrain block data to be rendered according to the data of the vertexes of all rendering grids in the first vertex cache data, and rendering the clipmap with the highest fineness degree.
And rendering the second terrain block data to be rendered according to the second vertex cache data to obtain second rendered terrain block data.
Except the clipmap corresponding to the highest fine level, the terrain data to be rendered is an annular terrain block, and vertex data of a rendering grid of the annular terrain block, which is segmented according to the resolution of a texture map, is acquired and used for rendering the clipmaps corresponding to all levels except the clipmap corresponding to the highest fine level.
In another alternative embodiment of the present application, the first vertex cache data and the second vertex cache data are segmented to obtain vertex cache filling blocks, for example, each level clipmap is filled multiple times by using one m × m vertex cache filling block,
Figure BDA0003479411250000101
if the clipmap size is 256, m is 64, so the vertex cache has 64 multiplied by 64 vertexes, a filling block is set to fill an outer ring of the clipmap of a non-finest level, and another filling block is set to fill an inner ring of the clipmap of the finest level.
In an alternative embodiment of the present application, a data processing method for optimizing terrain rendering is provided, and fig. 4 is a flowchart of the data processing method for optimizing terrain rendering, as shown in fig. 4, the method includes the following steps:
when terrain rendering is carried out, in order to avoid that when clipmap rendering corresponding to two adjacent texture levels is carried out on the same vertex data, the vertex data read by clipmaps corresponding to different texture levels have different precisions, so that the clipmaps of the two adjacent levels generate gaps, rendering effects are poor, and gap fusion processing is carried out between adjacent terrain blocks for optimizing the terrain rendering effects to be rendered.
S401: identifying the first terrain block data to be rendered to obtain first edge vertex data;
setting a gradual change area, where the data in the gradual change area is the data of the outer edge vertex of the first terrain block to be rendered, for example, setting the width of the gradual change area
Figure BDA0003479411250000111
The vertex set of 1/10 from outside to inside at the clipmap edge of the current level blends with the second terrain block to be rendered.
S402: judging whether the first edge vertex data is in a preset gradual change area, if so, mixing the first terrain block data to be rendered and the second terrain block data to be rendered according to the first edge vertex data to obtain an edge fusion area; and
judging whether the obtained first edge vertex data is located in a preset gradual change area, judging whether the first edge vertex data meets the rule of the preset gradual change area or not by calculating the distance between the viewpoint and the vertex of the first to-be-rendered terrain block data in each direction, and if the distance from the viewpoint to the vertex in each direction is larger than the distance from the viewpoint to the vertex in each direction
Figure BDA0003479411250000112
Figure BDA0003479411250000113
Wherein n is the number of vertices of a rendering grid in the terrain block to be rendered currently, w is the width of a preset gradual change region, the first edge vertex data is located in the preset gradual change region, and a mixing parameter α ═ max (α) is calculatedx,αy) Wherein, in the step (A),
Figure BDA0003479411250000114
coordinates (v)x,vy) That is, the range of the viewpoint in the clipmap coordinate system is [0, n-1 ]]The method comprises the steps of (a), (b), (c), (d) are coordinates of the clipmap coordinate system, and the edge fusion area data, wherein the edge fusion area data are data of the first edge vertex in a preset gradual change area, and the terrain rendering is performed according to the vertex data of the clipmap data of the clip map read vertex in the edge fusion area data of the clip map, and optimize the clip map data of the edge fusion area, the clip map, the edge fusion area, the clip map data of the two adjacent levels of the clip map, the clip map data of the clip map, the two adjacent levels of the two adjacent levels of the two of the.
S403: if not, the mixing treatment is not carried out.
If the first edge vertex data is not in the preset gradual change region, performing data rendering according to the clipmap level corresponding to the first edge vertex data, and not performing mixing processing, for example, if the distance from the viewpoint to the vertex in each direction does not satisfy the above condition, the vertex may be located in a non-gradual change region in the first terrain block to be rendered, performing terrain rendering according to the clipmap level corresponding to the first terrain block to be rendered, or the vertex may be located in a non-gradual change region in the second terrain block to be rendered, and performing terrain rendering according to the clipmap level corresponding to the second terrain block to be rendered.
In another optional embodiment of the present application, a data processing method for optimizing a terrain rendering during viewpoint updating is provided, and fig. 5 is a flowchart illustrating the data processing method for optimizing a terrain rendering provided by the present application, as shown in fig. 5, the method includes the following steps:
s501: when the viewpoint is updated, acquiring updated viewpoint data;
the updated viewpoint data is updated data for viewing the position of the terrain to be rendered.
S502: determining updated preset texture data corresponding to the updated viewpoint distance according to the preset viewpoint distance data;
and updating the preset texture data to comprise a plurality of preset texture levels and a plurality of updated preset terrain blocks corresponding to the preset texture levels, when the viewpoint is updated, determining a corresponding mipmap pyramid model according to the updated viewpoint data, and determining a terrain area corresponding to each clipmap according to the mipmap pyramid model.
S503: and cutting the terrain data to be rendered according to the updated preset texture data to obtain updated rendering grade data.
And cutting the terrain data to be rendered according to the mipmap pyramid model corresponding to the updated viewpoint to obtain a clipmap of each texture level on the terrain to be rendered, wherein the clipmap comprises the updated data of the terrain block corresponding to each texture level.
In another optional embodiment of the present application, a data processing method for optimizing a terrain rendering during viewpoint updating is provided, and fig. 6 is a flowchart illustrating the data processing method for optimizing a terrain rendering provided by the present application, as shown in fig. 6, the method includes the following steps:
s601: performing loopback addressing operation on the terrain data to be rendered according to the updated preset texture grade data to obtain updated terrain block data;
updating the terrain block data into data for updating the two-dimensional terrain of the terrain block to be rendered corresponding to the preset texture; calculating a clipmap range of a level from the position of a viewpoint, performing loopback addressing operation to determine an updated texture level, changing the area in a rendering frame, updating the area, and determining a clipmap origin in the updated level height map: the difference between the southwest corner of the clipmap of the same level and the last frame is added to the origin, and if the origin is separated from one side of the texture, the origin can be looped back to the other side; determining the updated equivalent clipmap new area: if the viewpoint moves to east, the area that needs to be updated starts after the most east point of the last clipmap range and then continues until the most east point of the next range of the same clipmap. If the viewpoint moves to west, the area to be updated starts from the point of the west-most side of the new range and continues to the point of the west-most side of the last range. The viewpoint moves north and south in the same manner as above, if the viewpoint moves only in one direction, i.e., east/west or south/north, the region to be updated is a rectangle, and if the viewer moves in both directions, the texels to be updated form an L-shaped region, and the two rectangular regions are used for updating. Wherein, the formula of the corresponding texture coordinate is judged:
texture=(textureOrigin+(terrain-levelOrigin))%clipmapSize
wherein terrain is the topographic coordinates of the point; levelOrigin is the southwest angular coordinate of the clipmap in the terrain coordinate system; textureOrigin is the coordinate in the texture corresponding to levelOrigin; and clipmapSize is the length of an edge of the clipmap height texture. If the terrain coordinates of a point are outside the clipmap range of a certain level, the texture coordinates of the point are undefined. With the loopback addressing operation, only the new visible point in the clipmap area of a certain level needs to be updated, covering the old point that is no longer visible, without having to re-update the entire clipmap of the level. When the viewpoint data is updated, the requirement of rewriting the whole clipmap texture by moving every time is avoided by loopback addressing, and when the viewpoint is moved, the real-time rendering efficiency is improved.
S602: according to the updated preset texture grade data, performing height updating on the terrain data to be rendered to obtain updated height data;
and updating the height data to update the height of the terrain block to be rendered corresponding to the preset texture. The height map texture of the current level clipmap is updated using GPU rasterization, the height map texture is mounted as a color attachment to a frame buffer, and a quadrilateral is then rendered. The frame buffer memory is written with the loopback addressing, and the updating area is divided into 1 to 4 simple rectangular non-loopback updating areas because the frame buffer memory does not support the loopback addressing. After the updating area is segmented, the updating area is segmented based on the rendering grids of the height data source, an updating area range in a terrain coordinate system is given, a rendering grid list forming the area needing to be updated is returned by the method, the set of all the rendering grid areas is equal to the updating area, and the height updating is carried out through a GPU.
S603: performing normal updating according to the terrain data to be rendered of the updated preset texture grade data to obtain updated normal data;
updating normal data to be the data of the normal of the terrain block to be rendered, which corresponds to the updated preset texture; and after the height map texture of the current level clipmap is completely updated, updating the normal map, rendering a quadrangle to a frame buffer, and using the set normal map as a color buffer of the frame buffer. The normal is computed in the fragment shader using the center difference algorithm and used as a height map for the source texture attached to the quadrilateral, which is the level clipmap. Unlike height-updating shaders, normal-updating shaders only require one origin, which is used to compute the destination vertex coordinates and the coordinates of the source texture, based on the fact that the normal is computed from heights around the same location. Due to the height pattern texture setting, the texture coordinates are normalized into the interval [0, 1 ]. The fragment shader samples the height map 4 times, obtains two partial derivatives by finite difference, and then computes its cross product to obtain the normal, where the normal computation is performed by considering the distance of two points on the height map in world space.
S604: and obtaining updated rendering level data.
Updating the rendering level data includes updating terrain block data, updating altitude data, and updating normal data.
In another optional embodiment of the present application, when the viewpoint data is updated, multi-thread and external memory based updating, up-sampling, data scheduling, compression and synthesis, texture shading, etc. are also included.
By the method, when the viewpoint position is updated, the situation that the viewpoint moves each time to rewrite the whole texture is avoided, and the rendering efficiency in the real-time terrain rendering process is improved.
Fig. 7 is a schematic structural diagram of a data processing apparatus for optimizing terrain rendering according to the present application, and as shown in fig. 7, the apparatus includes:
a data obtaining module 71, configured to obtain terrain data to be rendered and viewpoint data, where the terrain data to be rendered is data to be subjected to terrain rendering, and the viewpoint data is data used for observing a position of a terrain to be rendered;
the cutting module 72 is configured to perform hierarchical cutting processing on the terrain data to be rendered by using the viewpoint data to obtain rendering level data, where the rendering level data includes multiple texture levels and data of terrain blocks corresponding to the multiple texture levels; and
and the rendering module 73 is configured to perform mapping rendering processing on the rendering level data to obtain rendering result data.
Fig. 8 is a schematic structural diagram of a data processing apparatus for optimizing terrain rendering according to the present application, and as shown in fig. 8, the apparatus includes:
the preset texture level determining module 81 is configured to determine preset texture level data corresponding to the viewpoint data according to a preset viewpoint distance, where the preset texture level data includes a plurality of preset texture levels and a plurality of preset terrain blocks corresponding to the plurality of preset texture levels, the plurality of preset terrain blocks are concentric squares with the viewpoint as a center, and the preset viewpoint distance is a distance between the viewpoint and the terrain blocks;
the terrain segmentation module 82 is used for segmenting terrain data to be rendered according to a plurality of preset terrain blocks to obtain a plurality of terrain blocks to be rendered; and
and the texture matching module 83 is configured to match a plurality of preset texture levels corresponding to a plurality of to-be-rendered terrain blocks to obtain rendering level data, where the rendering level data includes a plurality of to-be-rendered terrain block data and a plurality of preset texture levels corresponding to the plurality of to-be-rendered terrain blocks.
The specific manner of executing the operations of the units in the above embodiments has been described in detail in the embodiments related to the method, and will not be elaborated herein.
In summary, in the present application, the data of the terrain blocks with different texture levels are obtained by performing hierarchical clipping processing on the acquired terrain data to be rendered, rendering operation is performed on the corresponding terrain block data according to different texture levels to obtain rendering structure data, and the terrain data rendering process is optimized by using the clipping mapping running in the GPU of the computer, so that the technical problem of low efficiency in the process of performing terrain data rendering in the prior art is solved, and the technical effects of effectively utilizing computer resources and improving rendering efficiency are achieved.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
It will be apparent to those skilled in the art that the various elements or steps of the present application described above may be implemented by a general purpose computing device, centralized on a single computing device or distributed across a network of multiple computing devices, or alternatively, may be implemented by program code executable by a computing device, such that the program code may be stored in a memory device and executed by a computing device, or may be implemented by individual integrated circuit modules, or by a plurality of modules or steps included in the program code as a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A data processing method for optimizing terrain rendering, comprising:
acquiring terrain data to be rendered and viewpoint data, wherein the terrain data to be rendered is data waiting for terrain rendering, and the viewpoint data is data used for observing the position of the terrain to be rendered;
performing hierarchical clipping processing on the terrain data to be rendered by using the viewpoint data to obtain rendering grade data, wherein the rendering grade data comprises a plurality of texture grades and data of terrain blocks corresponding to the texture grades; and
and mapping and rendering the rendering grade data to obtain rendering result data.
2. The data processing method according to claim 1, wherein performing hierarchical clipping processing on the terrain data to be rendered by using the viewpoint data to obtain rendering level data comprises:
determining preset texture grade data corresponding to the viewpoint data according to a preset viewpoint distance, wherein the preset texture grade data comprise a plurality of preset texture grades and a plurality of preset terrain blocks corresponding to the preset texture grades, the preset terrain blocks are concentric squares with viewpoints as centers, and the preset viewpoint distance is the distance between the viewpoints and the terrain blocks;
segmenting the terrain data to be rendered according to the plurality of preset terrain blocks to obtain a plurality of terrain blocks to be rendered; and
and matching a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered to obtain the rendering level data, wherein the rendering level data comprises a plurality of terrain block data to be rendered and a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered.
3. The data processing method of claim 1, wherein performing mapping rendering processing on the rendering level data to obtain rendering result data comprises:
identifying the rendering grade data to obtain a plurality of terrain block data to be rendered and a plurality of preset texture grades corresponding to the plurality of terrain blocks to be rendered;
sequencing the plurality of terrain block data to be rendered according to the plurality of preset texture levels to obtain rendering sequencing data;
extracting two adjacent terrain block data to be rendered from the rendering sequencing data to obtain first terrain block data to be rendered and second terrain block data to be rendered, wherein the first terrain block data to be rendered is terrain block data to be rendered corresponding to a higher preset texture level, and the second terrain block data to be rendered is terrain block data to be rendered corresponding to a lower preset texture level;
extracting first vertex cache data and second vertex cache data from the plurality of terrain block data to be rendered, wherein the first vertex cache data are data of vertexes of the plurality of terrain blocks to be rendered, and the second vertex cache data are data of vertexes corresponding to the second terrain block to be rendered; and
rendering the terrain block to be rendered according to the first vertex cache data and the second vertex cache data to obtain rendering result data, and the rendering result data comprises:
rendering the first terrain block data to be rendered according to the first vertex cache data to obtain first rendered terrain block data;
and rendering the second terrain block data to be rendered according to the second vertex cache data to obtain second rendered terrain block data.
4. A method of data processing according to claim 3, wherein after obtaining the first and second to-be-rendered terrain block data, the method further comprises:
identifying the first terrain block data to be rendered to obtain first edge vertex data, wherein the first edge vertex data is data of an outer edge vertex of the first terrain block to be rendered;
judging whether the first edge vertex data is in a preset gradual change area or not, if so, mixing the first terrain block data to be rendered and the second terrain block data to be rendered according to the first edge vertex data to obtain an edge fusion area; and
if not, the mixing treatment is not carried out.
5. The data processing method of claim 2, wherein after matching a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered to obtain rendering level data, the method further comprises:
when the viewpoint is updated, acquiring updated viewpoint data, wherein the updated viewpoint data is updated data used for observing the position of the terrain to be rendered;
determining updated preset texture data corresponding to the updated viewpoint data according to the preset viewpoint distance data, wherein the updated preset texture data comprise the plurality of preset texture grades and a plurality of updated preset terrain blocks corresponding to the plurality of preset texture grades;
and cutting the terrain data to be rendered according to the updated preset texture data to obtain updated rendering grade data.
6. The data processing method according to claim 5, wherein performing clipping processing on the terrain data to be rendered according to the updated preset texture data to obtain updated rendering level data comprises:
performing loopback addressing operation on the terrain data to be rendered according to the updated preset texture grade data to obtain updated terrain block data, wherein the updated terrain block data is data which is corresponding to the updated preset texture and updates the two-dimensional terrain of the terrain block to be rendered;
performing height updating on the terrain data to be rendered according to the updated preset texture grade data to obtain updated height data, wherein the updated height data is data of the height of the terrain block to be rendered, which corresponds to the updated preset texture;
performing normal updating on the terrain data to be rendered according to the updated preset texture grade data to obtain updated normal data, wherein the updated normal data is data of a normal of the terrain block to be rendered, which corresponds to the updated preset texture; and
and acquiring the updated rendering level data, wherein the updated rendering level data comprises the updated terrain block data, the updated altitude data and the updated normal data.
7. A data processing apparatus for optimizing terrain rendering, comprising:
the data acquisition module is used for acquiring terrain data to be rendered and viewpoint data, wherein the terrain data to be rendered is data waiting for terrain rendering, and the viewpoint data is data used for observing the position of the terrain to be rendered;
the cutting module is used for carrying out hierarchical cutting processing on the terrain data to be rendered by utilizing the viewpoint data to obtain rendering grade data, wherein the rendering grade data comprises a plurality of texture grades and data of terrain blocks corresponding to the texture grades; and
and the rendering module is used for mapping and rendering the rendering grade data to obtain rendering result data.
8. The data processing apparatus of claim 7, wherein the cropping module comprises:
the device comprises a preset texture grade determining module, a preset texture grade determining module and a display module, wherein the preset texture grade determining module is used for determining preset texture grade data corresponding to viewpoint data according to a preset viewpoint distance, the preset texture grade data comprise a plurality of preset texture grades and a plurality of preset terrain blocks corresponding to the preset texture grades, the preset terrain blocks are concentric quadrate with a viewpoint as a center, and the preset viewpoint distance is the distance between the viewpoint and the terrain blocks;
the terrain segmentation module is used for segmenting the terrain data to be rendered according to the preset terrain blocks to obtain a plurality of terrain blocks to be rendered; and
and the texture matching module is used for matching a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered to obtain the rendering level data, wherein the rendering level data comprises a plurality of terrain block data to be rendered and a plurality of preset texture levels corresponding to the plurality of terrain blocks to be rendered.
9. A computer-readable storage medium storing computer instructions for causing a computer to perform the data processing method for optimizing terrain rendering according to any one of claims 1-6.
10. An electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to cause the at least one processor to perform the data processing method for optimizing terrain rendering of any of claims 1-6.
CN202210068891.9A 2022-01-20 2022-01-20 Data processing method and device for optimizing terrain rendering Pending CN114494622A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210068891.9A CN114494622A (en) 2022-01-20 2022-01-20 Data processing method and device for optimizing terrain rendering

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210068891.9A CN114494622A (en) 2022-01-20 2022-01-20 Data processing method and device for optimizing terrain rendering

Publications (1)

Publication Number Publication Date
CN114494622A true CN114494622A (en) 2022-05-13

Family

ID=81471955

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210068891.9A Pending CN114494622A (en) 2022-01-20 2022-01-20 Data processing method and device for optimizing terrain rendering

Country Status (1)

Country Link
CN (1) CN114494622A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102890829A (en) * 2011-10-24 2013-01-23 克拉玛依红有软件有限责任公司 Method for rendering terrain based on graphic processing unit (GPU)
US20130321443A1 (en) * 2012-06-05 2013-12-05 Aroon Pahwa Method, system and apparatus for rendering a map with adaptive textures for map features
CN111494944A (en) * 2020-04-22 2020-08-07 浙江无端科技股份有限公司 Terrain texture loading method and related device
CN112740278A (en) * 2018-09-28 2021-04-30 高通股份有限公司 Blending adjacent bins
CN112884875A (en) * 2021-03-19 2021-06-01 腾讯科技(深圳)有限公司 Image rendering method and device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102890829A (en) * 2011-10-24 2013-01-23 克拉玛依红有软件有限责任公司 Method for rendering terrain based on graphic processing unit (GPU)
US20130321443A1 (en) * 2012-06-05 2013-12-05 Aroon Pahwa Method, system and apparatus for rendering a map with adaptive textures for map features
CN112740278A (en) * 2018-09-28 2021-04-30 高通股份有限公司 Blending adjacent bins
CN111494944A (en) * 2020-04-22 2020-08-07 浙江无端科技股份有限公司 Terrain texture loading method and related device
CN112884875A (en) * 2021-03-19 2021-06-01 腾讯科技(深圳)有限公司 Image rendering method and device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈秉塬等: "基于信息熵的分块地表模型无缝绘制方法", 科学技术与工程, vol. 16, no. 31, 8 November 2016 (2016-11-08) *

Similar Documents

Publication Publication Date Title
JP3840014B2 (en) Scan conversion execution apparatus for graphics display system
US7884825B2 (en) Drawing method, image generating device, and electronic information apparatus
US7167171B2 (en) Methods and apparatuses for a polygon binning process for rendering
KR101085390B1 (en) Image presenting method and apparatus for 3D navigation, and mobile apparatus comprising the same apparatus
US7626591B2 (en) System and method for asynchronous continuous-level-of-detail texture mapping for large-scale terrain rendering
US9019271B2 (en) Z-culling method, three-dimensional graphics processing method and apparatus threrof
US20140267258A1 (en) Hidden Culling in Tile-Based Computer Generated Images
EP2209092A1 (en) Method for unified visualisation of heterogeneous datasets
US6424345B1 (en) Binsorter triangle insertion optimization
US7358969B2 (en) Method and system for partitioning the surface of a three dimentional digital object model in order to map a texture
US8059121B2 (en) Method and aircraft display system for generating three dimensional image
US6181346B1 (en) Graphics system
Valdetaro et al. LOD terrain rendering by local parallel processing on GPU
CN114092575B (en) Digital earth real-time coloring method and device
US6714195B1 (en) Image processing apparatus
CN104574489B (en) Landform and motion vector integrated approach based on lamination quaternary tree atlas
Brodersen Real-time visualization of large textured terrains
CN112017286A (en) Seamless splicing display simulation method for digital earth skirt-free terrain tiles
CN114494622A (en) Data processing method and device for optimizing terrain rendering
US7372466B2 (en) Image processing apparatus and method of same
Kuder et al. Point-based rendering optimization with textured meshes for fast LiDAR visualization
US20040181373A1 (en) Visual simulation of dynamic moving bodies
CN114155346B (en) Data processing method and device for terrain matching
US8576219B2 (en) Linear interpolation of triangles using digital differential analysis
Đurđević et al. Domino tiling: a new method of real-time conforming mesh construction for rendering changeable height fields

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