Complex terrain texture mapping optimization method and system

By extracting the terrain characteristics of complex terrain and predicting texture requirements, combining viewpoint position prediction and visible terrain area division, a texture loading priority list is generated, which solves the problem of unintelligent texture loading under complex terrain and improves rendering performance and fluency.

CN119810361AActive Publication Date: 2025-04-11BEIJING WEISHIWEI INFORMATION TECH CO LTD

Patent Information

Application Number
CN202510306778.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-15
Publication Date
2025-04-11
Estimated Expiration
2045-03-15

AI Technical Summary

Technical Problem

The existing technology lacks intelligent texture loading methods in complex terrain, resulting in a degradation of rendering performance.

Method used

By extracting the topographic features of complex terrain, generating a topographic feature map, and using the texture demand prediction model to predict texture requirements, combining viewpoint position prediction and visible terrain area division, a priority list for texture loading is generated.

Benefits of technology

It realizes intelligent loading and unloading of textures under complex terrain, improves rendering performance and fluency, and reduces memory and bandwidth consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810361A_ABST
    Figure CN119810361A_ABST
Patent Text Reader

Abstract

The invention discloses a complex terrain texture mapping optimization method and system, and relates to the technical field of computer vision, and the method comprises the steps: extracting the topographic features of a complex terrain, and generating a topographic feature map; historical topographic features are collected, a texture demand prediction model is used to learn an association relationship between the topographic features and texture demands, a topographic feature map is input, and the texture demands are output; obtaining a viewpoint position and a sight line direction in real time, and determining a visible terrain area in the current view cone model; determining a predicted viewpoint position in future time according to the viewpoint position, the moving speed and the acceleration; according to the current topographic feature map, the texture demand and the predicted viewpoint position, a texture loading priority list is generated, and intelligent texture loading and unloading under the complex topography are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer vision technology, and in particular to a complex terrain texture mapping optimization method and system. Background Art

[0002] In computer graphics, texture mapping is a technique that maps image textures onto the surface of three-dimensional objects to increase visual detail and realism. It mainly includes terrain data acquisition, texture selection and generation, UV coordinate mapping, multi-level texture mapping, texture blending and transition, detail texture and resolution optimization, real-time rendering and lighting calculation, etc.

[0003] A Chinese patent with publication number CN117956179A discloses a texture mapping optimization method based on texture compression and texture pre-fetching, comprising the following steps: S1: before transmission, the server compresses and stores the texture data; S2: according to the changes in the scene in the client, the compressed texture data that may be needed is pre-fetched from the server in advance and stored in the local cache of the client; S3: according to the demand for rendering objects due to scene changes, the client decompresses the compressed texture data to be used, loads the texture data to be used in real time, and binds the texture data to the corresponding rendering object; the rendering engine of the terminal device installed with the client renders the rendering object bound to the texture data and outputs the rendering image.

[0004] For complex terrain models, such as mountains and canyons, a large amount of texture data is usually required. Therefore, it is unrealistic to load all the texture data at once, because this will consume a lot of memory and bandwidth resources, resulting in a decrease in rendering performance. The existing texture mapping method lacks intelligent loading of textures under complex terrain. Summary of the invention

[0005] The present application aims to solve at least one of the technical problems in the related art to a certain extent. To this end, one purpose of the present application is to propose a complex terrain texture mapping optimization method and system, which realizes intelligent loading and unloading of textures under complex terrain.

[0006] One aspect of the present application provides a complex terrain texture mapping optimization method, comprising: Step S100: extracting terrain features of complex terrain and generating a terrain feature map; Step S200: collecting historical terrain features, using a texture demand prediction model to learn the correlation between terrain features and texture requirements, inputting a terrain feature map, and outputting texture requirements; Step S300: acquiring the viewpoint position and the sight line direction in real time, and determining the visible terrain area within the current view frustum model; Step S400: determining the predicted viewpoint position in the future time according to the viewpoint position, moving speed and acceleration; Step S500: Generate a priority list of texture loading according to the current terrain feature map, texture requirements and predicted viewpoint position; The specific method of extracting the terrain features of complex terrain and generating a terrain feature map is as follows: Step S110: Obtaining the elevation data H(x, y) of the complex terrain and the resolution W×H of the elevation data; wherein (x, y) represents the horizontal coordinates of the terrain pixel point, the value of H(x, y) represents the terrain height at (x, y), and W and H are the width and height of the elevation data respectively; Step S120: Determine the number of levels according to the resolution of the elevation data and define a multi-scale elevation pyramid ;in, Indicates the scale level, is the number of levels, and the elevation data of each scale level in the multi-scale elevation pyramid is obtained by downsampling. Represents elevation data at scale level l; Step S130: extracting terrain features at each scale level l, wherein the terrain features include macro-scale features, meso-scale features and micro-scale features; Step S140: Fusing terrain features at different scale levels to generate a terrain feature map; The method for constructing the multi-scale elevation pyramid is as follows: The elevation data is taken as the 0th layer of the multi-scale elevation pyramid, denoted as ; For each scale level, perform Gaussian convolution on the elevation data of the previous level to obtain smoothed elevation data, and then downsample the smoothed elevation data to obtain elevation data with half the resolution, until the number of levels of the multi-scale elevation pyramid reaches L; The specific method of collecting historical terrain features, using the texture demand prediction model to learn the correlation between terrain features and texture requirements, inputting a terrain feature map, and outputting texture requirements is as follows: Step S210: For each complex terrain type i, collect its historical terrain features and construct a terrain feature map sample and the corresponding texture requirement tag The texture requirement labels are divided into texture type labels and texture quantity labels. A relationship mapping library is constructed based on terrain feature map samples and corresponding texture requirement labels. ; where i represents the complex terrain type variable, M is the total number of complex terrain types, represents the jth terrain feature map sample of the i-th complex terrain type, , They represent the texture type label and texture quantity label corresponding to the jth terrain feature map sample of the i-th complex terrain type, is the number of samples of terrain feature map; Step S220: obtaining a large-scale terrain texture dataset, designing a general texture demand prediction model based on a deep convolutional neural network model, and training it using the large-scale terrain texture dataset, optimizing the model parameter θ by a gradient descent algorithm, and obtaining a pre-trained general texture demand prediction model; Step S230: fine-tuning the general texture demand prediction model using the relationship mapping library to obtain a texture demand prediction model for complex terrain; Step S240: Input the terrain feature map based on the texture requirement prediction model for complex terrain and output the texture requirement ; The specific method of fine-tuning the general texture demand prediction model using the relationship mapping library to obtain the texture demand prediction model for complex terrain is: The general texture demand prediction model has L layers. The convolution layer whose feature map size is greater than or equal to the bottom layer threshold is defined as the bottom layer. The parameters of the bottom convolution layer of the general texture demand prediction model are fixed. The fully connected layer whose feature map size is less than or equal to the top layer threshold is defined as the top layer. The parameters of the top fully connected layer are updated. The specific method of obtaining the viewpoint position and the line of sight direction in real time and determining the visible terrain area in the current frustum model is: Step S310: Obtaining the viewpoint position and sight direction , with the viewpoint position v as the vertex, the line of sight direction d as the central axis, and the field of view angle α as the opening angle, the cone model is constructed ; Where p represents a point in the viewing cone model, is the vector angle, Represents the vector between the point in the frustum model and the viewpoint position With sight direction The angle of Step S320: interactively calculating the view cone model and the elevation data of the complex terrain to obtain a visible terrain area in the view cone model; Step S330: according to the distance between the viewpoint position and the visible terrain area, a distance threshold of each layer is set, and the visible terrain area is divided into K layers, where K is the number of layers; The specific method of interactively calculating the view cone model and the elevation data of the complex terrain to obtain the visible terrain area in the view cone model is: Step S321: Divide the terrain into blocks, each terrain block has a corresponding bounding box, and for the bounding box of each terrain block, perform a frustum intersection test to obtain terrain blocks that intersect with the frustum model or are inside the frustum model. All terrain blocks that intersect with the frustum model or are inside the frustum model form a potential visible set; Step S322: sorting the terrain blocks in the potential visible set from near to far according to the distance from the terrain block to the bounding box viewpoint, to obtain a terrain block list; Step S323: Create a depth buffer and initialize the depth value of the depth buffer to the maximum depth value; Step S324: traverse the sorted terrain block list, perform a depth test on each terrain block, and obtain a visible terrain block; Step S325: Collect all visible terrain blocks to form a final visible terrain area; The method for setting the distance threshold of each layer is: Step S331: For each terrain block, calculate its local roughness ; Step S332: Calculate the adjustment factor of the distance span according to the local roughness of the terrain block ; Step S333: According to the moving speed of the viewpoint , calculate the adjustment factor for the distance span ; Step S334: Calculate the adjustment factor of the distance span according to the real-time frame rate f of the rendering device ; Step S335: Calculate the distance threshold of the kth layer according to the adjustment factor of the distance span corresponding to the local roughness, the moving speed of the viewpoint and the real-time frame rate of the rendering device. ; The specific method of dividing the visible terrain area into K layers is: Step S336: Based on the viewpoint height , calculate the adjustment factor of the number of layers ; Step S337: Based on the average local roughness of the terrain , calculate the adjustment factor of the number of layers ; Step S338: Based on the real-time frame rate of the rendering device , calculate the adjustment factor of the number of layers ; Step S339: Calculate the number of layers K based on the viewpoint height, the average local roughness of the terrain, and the adjustment factor of the number of layers corresponding to the real-time frame rate of the rendering device; The specific method for determining the predicted viewpoint position in the future time according to the viewpoint position, moving speed and acceleration is: Step S410: Obtain the viewpoint position sequence according to the viewpoint position, moving speed and acceleration in the past time period T , speed sequence and acceleration sequence , establish a viewpoint motion model; Step S420: Based on the viewpoint motion model, the predicted viewpoint position at the future time t+τ is calculated by a numerical integration method; The specific method of generating a priority list of texture loading according to the current terrain feature map, texture requirements and predicted viewpoint position is: Step S510: Calculate the distance from the predicted viewpoint position to the visible terrain area to obtain the viewpoint distance ; Step S520: For each visible terrain area The horizontal coordinates of the terrain pixels within , perform weighted summation of the terrain feature map, texture type and texture quantity, and viewpoint distance of the terrain pixel point to calculate the texture loading priority ; Step S530: Horizontal coordinates of each terrain pixel point in each level of the visible terrain area , calculate the average value of the texture loading priority in the neighborhood of the terrain pixel point , update the texture loading priority of all terrain pixels in the neighborhood of the terrain pixel to the average value, and generate a priority list based on the texture loading priority of each terrain pixel.

[0007] One aspect of the present application provides a complex terrain texture mapping optimization system, comprising: A terrain feature extraction module is used to extract the terrain features of complex terrain and generate a terrain feature map; The texture demand prediction module is used to collect historical terrain features, use the texture demand prediction model to learn the correlation between terrain features and texture requirements, input terrain feature maps, and output texture requirements; The visible area extraction module is used to obtain the viewpoint position and line of sight direction in real time and determine the visible terrain area within the current frustum model; A viewpoint position prediction module, used to determine the predicted viewpoint position in the future time according to the viewpoint position, moving speed and acceleration; The priority list generation module is used to generate a priority list for texture loading based on the current terrain feature map, texture requirements and predicted viewpoint position.

[0008] Compared with the prior art, the complex terrain texture mapping optimization method and system proposed in this application have the following advantages: This application introduces a terrain feature map, extracts multi-scale features of complex terrain and fuses them to form a terrain feature map, predicts texture requirements based on the terrain feature map, takes into account the terrain characteristics of complex terrain, and uses the texture requirement obtained based on this as an indicator for deciding the priority of terrain pixels. It solves the problem of establishing the association between terrain features and texture requirements under complex terrain, takes into account the impact of terrain features on texture loading priority, and makes priority decisions more intelligent and reasonable.

[0009] The prediction results of the texture demand prediction model proposed in this application serve as the key input for priority calculation, which assigns different texture demand weights to different terrain areas, making priority decisions more accurate. At the same time, through model fine-tuning, the prediction results are targeted at specific complex terrains, further improving the effectiveness of priority decisions.

[0010] This application introduces viewpoint prediction information into priority decision-making, making the decision-making process more forward-looking. When calculating texture priority, texture data that may be needed in the future is loaded in advance. This predictive priority decision-making method can effectively reduce sudden loading of textures and improve the smoothness and fluidity of rendering.

[0011] This application comprehensively considers terrain features, texture requirements, and viewpoint distance factors to perform priority calculations, making priority decisions more comprehensive and reasonable. Through weighted summation, the importance of different factors can be flexibly adjusted, so that priority calculations can adapt to different complex terrains and rendering requirements. At the same time, the priority smoothing method of neighborhood average processing improves the integrity and continuity of decision-making while also reducing the problem of unstable rendering quality that may be caused by priority mutations. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 A method flow chart of the complex terrain texture mapping optimization method provided in this application; Figure 2 Flowchart of the texture demand prediction method provided for this application; Figure 3 A flow chart of the texture loading priority decision method provided for this application; Figure 4 Functional module diagram of the complex terrain texture mapping optimization system provided in this application. DETAILED DESCRIPTION

[0013] In order to better understand the present application, various aspects of the present application will be described in more detail with reference to the accompanying drawings. It should be understood that these detailed descriptions are only descriptions of exemplary embodiments of the present application and do not limit the scope of the present application in any way. Throughout the specification, the same reference numerals refer to the same elements. The expression "and / or" includes any and all combinations of one or more of the associated listed items.

[0014] In the accompanying drawings, the size, dimensions and shapes of the elements have been slightly adjusted for ease of illustration. The drawings are for illustration only and are not strictly drawn to scale. As used herein, the terms "substantially", "approximately" and similar terms are used as terms of approximation, not as terms of degree, and are intended to illustrate the inherent deviations in measurements or calculations that will be recognized by those of ordinary skill in the art. In addition, in this application, the order in which the steps are described does not necessarily represent the order in which these processes occur in actual operation, unless otherwise specified or can be derived from the context.

[0015] It should also be understood that expressions such as "including", "comprising", "having", "containing" and / or "comprising" are open rather than closed expressions in this specification, which indicate the presence of the stated features, elements and / or components, but do not exclude the presence of one or more other features, elements, components and / or combinations thereof. In addition, when expressions such as "at least one of..." appear after a list of listed features, they modify the entire list of features rather than just the individual elements in the list. In addition, when describing embodiments of the present application, "may" is used to mean "one or more embodiments of the present application". And, the term "exemplary" is intended to refer to an example or illustration.

[0016] Unless otherwise defined, all words (including engineering terms and scientific and technological terms) used in this article have the same meaning as those commonly understood by ordinary technicians in the field to which this application belongs. It should also be understood that unless there is a clear explanation in this application, words defined in commonly used dictionaries should be interpreted as having the same meaning as their meaning in the context of the relevant technology, and should not be interpreted in an idealized or overly formal sense.

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

[0018] Example 1

[0019] like Figure 1 As shown, the complex terrain texture mapping optimization method provided by this application includes: Step S100: extracting terrain features of complex terrain and generating a terrain feature map; The specific method of extracting the terrain features of complex terrain and generating a terrain feature map is as follows: Step S110: Obtaining the elevation data H(x, y) of the complex terrain and the resolution W×H of the elevation data; wherein (x, y) represents the horizontal coordinates of the terrain pixel point, the value of H(x, y) represents the terrain height at (x, y), and W and H are the width and height of the elevation data respectively; The width and height of the elevation data correspond to the value ranges of the horizontal coordinates x and y of the terrain respectively; The resolution of the elevation data H(x,y) is W×H, that is, there are W sampling points in the longitude direction and H sampling points in the latitude direction. Therefore, the value interval of x is [0, W-1], and the value interval of y is [0, H-1]; Step S120: Determine the number of levels according to the resolution of the elevation data and define a multi-scale elevation pyramid ;in, Indicates the scale level, is the number of levels, and the elevation data of each scale level in the multi-scale elevation pyramid is obtained by downsampling; The method for constructing the multi-scale elevation pyramid is as follows: The elevation data is taken as the 0th layer of the multi-scale elevation pyramid, denoted as ; For each scale level, perform Gaussian convolution on the elevation data of the previous level to obtain smoothed elevation data, and then downsample the smoothed elevation data to obtain elevation data with half the resolution, until the number of levels of the multi-scale elevation pyramid reaches L; The calculation formula of the smoothed elevation data is: ;in, is the Gaussian convolution kernel, wi and wj refer to the coordinate offset relative to the center of the convolution kernel, is the convolution kernel size; The calculation formula for the downsampling is: ; The calculation formula for the number of levels is: ;in, is a logarithmic function, To round down; Step S130: extracting terrain features at each scale level l, wherein the terrain features include macro-scale features, meso-scale features and micro-scale features; The method for obtaining the macro-scale features is: by analyzing the elevation data of each scale level Conduct trend surface analysis to extract the overall undulation trend of complex terrain , and obtain macroscopic scale characteristics; The method for obtaining the mesoscale features is: by analyzing the elevation data of each scale level Calculating terrain curvature , and obtain the mesoscale features of complex terrain; The terrain elements include ridges, valley bottoms, and slopes; The calculation formula of the terrain curvature is: ,in, , For elevation data The first-order partial derivative of , , For elevation data The second-order partial derivative of ; The method for obtaining the microscopic scale feature is as follows: presetting the local window radius r, performing the elevation data of each local window in each scale level Calculate local variance , and obtain microscopic scale characteristics; The calculation formula of the local variance is: , where ri and rj represent the coordinate offsets relative to the terrain pixel points, is the local window radius, is the mean value of elevation data in the local window; The value of the local window radius is set by those skilled in the art based on experience.

[0020] Step S140: Fusing terrain features at different scale levels to generate a terrain feature map; The topographic feature map is represented as: ; The above steps construct a multi-scale elevation pyramid, extract and fuse terrain features of different scales, and obtain a multi-scale terrain feature map, which provides a data basis for subsequent texture demand prediction and texture loading priority analysis.

[0021] Step S200: collecting historical terrain features, using a texture demand prediction model to learn the correlation between terrain features and texture requirements, inputting a terrain feature map, and outputting texture requirements; like Figure 2 As shown, the specific method of collecting historical terrain features, using the texture demand prediction model to learn the correlation between terrain features and texture requirements, inputting a terrain feature map, and outputting texture requirements is: Step S210: For each complex terrain type i, collect its historical terrain features and construct a terrain feature map sample and the corresponding texture requirement tag The texture requirement labels are divided into texture type labels and texture quantity labels. A relationship mapping library is constructed based on terrain feature map samples and corresponding texture requirement labels. ; where i represents the complex terrain type variable, M is the total number of complex terrain types, represents the jth terrain feature map sample of the i-th complex terrain type, , They represent the texture type label and texture quantity label corresponding to the jth terrain feature map sample of the i-th complex terrain type, is the number of samples of terrain feature map; The texture requirement indicates the type and quantity of texture resources required in a specific terrain area in order to achieve the expected rendering quality and visual effect.

[0022] Different terrain types require different kinds of textures to represent them, such as rock, sand, and grass. Predicting the types of textures helps determine the primary texture resources needed for each terrain area.

[0023] The number of textures reflects the amount of texture resources required for a specific terrain area. Complex terrain requires more texture resources to achieve the expected rendering quality, while simple terrain requires relatively fewer texture resources. The purpose of predicting the number of textures is to estimate the texture resource requirements of each terrain area and then evaluate the priority of texture loading.

[0024] Step S220: obtaining a large-scale terrain texture dataset, designing a general texture demand prediction model based on a deep convolutional neural network model, and training it using the large-scale terrain texture dataset, optimizing the model parameter θ by a gradient descent algorithm, and obtaining a pre-trained general texture demand prediction model; The large-scale terrain texture dataset includes terrain texture images and corresponding texture type and quantity labels.

[0025] The input of the general texture demand prediction model is a terrain texture image, and the output is the texture type and texture quantity; The loss function of the general texture demand prediction model is: ,in, , They are the loss functions for texture type and texture quantity respectively; The loss function of the texture type is cross entropy loss, and the loss function of the texture quantity is mean square error; Step S230: fine-tuning the general texture demand prediction model using the relationship mapping library to obtain a texture demand prediction model for complex terrain; The specific method of fine-tuning the general texture demand prediction model using the relationship mapping library to obtain the texture demand prediction model for complex terrain is: Step S231: the general texture demand prediction model has L layers, the convolution layer whose feature map size is greater than or equal to the bottom layer threshold is defined as the bottom layer, the parameters of the bottom layer convolution layer of the general texture demand prediction model are fixed, the fully connected layer whose feature map size is less than or equal to the top layer threshold is defined as the top layer, and the parameters of the top fully connected layer are updated; Exemplarily, when the bottom layer threshold is equal to 8, for a model with an input terrain feature map size of 256×256, the bottom layer includes the first 3 to 4 convolutional layers, and the top layer includes the subsequent convolutional layer and the fully connected layer.

[0026] The model parameters of the texture demand prediction model are: ,in, represents the fine-tuned texture demand prediction model parameters, represents the pre-trained general texture demand prediction model, represents the parameters of the general texture demand prediction model, A library that represents the relationship between terrain feature maps and texture requirements. represents the cross entropy loss between the predicted texture requirement and the true texture requirement label, represents the regularization term, is the regularization coefficient, Represents the parameters of the expression to be minimized ; The regularization coefficient is set by those skilled in the art based on experience.

[0027] The texture demand prediction model is fine-tuned based on the general texture demand prediction model, can use data more efficiently, has relatively low training efficiency and resource requirements, and can achieve better prediction results on complex terrain.

[0028] Step S240: Input the terrain feature map based on the texture requirement prediction model for complex terrain and output the texture requirement ; Step S300: acquiring the viewpoint position and the line of sight direction in real time, and determining the visible terrain area within the current view frustum model; The specific method of obtaining the viewpoint position and the line of sight direction in real time and determining the visible terrain area in the current frustum model is: Step S310: Obtaining the viewpoint position and sight direction , with the viewpoint position v as the vertex, the line of sight direction d as the central axis, and the field of view angle α as the opening angle, the cone model is constructed ; Where p represents a point in the viewing cone model, is the vector angle, Represents the vector between the point in the frustum model and the viewpoint position With sight direction The angle of The purpose of constructing the view frustum model is to determine the terrain range visible from the current viewpoint, providing a basis for subsequent visible terrain area calculation and texture loading optimization.

[0029] Step S320: interactively calculating the view cone model and the elevation data of the complex terrain to obtain a visible terrain area in the view cone model; The visible terrain area refers to the terrain surface area covered by the frustum model and not blocked at the current viewpoint position and line of sight direction; The specific method of interactively calculating the view cone model and the elevation data of the complex terrain to obtain the visible terrain area in the view cone model is: Step S321: Divide the terrain into blocks, each terrain block has a corresponding bounding box, and for the bounding box of each terrain block, perform a frustum intersection test to obtain terrain blocks that intersect with the frustum model or are inside the frustum model. All terrain blocks that intersect with the frustum model or are inside the frustum model form a potential visible set; The specific method of the frustum intersection test is: transforming the vertices of the bounding box from the world coordinate system to the frustum coordinate system; checking whether the transformed bounding box vertices satisfy the six plane equations of the frustum model; if all the bounding box vertices are on the same side of the frustum model, the terrain block is outside the frustum model and can be removed; if the bounding box vertices are on different sides of the frustum model, the terrain block intersects with the frustum model or is inside the frustum model; The viewing cone coordinate system is a coordinate system with the viewpoint position as the origin and the line of sight direction as the -Z axis; The six plane equations of the frustum model refer to: the frustum is a three-dimensional space surrounded by six planes, the six planes are respectively a near plane, a far plane, a left plane, a right plane, an upper plane and a lower plane, each plane can be represented by a plane equation Ax + By + Cz + D = 0, wherein (A, B, C) is the normal vector of the plane, and D is the signed distance from the plane to the origin of the world coordinate system; In the above-mentioned frustum culling process, the coordinates of the bounding box vertices of the terrain block are substituted into the six plane equations. By judging the positive or negative sign of the signed distance from the bounding box vertex to the plane, it is determined on which side of the plane the bounding box vertex is on, and then the positional relationship between the terrain block and the frustum is determined.

[0030] Step S322: sorting the terrain blocks in the potential visible set from near to far according to the distance from the terrain block to the bounding box viewpoint, to obtain a terrain block list; Step S323: Create a depth buffer and initialize the depth value of the depth buffer to the maximum depth value; Preferably, the maximum depth value is 1.0; in OpenGL, the value range of the depth buffer is [0, 1], where 0 represents the nearest point and 1 represents the farthest point, so setting the maximum depth value to 1.0 can ensure that all pixels are initially considered to be the farthest and will not be blocked.

[0031] Step S324: traverse the sorted terrain block list, perform a depth test on each terrain block, and obtain a visible terrain block; The specific method of the depth test is as follows: transforming the vertices of the terrain block from the world coordinate system to the screen coordinate system; for each transformed vertex of the terrain block, comparing its depth value with the depth value of the corresponding pixel in the depth buffer; if the depth value of the vertex of the terrain block is greater than the depth value of the depth buffer, the vertex of the terrain block is blocked and does not need to be rendered; if the depth value of the vertex of the terrain block is less than or equal to the depth value of the depth buffer, the vertex is visible, and the depth buffer needs to be updated and the vertex needs to be rendered; if all vertices of the terrain block are blocked, the entire terrain block is blocked and can be culled; if there are visible vertices in the terrain block, the terrain block needs to be divided into blocks again, and the sub-areas need to be processed recursively; The screen coordinate system is a two-dimensional coordinate system used to represent the projection position of a three-dimensional scene on the screen; Step S325: Collect all visible terrain blocks to form a final visible terrain area; The calculation formula of the visible terrain area is: , Represents the view frustum model; Step S330: according to the distance between the viewpoint position and the visible terrain area, a distance threshold of each layer is set, and the visible terrain area is divided into K layers, where K is the number of layers; The expression for dividing the visible terrain area into K layers is: ,in, , Represent the distance thresholds of the kth layer and the k+1th layer respectively, represents the visible terrain area of ​​the kth layer, Indicates the distance between the viewpoint position and the visible terrain area; The method for setting the distance threshold of each layer is: Step S331: For each terrain block, calculate its local roughness ; The calculation formula of the local roughness is: ,in, Represents a terrain block The area of Represents elevation data, Represents the average elevation of a terrain block; Step S332: Calculate the adjustment factor of the distance span according to the local roughness of the terrain block ; The calculation formula for calculating the adjustment factor of the distance span according to the local roughness of the terrain block is: ,in, and are the lower and upper limits of local roughness, respectively; The upper and lower limits of the local roughness can be set according to the statistical characteristics of the terrain data; preferably, , ,in, is the average value of local roughness of all terrain blocks; Step S333: According to the moving speed of the viewpoint , calculate the adjustment factor for the distance span ; The moving speed of the viewpoint , the calculation formula for the adjustment factor of the distance span is: ; Step S334: Calculate the adjustment factor of the distance span according to the real-time frame rate f of the rendering device ; The calculation formula for calculating the adjustment factor of the distance span according to the real-time frame rate f of the rendering device is: ; Step S335: Calculate the distance threshold of the kth layer according to the adjustment factor of the distance span corresponding to the local roughness, the moving speed of the viewpoint and the real-time frame rate of the rendering device. ; The calculation formula of the distance threshold of the kth layer is: ;in, is the initial distance, is the growth rate; The initial distance and growth rate are set by those skilled in the art according to the overall scale and detail level of the terrain; preferably, ; The specific method of dividing the visible terrain area into K layers is: Step S336: Based on the viewpoint height , calculate the adjustment factor of the number of layers ; According to the viewpoint height , the calculation formula for the adjustment factor of the number of layers is: ; The viewpoint height The calculation formula is: ,in, is the elevation data of the viewpoint position, is the height of the viewpoint; The viewpoint height refers to the actual height of the viewpoint relative to the terrain surface; Step S337: Based on the average local roughness of the terrain , calculate the adjustment factor of the number of layers ; The average local roughness of the terrain , the calculation formula for the adjustment factor of the number of layers is: ; Step S338: Based on the real-time frame rate of the rendering device , calculate the adjustment factor of the number of layers ; The real-time frame rate of the rendering device , the calculation formula for the adjustment factor of the number of layers is: ; Step S339: Calculate the number of layers K based on the viewpoint height, the average local roughness of the terrain, and the adjustment factor of the number of layers corresponding to the real-time frame rate of the rendering device; The calculation formula of the number of layers is: ,in, is the base layer, To round down; The number of base layers can be set according to the overall scale and detail level of the terrain; Preferably, ; Step S400: determining the predicted viewpoint position in the future time according to the viewpoint position, moving speed and acceleration; The specific method for determining the predicted viewpoint position in the future time according to the viewpoint position, moving speed and acceleration is: Step S410: Obtain the viewpoint position sequence according to the viewpoint position, moving speed and acceleration in the past time period T , speed sequence and acceleration sequence , establish a viewpoint motion model; The expression of the viewpoint motion model is: ;in, They represent the viewpoint position, moving speed and acceleration at time t respectively. is the time step; Step S420: Based on the viewpoint motion model, the predicted viewpoint position at the future time t+τ is calculated by a numerical integration method; The calculation formula of the numerical integration method is: ;in, Represents future time Predicted viewpoint position and movement speed at the moment; Step S500: Generate a priority list of texture loading according to the current terrain feature map, texture requirements and predicted viewpoint position; like Figure 3 As shown, the specific method for generating a priority list of texture loading according to the current terrain feature map, texture requirements and predicted viewpoint position is: Step S510: Calculate the distance from the predicted viewpoint position to the visible terrain area to obtain the viewpoint distance ; Step S520: For each visible terrain area The horizontal coordinates of the terrain pixels within , perform weighted summation of the terrain feature map, texture type and texture quantity, and viewpoint distance of the terrain pixel point to calculate the texture loading priority ; The calculation formula of the texture loading priority is: ;in, is a topographic feature map, and are the predicted texture type and texture quantity, respectively. is the viewpoint distance, is the weight coefficient; The weight coefficient The value of is set by those skilled in the art based on experience.

[0032] Step S530: Horizontal coordinates of each terrain pixel point in each level of the visible terrain area , calculate the average value of the texture loading priority in the neighborhood of the terrain pixel point , update the texture loading priority of all terrain pixels in the neighborhood of the terrain pixel to the average value, and generate a priority list according to the texture loading priority of each terrain pixel; The calculation formula for the average value of the texture loading priority in the neighborhood of the terrain pixel point is: ,in, is the neighborhood of terrain pixels, is the neighborhood size, Represents the horizontal coordinates of terrain pixels within the neighborhood; Preferably, a 3×3 square window is selected as the neighborhood of the terrain pixel point; Furthermore, for the boundary area between the two levels of the visible terrain area, a priority mixing method is used for smooth transition, and the texture loading priority of the boundary area is ; Where b is the transition factor, which is used to control the mixing ratio.

[0033] b is determined by a technician in this field based on the horizontal coordinates of the terrain pixel points Adjust the relative positions within the junction area to achieve a smoother transition effect.

[0034] The above process makes the texture loading priority of adjacent areas smoother, reduces mutations, and improves visual continuity.

[0035] Example 2 like Figure 4 As shown, the complex terrain texture mapping optimization system provided by this application includes: A terrain feature extraction module is used to extract the terrain features of complex terrain and generate a terrain feature map; The texture demand prediction module is used to collect historical terrain features, use the texture demand prediction model to learn the correlation between terrain features and texture requirements, input terrain feature maps, and output texture requirements; The visible area extraction module is used to obtain the viewpoint position and line of sight direction in real time and determine the visible terrain area within the current frustum model; A viewpoint position prediction module, used to determine the predicted viewpoint position in the future time according to the viewpoint position, moving speed and acceleration; The priority list generation module is used to generate a priority list for texture loading based on the current terrain feature map, texture requirements and predicted viewpoint position.

[0036] In addition, the parts of the above-mentioned technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive redundancy.

[0037] The specific implementation modes described above further describe the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific implementation mode of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. Complex terrain texture mapping optimization method, characterized in that: include: Extract terrain features of complex terrain and generate terrain feature maps; Collect historical terrain features, use the texture demand prediction model to learn the correlation between terrain features and texture demand, input terrain feature map, and output texture demand; Obtain the viewpoint position and sight direction in real time to determine the visible terrain area within the current frustum model; Determine the predicted viewpoint position in the future time according to the viewpoint position, moving speed and acceleration; Generate a priority list of textures to be loaded based on the current terrain feature map, texture requirements, and predicted viewpoint position; The specific method of extracting the terrain features of complex terrain and generating a terrain feature map is as follows: Obtain the elevation data H(x,y) of the complex terrain and the resolution W×H of the elevation data; where (x,y) represents the horizontal coordinates of the terrain pixel point, the value of H(x,y) represents the terrain height at (x,y), and W and H are the width and height of the elevation data respectively; Determine the number of levels based on the resolution of the elevation data and define a multi-scale elevation pyramid ;in, Indicates the scale level, is the number of levels, and the elevation data of each scale level in the multi-scale elevation pyramid is obtained by downsampling. Represents elevation data at scale level l; Extracting terrain features at each scale level l, wherein the terrain features include macro-scale features, meso-scale features, and micro-scale features; The terrain features at different scale levels are fused to generate a terrain feature map.

2. The complex terrain texture mapping optimization method according to claim 1, characterized in that: The specific method of collecting historical terrain features, using the texture demand prediction model to learn the correlation between terrain features and texture requirements, inputting a terrain feature map, and outputting texture requirements is as follows: For each complex terrain type i, collect its historical terrain characteristics and construct a terrain feature map sample and the corresponding texture requirement tag The texture requirement labels are divided into texture type labels and texture quantity labels. A relationship mapping library is constructed based on terrain feature map samples and corresponding texture requirement labels. ; where i represents the complex terrain type variable, M is the total number of complex terrain types, represents the jth terrain feature map sample of the i-th complex terrain type, , They represent the texture type label and texture quantity label corresponding to the jth terrain feature map sample of the i-th complex terrain type, is the number of samples of terrain feature map; Obtain a large-scale terrain texture dataset, design a general texture demand prediction model based on a deep convolutional neural network model, and train it using the large-scale terrain texture dataset. Optimize the model parameter θ through the gradient descent algorithm to obtain a pre-trained general texture demand prediction model. The general texture demand prediction model is fine-tuned using the relational mapping library to obtain a texture demand prediction model for complex terrains; Based on the texture demand prediction model for complex terrain, the terrain feature map is input and the texture demand is output. .

3. The complex terrain texture mapping optimization method according to claim 2, characterized in that: The specific method of obtaining the viewpoint position and the line of sight direction in real time and determining the visible terrain area in the current view cone model is: Get the viewpoint position and sight direction , with the viewpoint position v as the vertex, the line of sight direction d as the central axis, and the field of view angle α as the opening angle, the cone model is constructed ; Where p represents a point in the viewing cone model, is the vector angle, Represents the vector between the point in the frustum model and the viewpoint position With sight direction The angle of Interactively calculate the cone model and the elevation data of complex terrain to obtain the visible terrain area in the cone model; According to the distance between the viewpoint position and the visible terrain area, the distance threshold of each layer is set, and the visible terrain area is divided into K layers, where K is the number of layers.

4. The complex terrain texture mapping optimization method according to claim 3, characterized in that: The method for setting the distance threshold of each layer is: For each terrain patch, calculate its local roughness ; Calculates an adjustment factor for the distance span based on the local roughness of the terrain patch ; According to the speed of viewpoint movement , calculate the adjustment factor for the distance span ; Calculate the adjustment factor of the distance span based on the real-time frame rate f of the rendering device ; Calculate the distance threshold of the kth layer based on the adjustment factor of the distance span corresponding to the local roughness, the moving speed of the viewpoint, and the real-time frame rate of the rendering device .

5. The complex terrain texture mapping optimization method according to claim 4, characterized in that: The specific method of dividing the visible terrain area into K layers is: According to the viewpoint height , calculate the adjustment factor of the number of layers ; According to the average local roughness of the terrain , calculate the adjustment factor of the number of layers ; According to the real-time frame rate of the rendering device , calculate the adjustment factor of the number of layers ; The number of layers K is calculated based on the viewpoint height, the average local roughness of the terrain, and the adjustment factor of the number of layers corresponding to the real-time frame rate of the rendering device.

6. The complex terrain texture mapping optimization method according to claim 5, characterized in that: The specific method for determining the predicted viewpoint position in the future time according to the viewpoint position, moving speed and acceleration is: According to the viewpoint position, moving speed and acceleration of the viewpoint in the past time period T, the viewpoint position sequence is obtained , speed sequence and acceleration sequence , establish a viewpoint motion model; Based on the viewpoint motion model, the predicted viewpoint position at the future time t+τ is calculated by numerical integration method.

7. The complex terrain texture mapping optimization method according to claim 6, characterized in that: The specific method of generating a priority list of texture loading according to the current terrain feature map, texture requirements and predicted viewpoint position is: Calculate the distance from the predicted viewpoint position to the visible terrain area to get the viewpoint distance ; For each visible terrain area The horizontal coordinates of the terrain pixels within , perform weighted summation of the terrain feature map, texture type and texture quantity, and viewpoint distance of the terrain pixel point to calculate the texture loading priority ; For each terrain pixel in each level of the visible terrain area, the horizontal coordinate , calculate the average value of the texture loading priority in the neighborhood of the terrain pixel point , update the texture loading priority of all terrain pixels in the neighborhood of the terrain pixel to the average value, and generate a priority list based on the texture loading priority of each terrain pixel.

8. A complex terrain texture mapping optimization system, which is used to implement the complex terrain texture mapping optimization method according to any one of claims 1 to 7, characterized in that: include: A terrain feature extraction module is used to extract the terrain features of complex terrain and generate a terrain feature map; The texture demand prediction module is used to collect historical terrain features, use the texture demand prediction model to learn the correlation between terrain features and texture requirements, input terrain feature maps, and output texture requirements; The visible area extraction module is used to obtain the viewpoint position and line of sight direction in real time and determine the visible terrain area within the current frustum model; A viewpoint position prediction module, used to determine the predicted viewpoint position in the future time according to the viewpoint position, moving speed and acceleration; The priority list generation module is used to generate a priority list for texture loading based on the current terrain feature map, texture requirements and predicted viewpoint position.

Citation Information

Patent Citations

  • Texture mapping optimization method based on texture compression and texture prefetching

    CN117956179A

  • Texture rendering method and device, electronic equipment and medium

    CN116385291A

  • Road network model special scene loading management system and method

    CN117332172A

  • Information display method and device, electronic equipment and storage medium

    CN118193103A

  • LOD generation method of three-dimensional model with texture

    CN118552680A

Cited By

  • Large BIM model optimization method and system based on intelligent loading

    CN120030661A