Disclosure of Invention
In view of the above problems in the background art, a VR virtual earth vertigo alleviating method based on time-limited drawing is provided. Aiming at the characteristics of VR virtual earth graphic rendering and scene organization, the delay from visual perception to motion perception is reduced by controlling the rendering time of each frame of VR virtual earth, and the aim of alleviating VR virtual earth dizziness is further achieved.
The invention discloses a VR virtual earth dizziness reducing method based on time-limited drawing, which comprises the following steps:
s1, decomposing the VR virtual earth binocular drawing process into four parts, namely camera movement, scene updating, scene drawing and graphic rendering;
s2 moving the camera and recording the moving time of the camera by a timer;
s3, recording the scene updating time caused by the camera movement through a timer;
s4, estimating scene drawing time according to the number of textures, the number of matrixes and the regression coefficient of the scene after the scene is updated;
s5 estimating binocular rendering time of the VR virtual earth according to the camera moving time, the scene updating time and the scene rendering time;
s6, dynamically adjusting the LOD structure of the scene by the tile quadtree model according to the estimated binocular rendering time of the VR virtual earth, stabilizing the frame rate and ensuring that all rendering is completed within the limited time.
Firstly, accurately estimating the rendering time of each frame of a VR virtual earth; and then, dynamically adjusting a scene LOD structure according to the estimated time, ensuring that the scene can finish all the drawing within a limited time, and finally achieving the purposes of stabilizing the frame rate and relieving VR dizziness caused by visual perception that the motion perception cannot be followed.
Specifically, the binocular rendering process is performed by two CPU rendering threads, each rendering thread includes a scene update part and a scene rendering part, the camera moving part is a CPU main thread, and the graphics rendering part is a GPU processing process.
Binocular drawing is a drawing mechanism generally adopted by VR systems, and in the VR systems, binocular stereoscopic vision plays a great role. The different images seen by the two eyes of the user are generated separately and displayed on different displays. Some systems adopt a single display, but after a user wears special glasses, one eye can only see odd frame images, the other eye can only see even frame images, and the difference between the odd and even frames is the parallax, so that the stereoscopic impression is generated.
The method has the advantages that the drawing time of each frame of the scene can be estimated, the method is a premise of time-limited drawing, the existing drawing time estimation method is designed for a monocular drawing machine, and the VR system adopts a binocular drawing mechanism, so that the existing time estimation method cannot be applied to the drawing time estimation of the VR virtual earth.
Further, the VR virtual earth binocular rendering time TframeThe estimation method is as follows:
wherein Tcamera is the time of the camera movement, which is recorded by a timer; t isupdate1,Trender1Time of scene update and scene rendering time for the rendering thread 1; t isupdate2,Trender2Time of scene update for drawing thread 2 and scene drawing time, where the time of scene update is available as recorded by a timer.
Further, the scene drawing time is estimated by the texture number, the matrix number and the regression coefficient of the new scene after the scene is updated, the texture number is texture, the matrix number is matrix, and a, b and c represent the regression coefficient of the new scene, so that the scene drawing time is obtained
Trender=a+b*texture+c*matrix。
In computer graphics, the texture includes both the texture of the surface of an object in the usual sense, i.e. the surface of an object which is computer graphics animal-textured with uneven grooves, and the color pattern on the smooth surface of an object, which we refer more generally to as a motif. In terms of patterns, colored patterns or designs are drawn on the surface of an object, and the surface of the object after texture is generated is still smooth. In the case of the grooves, it is also required to draw a color pattern or design on the surface and to give a visually uneven feeling. The relief pattern is generally irregular. In computer graphics, the generation methods of these two types of textures are completely consistent, which is why they are collectively called textures in computer graphics. Texture mapping is the drawing of a colored pattern on the surface of an object.
The matrix refers to a gray level co-occurrence matrix, and is a common method for describing textures by researching the spatial correlation characteristics of gray levels. Since the texture is formed by the repeated appearance of the gray scale distribution at a spatial position, a certain gray scale relationship, i.e., a spatial correlation characteristic of the gray scale in the image, exists between two pixels spaced apart from each other in the image space.
After the scene is updated, the texture and the matrix number of the new scene are determined known quantities.
Further, the step of dynamically adjusting the LOD structure of the scene by the tile quadtree model comprises: sequencing tiles in a tile quadtree scene from low to high according to the yield rate; and performing quadtree merging on the sorted tiles one by one until the estimated binocular rendering time of the VR virtual earth is lower than a limited time.
The basic idea of the quadtree is to recursively divide the geospatial space into tree structures of different levels. The space in a known range is equally divided into four equal subspaces, a square is divided into four equal parts, the obtained square is still a square, and the structure of the quadtree is simple and is one of the common spatial indexes in the GIS. In the quadtree, each node is a map tile and has a unique identifier, and the parent node, the child node, the adjacent nodes and the like of the map tile can be quickly found through the identifier, and the spatial coordinates of the map tile can also be quickly calculated through the identifier. When the operation of moving or zooming the map is performed, the inquired area is changed, and the required quad-tree nodes are calculated according to the new area range and the current map level. This query is much simpler than other spatial queries because the map level is invariant, the query is a level locked quadtree, no recursion is required, and the efficiency is much higher.
The LOD structure is a concept of a level of Detail (LOD) model, and it is considered that when an object covers a small area of a screen, the object can be used for describing a thicker model and is used for a geometric level model of a visible surface judgment algorithm so as to rapidly draw a complex scene. The LOD technology reduces the geometric complexity of a scene by successively simplifying the surface details of the scene under the condition of not influencing the visual effect of a picture, thereby improving the efficiency of a drawing algorithm. This technique typically builds several geometric models of different approximation accuracy for each original polyhedral model. Each model retains a certain level of detail compared to the original model. When drawing, an appropriate hierarchical model is selected to represent the object according to different standards.
Further, the step of sorting the tiles in the tile quadtree scene from low to high according to the yield rate comprises,
judging whether the tiles can be aggregated according to the quadtree scene conditions, if the tiles have a father tile and three brother tiles, the tiles can be aggregated, otherwise, judging that the tiles can not be aggregated;
calculating profitability for polymerizable tiles
Wherein Pixel is the Pixel size of the tile and sibling tile on the screen; delta T
renderReduced scene rendering time, Δ T, for the tile and sibling tiles to aggregate into a parent tile
gpuAggregating the reduced GPU frame time for the tile and sibling tiles to a parent tile;
arranging tiles into a new tile set SortTileSet according to the sequence of the low profitability to the high profitability, and recording the time occupied by the ordering as Tsort。
Further, the step of performing quadtree merging on the sorted tiles one by one until the estimated binocular rendering time of the VR virtual earth is lower than a defined time comprises:
inputting a limited time TmaxCalculating the available CPU frame time ATcpuAnd available GPU frame time ATgpu:
With CPU frame time ATcpuMinus scene rendering time TrenderAnd updated to ATcpuValue, AT, using GPU frame timegpuMinus GPU frame time TgpuAnd updated to ATgpuA value;
AT when rendering is finishedcpu、ATgpuWhen the values of the two-dimensional data are all larger than 0, tile aggregation is not needed, and a sorted tile set SortTileSet is output;
AT when rendering is finishedcpu、ATgpuWhen the value of (A) is less than 0, tile aggregation is needed, tiles and brother tiles of the tiles are removed from the tile set SortTileSet, a father tile of the tile is inserted into the tile set SortTileSet, the sequencing step is repeated according to the yield rate, and the remaining available frame time is updated until AT finishes drawingcpu、ATgpuIs greater than 0, and outputs the sorted tile set SortTileSet.
Furthermore, the number of tiles of the sequenced tile set SortTileSet is small enough to meet the requirement that scene drawing can be completed within a limited time, and the tile set is determined and then imported into a GPU to realize graphics rendering, so that a scene LOD structure with a stable frame rate is obtained.
Further, the present invention provides a readable storage medium having a control program stored thereon, characterized in that: the control program when executed by a processor implements a VR virtual earth vertigo mitigating method based on time-limited rendering as described in any one of the preceding claims.
Further, the present invention provides a computer control system, including a storage, a processor, and a control program stored in the storage and executable by the processor, wherein: the processor executes the control program to realize the VR virtual earth vertigo alleviating method based on time-limited drawing.
In order that the invention may be more clearly understood, specific embodiments thereof will be described hereinafter with reference to the accompanying drawings.
Detailed Description
Please refer to fig. 1, which is a flowchart illustrating a VR virtual earth vertigo alleviating method according to an embodiment of the invention.
The existing drawing time estimation method is designed aiming at a monocular drawing machine, and a VR system adopts a binocular drawing mechanism, so that the existing time estimation method cannot be applied to the drawing time estimation of a VR virtual earth. The existing scene dynamic adjustment method mainly aims at single LOD model design, adjustment of a scene LOD structure can be realized only through model switching, a tile quadtree model is adopted for scene modeling of a VR virtual earth, and scene adjustment is mainly realized through splitting and aggregation of upper and lower-level tiles, so that the existing method cannot be applied to scene adjustment of the VR virtual earth. In contrast, the dynamic scene adjustment for the tile quadtree model is studied.
The VR virtual earth vertigo alleviating method based on time-limited drawing in the embodiment includes the following steps:
s1, decomposing the VR virtual earth binocular drawing process into four parts, namely camera movement, scene updating, scene drawing and graphic rendering;
s2 moving the camera and recording the moving time of the camera by a timer;
s3, recording the scene updating time caused by the camera movement through a timer;
s4, estimating scene drawing time according to the number of textures, the number of matrixes and the regression coefficient of the scene after the scene is updated;
s5 estimating binocular rendering time of the VR virtual earth according to the camera moving time, the scene updating time and the scene rendering time;
s6, dynamically adjusting the LOD structure of the scene by the tile quadtree model according to the estimated binocular rendering time of the VR virtual earth, stabilizing the frame rate and ensuring that all rendering is completed within the limited time.
The invention mainly solves two technical problems: firstly, accurately estimating the rendering time of each frame of a VR virtual earth; and then, dynamically adjusting a scene LOD structure according to the estimated time, ensuring that the scene can finish all the drawing within a limited time, and finally achieving the purposes of stabilizing the frame rate and relieving VR dizziness caused by visual perception that the motion perception cannot be followed.
This patent has designed a drawing time estimation model to virtual earth's of VR binocular drawing mechanism and has come to estimate the virtual earth's of VR drawing time:
the model firstly decomposes the drawing process of the VR virtual earth, as shown in fig. 2, the whole drawing process can be decomposed into four parts of camera movement, scene updating, scene drawing and graphic rendering.
The CPU in the figure generates corresponding operation control signals according to the functions of the instructions and sends the operation control signals to corresponding components, so that the components are controlled to act according to the requirements of the instructions. The GPU is equivalent to a CPU special for image processing, and after the tile set to be drawn is determined in the invention, the tile set is put into the GPU to realize the graphic rendering by the GPU. The camera movement and scene update belong to a serial process, and the time lengths of the camera movement and the scene update are different and need to be recorded through a timer.
Binocular drawing time T of VR virtual earthframeThe estimation method is as follows:
wherein Tcamera is the time of the camera movement, which is recorded by a timer; t isupdate1,Trender1Time and field of scene update for drawing thread 1Scene rendering time; t isupdate2,Trender2Time of scene update for drawing thread 2 and scene drawing time, where the time of scene update is available as recorded by a timer.
Wherein the scene rendering is mainly responsible for switching scene textures and matrix states,
Trender=a+b*texture+c*matrix。 (2)
the texture is the number of textures, the matrix is the number of matrixes, a, b and c represent regression coefficients of a new scene, and the texture is obtained by performing regression analysis on sampling points.
The camera moving step and the scene updating step are performed before the scene is dynamically adjusted, and therefore, the execution time T is set to be equal to the time T of the scene update stepcamera、 TupdateIt can be obtained directly by a timer:
tcamera ═ time recorded by timer (3)
Tupdate ═ time recorded by timer (4)
And finally, a drawing time estimation model specially aiming at the VR virtual earth is formed by the formula (1), the formula (2), the formula (3) and the formula (4) together.
After the drawing time is estimated, the next step is to adjust the LOD structure of the scene according to the estimated drawing time, so as to ensure that the final scene can finish all the drawing within the limited time.
Further, the step of dynamically adjusting the LOD structure of the scene by the tile quadtree model comprises: sequencing tiles in a tile quadtree scene from low to high according to the yield rate; and performing quadtree merging on the sorted tiles one by one until the estimated binocular rendering time of the VR virtual earth is lower than a limited time.
Please refer to fig. 3, which is a diagram illustrating a quadtree model of a tile according to an embodiment of the present invention.
The adjustment comprises two parts, firstly, the tiles (Tile) in the Tile quad-tree scene are sorted from low to high according to the priority:
algorithm 1.
Inputting: to-be-drawn tile set OldTileSet
Performing the following operations on each tile in the set of tiles to be drawn:
step 1, judging whether the tiles can be aggregated:
acquiring a parent Tile of Tile;
acquiring all existing brother tiles Siblings of Tile;
if the number of Siblings is less than 3:
determining that the Tile Tile is not aggregatable, and setting a Tile yield Tile
Otherwise, judging that the Tile Tile can be polymerized, performing Step 2, and calculating the Tile yield:
calculating the scene-rendering step execution time Δ T for the aggregation of Siblings and Tile to reducerender;
Calculating a reduction in the convergence of Siblings and Tile to GPU frame time Δ Tgpu;
Calculating the Pixel sizes Pixel of Siblings and Tile on the screen;
calculating the rate of return
Step 3, tile ordering:
inserting the sequence of the ratio into SortTileSet from low to high;
and recording the time T taken to perform the above stepssort;
And then carrying out quadtree merging on the sorted tiles one by one until the estimated binocular rendering time of the VR virtual earth is lower than a defined time:
and (3) outputting: sorted tile set SortTileSet
Time T occupied by sortingsort
Algorithm 2.
Inputting: sorted tile set SortTileSet
Defined frame time Tmax
Execution time T of camera movement stepcamera
Execution time T for left camera scene updateupdate1
Execution time T for right camera scene updateupdate2
Execution time T for tile orderingsort
Wherein, the limited frame time is of a specific value, such as 40 frames, that is, the scene is guaranteed to implement the rendering process within the limited 40 frames.
Step 0. calculate the remaining available frame time:
calculating the remaining available CPU frame time ATcpuRemaining available GPU frame time ATgpu:
Performing the following operations on each tile in the set of tiles to be drawn:
calculating the scene drawing step execution time T of TilerenderGPU frame time Tgpu:
With CPU frame time ATcpuMinus scene rendering time TrenderAnd updated to ATcpuValue, AT, using GPU frame timegpuMinus GPU frame time TgpuAnd updated to ATgpuA value;
step 1, judging whether the tile polymerization is needed:
AT when rendering is finishedcpu、ATgpuWhen the values of the two-dimensional data are all larger than 0, tile aggregation is not needed, and a sorted tile set SortTileSet is output;
AT when rendering is finishedcpu、ATgpuWhen the value of (a) is less than 0, tile aggregation is required, and the steps are as follows:
step 2. take tile from SortTileSet:
the first tile is taken from the SortTileSet:
if the Tile Tile is determined to be non-polymerizable, no polymerizable Tile:
otherwise, judging that the Tile Tile can be polymerized, and performing Step 3. removing the Tile and the brother Tile thereof from the SortTileSet:
acquiring all existing brother tiles Siblings of Tile;
tile and Siblings are removed from SortTileSet.
Step 4. insert the parent tile of the tile into the SortTileSet
Step 1 of the algorithm 1 is executed to judge whether Tile can be aggregated;
step 2 of executing the algorithm 1 to calculate the Tile yield;
step 3, executing algorithm 1, inserts Tile into SortTileSet to wait for the next aggregation.
And (3) outputting: optimized set of tiles NewTileSet
Furthermore, the number of tiles of the sequenced tile set SortTileSet is small enough to meet the requirement that scene drawing can be completed within a limited time, and the tile set is determined and then imported into a GPU to realize graphics rendering, so that a scene LOD structure with a stable frame rate is obtained.
Step 5. update the remaining available frame time
ATcup + tile Δ Trender-the time it takes to perform Step 2 to Step 4
ATgpu=ATgpu+Tile.ΔTgpu
And returning to Step 1 to repeat the steps. Until AT when rendering endscpu、ATgpuThe values of all the tiles are greater than 0, and the sorted tile set SortTileSet is output.
The sequenced tile set SortTileSet has the advantages that the number of tiles is small enough to finish scene drawing within a limited time, the tile set is determined and then is led into a GPU to realize graphic rendering, and a scene LOD structure with a stable frame rate is obtained.
The embodiment of the invention designs a VR virtual earth dizziness slowing method based on time-limited drawing, which solves two key technical problems: estimating the drawing time under the binocular drawing machine system; and (3) dynamically adjusting the scene facing the tile quadtree model.
The method comprises the steps of firstly obtaining the time of camera movement and scene updating through a timer, then estimating the time of scene drawing through the updated scene attribute, further estimating the time of binocular drawing, then dynamically adjusting a scene LOD structure according to the estimated drawing time, mainly confirming whether tiles under a quad-tree scene need to be aggregated through the difference value of limited time and estimated time, aggregating the tiles until the drawing time does not exceed the limited time if the estimated drawing time exceeds the limited time, and determining a tile set at the moment to reduce the final drawing time to be below the limited drawing time, so that the purposes of stabilizing the frame rate and relieving VR vertigo are achieved.
The method has the core that the frame rate of the VR virtual earth scene is stabilized, the scene of the tile quadtree model is adjusted in the same station by estimating the drawing time and comparing the drawing time with the preset limiting time under the condition that the drawing can be completed within the limiting time, the effect of reducing the tiles is realized by the splitting and aggregation of upper and lower-level tiles, if the number of the tiles in the quadtree is large, the drawing time is large, but the number of the tiles in the scene is reduced after the aggregation, and the drawing time is also reduced. When the drawing time is within the limited time, the control of each frame drawing time of the VR virtual earth is realized, the delay between the visual perception and the motion perception can be reduced, and the aim of slowing down the VR virtual earth dizziness is further fulfilled.
In the aspect of VR vertigo slowing down, prior art can only slow down the motion perception and can not keep up with the vertigo phenomenon of VR that the vision perception caused, this application then creatively is applied to the vertigo of VR with the time limit drawing technique and slows down, through stabilizing the frame rate, has reduced the delay between the vision perception to the motion perception to reach and slow down the vertigo purpose of VR that the vision perception can not keep up with the motion perception and cause.
In the aspect of drawing time estimation, the prior art is designed for a monocular drawing machine system, that is, a system only comprises one graphics pipeline, and drawing tasks of different cameras are sequentially executed in a serial manner, however, the VR earth totally opens two graphics pipelines, and the drawing tasks of different cameras are executed in a parallel manner, so that the prior art cannot be directly applied to the VR virtual earth. To this end, the application designs a special drawing time estimation model to the realization of VR virtual earth binocular drawing machine system.
In the aspect of a scene dynamic adjustment algorithm, the prior art mainly aims at single LOD model design, and can realize the adjustment of a scene LOD structure only through model switching. In this respect, the method is designed for a scene dynamic adjustment algorithm specially aiming at a VR virtual earth tile quadtree model.
The present invention is not limited to the above-described embodiments, and various modifications and variations of the present invention are included in the scope of the claims and the equivalent technology of the present invention if they do not depart from the spirit and scope of the present invention.