Three-dimensional environment air quality dynamic rendering method

文档序号:36310 发布日期:2021-09-24 浏览:29次 中文

阅读说明:本技术 一种三维环境空气质量动态渲染方法 (Three-dimensional environment air quality dynamic rendering method ) 是由 左瑞亭 周浩 梁志伟 王新昊 于 2021-08-27 设计创作,主要内容包括:本发明公开了一种三维环境空气质量动态渲染方法,属于图像处理技术领域,包括将气象模式结果数据建模成三维空间网格场,通过纹理映射方式形成包含纹理切片的立方体空间,采用投射线技术,根据一定策略融合累加每一个切片采样点的颜色值并形成最终的像素点颜色,渲染出整体的三维场效果,解决了利用粒子和纹理的方式,通过变换纹理的颜色及透明度,达到粒子团的模拟变化效果,从而在网页端绘制出多时刻变化的三维空气质量模式结果数据的技术问题,本发明渲染效果是三维的,可人为突出重点关注阈值区间,动态变化效果可以加载多时刻数据,通过着色器加速的渲染方法,可在网页端进行GPU的使用。(The invention discloses a dynamic rendering method of three-dimensional environment air quality, belonging to the technical field of image processing, comprising modeling meteorological pattern result data into a three-dimensional space grid field, forming a cube space containing texture slices in a texture mapping mode, adopting a projection line technology, fusing and accumulating the color value of each slice sampling point according to a certain strategy and forming a final pixel point color, rendering the whole three-dimensional field effect, solving the technical problem that the three-dimensional air quality pattern result data changing at multiple moments is drawn at a webpage end by changing the color and the transparency of the texture in a particle and texture mode, achieving the simulation change effect of a particle group, wherein the rendering effect is three-dimensional, artificially emphasizing a key focus threshold interval, loading the data at multiple moments in the dynamic change effect, and accelerating the rendering method through a shader, the GPU can be used at the webpage end.)

1. A three-dimensional environment air quality dynamic rendering method is characterized in that: the method comprises the steps that sample data are collected through a client side, and the client side sends the sample data to a central server;

preprocessing sample data in a central server, initializing a particle system grid field to obtain a grid point model, and calculating to obtain world coordinates of grid points with the same longitude and latitude and different air pressure layers;

establishing a dot matrix data set based on lattice point units, wherein the attribute data of each lattice point comprises a row-column layer number, a corresponding world coordinate and an attribute value;

taking lattice points in the dot matrix data set as a center, establishing a plane square in a space, wherein the length and width values of the plane square are L, L is a preset value, and the number of the plane squares is the same as that of the lattice points in the dot matrix data set;

acquiring unit vectors Kn of four top points and a central point of a plane square by using a light projection technology, wherein the value of n is 1, 2, 3 and 4, and specifically setting an initial light source; connecting lines by taking the light source as an initial point and the unit grid point as an end point, and calculating a unit vector R of the light source; taking R as a normal vector and the ground plane as a horizontal datum point, calculating unit vectors Kn of four vertexes of the plane square and the center point of the plane square, and marking the unit vectors as K1, K2, K3 and K4;

setting initial sampling texture, and setting the visual depth of the texture to be decreased from the center to the boundary, so that the gray value of the image texture of the mapping particles also meets the condition, and meanwhile, continuous transition is required, so that the gray value simulation is performed by adopting Gaussian distribution;

outputting sampling point coordinates after rasterization at a client through sampling texture coordinates obtained by a vertex shader; inputting the grid point model and the unit vector Kn of the plane square into a vertex shader for rasterization; placing the initial sampling texture on a square through a fragment shader, performing RGB color assignment on the square according to a color table according to a grid point attribute value val, and performing smooth gradual interpolation on four components of a color value to realize an interpolation animation effect of atmospheric air quality element concentration value change from the time T0 to the time T1;

and storing the final sampling result in a frame cache region of the client, and drawing and displaying in a Web map frame.

2. The three-dimensional ambient air quality dynamic rendering method of claim 1, wherein: the grid point model is expressed by the following formula:

wherein the content of the first and second substances,is a radius of a sphere shape,in the form of latitude coordinates, the latitude coordinate,as longitude coordinates.

3. The three-dimensional ambient air quality dynamic rendering method of claim 2, wherein: the world coordinates of grid points with the same longitude and latitude and different atmospheric pressure layers are obtained through the following formula:

wherein R is the set radius of the earth,the height value of the point from the earth surface is obtained,of the world coordinate system as the initial pointThe coordinate values on the axis are,of the world coordinate system as the initial pointThe coordinate values on the axes, X1, Y1, and Z1, are the X-axis coordinate, Y-axis coordinate, and Z-axis coordinate of the grid point, respectively.

4. The three-dimensional ambient air quality dynamic rendering method of claim 1, wherein: when the gray value simulation is carried out by adopting Gaussian distribution, the gray value simulation is carried out by the following formula:

wherein:represents the distance from the center of the sphere;representative distance sphere centerThe gray value of the texture at (c);variance of gaussian distribution, set to 3;the modulation value of the central peak.

5. The three-dimensional ambient air quality dynamic rendering method of claim 1, wherein: recording the texture resolution as S1 × S1, the following formula exists:

wherein, P represents the space coordinate of the vertex of the square; pt represents the coordinates of the center point of the square, namely the coordinates of grid points; k represents the unit vector of the square and the central point, and L is the length and width value of the plane square.

6. The three-dimensional ambient air quality dynamic rendering method of claim 1, wherein: the implementation of the interpolation animation effect of the change of the concentration value of the atmospheric air quality element from the time T0 to the time T1 specifically includes the following steps:

step S1: reading the attribute value of the current particle at the time of T0, and obtaining the corresponding RGBA value through a color mapping table, and recording the RGBA value as T (R0, G0, B0 and A0);

step S2: reading the attribute value of the current particle at the time of T1, and obtaining the corresponding RGBA value through a color mapping table, and recording the RGBA value as T (R1, G1, B1 and A1);

step S3: and (3) selecting the middle control point value of the color result value obtained at the middle moment of the three moments at equal intervals by using a Bezier curve interpolation algorithm, and obtaining the complementary animation effect from the color change value at the T0 moment to the color change value at the T1 moment by using the following formula:

wherein, b (T) is the result of color value in unit time, T is the control value in unit time, and its value range is [0-1], T0 is the value at time 0, T1 is the control point value obtained at the middle time, and T2 is the value at time T1.

Technical Field

The invention belongs to the technical field of image processing, and relates to a three-dimensional environment air quality dynamic rendering method.

Background

Three-dimensional particle system rendering techniques are an important part of the field of computer simulation. The development of remote sensing detection technology is benefited, and the technologies of a working base station, unmanned aerial vehicle aerial photography technology, satellite remote measurement and the like at the present stage can provide massive real-time accurate data information for the field of atmospheric air quality research. However, only through a more specific and efficient visualization technology, single data information can be presented to people in a diversified manner, and data visualization is a foothold for displaying all research results.

The existing three-dimensional particle system simulation technology mainly has the following defects:

1. simulation is performed in a form that a static picture covers data points according to position information by using result data, and intuitiveness is lacked.

2. Most of the simulations are rendered mainly by establishing a physical model, a distribution model, a carrier model and the like of relevant elements, and the final rendering results are random and cannot fit with real data results.

3. The traditional three-dimensional particle system rendering technology is based on background computing, and although the computing efficiency is improved to a certain extent, the problems of portability, simplicity and cross-platform operation still exist.

4. Besides the problems of intuitiveness, authenticity and portability, the particle system rendering method based on the webpage end also has the problem of computing resource efficiency.

In recent years, scientists have conducted a great deal of research to visually express the results of the air quality and the change process thereof more accurately. Particle system rendering techniques are generally described as viewing smoke as a particle mass composed of numerous particles, and more specifically, as the generation and display on a computer of a large mass composed of a large number of minute substances that move (change) according to a certain rule. The core thought of the technology is that particle clusters with corresponding attributes are generated according to three-dimensional spatial information of each spatial sampling point by a certain method, and the motion trend of each particle cluster is set according to the attribute change of each particle cluster, so that the effect of simulating visualization is achieved. However, the effect of rendering atmospheric air quality results directly with the particle system is not ideal. The characteristics that the distribution unevenness of the atmospheric air quality data field and the physical significance of the atmospheric air quality data field do not accord with the characteristics of particle modeling characteristics and the like become the limitation of using the technology, but the particle system rendering technology is worthy of being adopted because the three-dimensional structure can be completely simulated and the effect of particle textures on light rays can be artificially controlled.

With the development of computer hardware, the performance of the GPU is substantially improved in computational efficiency compared with the conventional hardware. The use of the powerful floating point computing power of GPUs for computer visualization rendering is now the mainstream direction. The traditional simulation method is mostly carried out based on a CPU (central processing unit), which often causes the lower calculation efficiency, and the calculation efficiency can be improved to a certain extent through the parallel calculation of the CPU and the GPU. At present, the work of accelerating the rendering of the atmospheric air quality elements by the GPU at the webpage end is less, most scientific researchers use the GPU to perform simple floating point calculation so as to improve the overall data calculation efficiency, and the work of improving the rendering effect by using the WebGL technology and the like is still insufficient when how the calculation efficiency is improved by using the GPU.

Disclosure of Invention

The invention aims to solve the technical problems, and the invention aims to provide a dynamic rendering method for the air quality of a three-dimensional environment, which solves the technical problem that the simulation change effect of particle clusters is achieved by changing the color and the transparency of textures in a particle and texture mode, so that the result data of a three-dimensional air quality mode changing at multiple times is drawn at a webpage end.

In order to achieve the purpose, the invention adopts the following technical scheme:

a three-dimensional environment air quality dynamic rendering method comprises the steps that sample data are collected through a client side, and the client side sends the sample data to a central server;

preprocessing sample data in a central server, initializing a particle system grid field to obtain a grid point model, and calculating to obtain world coordinates of grid points with the same longitude and latitude and different air pressure layers;

establishing a dot matrix data set based on lattice point units, wherein the attribute data of each lattice point comprises a row-column layer number, a corresponding world coordinate and an attribute value;

taking lattice points in the dot matrix data set as a center, establishing a plane square in a space, wherein the length and width values of the plane square are L, L is a preset value, and the number of the plane squares is the same as that of the lattice points in the dot matrix data set;

acquiring unit vectors Kn of four top points and a central point of a plane square by using a light projection technology, wherein the value of n is 1, 2, 3 and 4, and specifically setting an initial light source; connecting lines by taking the light source as an initial point and the unit grid point as an end point, and calculating a unit vector R of the light source; taking R as a normal vector and the ground plane as a horizontal datum point, calculating unit vectors Kn of four vertexes of the plane square and the center point of the plane square, and marking the unit vectors as K1, K2, K3 and K4;

setting initial sampling texture, and setting the visual depth of the texture to be decreased from the center to the boundary, so that the gray value of the image texture of the mapping particles also meets the condition, and meanwhile, continuous transition is required, so that the gray value simulation is performed by adopting Gaussian distribution;

outputting sampling point coordinates after rasterization at a client through sampling texture coordinates obtained by a vertex shader; inputting the grid point model and the unit vector Kn of the plane square into a vertex shader for rasterization; placing the initial sampling texture on a square through a fragment shader, performing RGB color assignment on the square according to a color table according to a grid point attribute value val, and performing smooth gradual interpolation on four components of a color value to realize an interpolation animation effect of atmospheric air quality element concentration value change from the time T0 to the time T1;

and storing the final sampling result in a frame cache region of the client, and drawing and displaying in a Web map frame.

Preferably, the grid point model is expressed by the following formula:

wherein the content of the first and second substances,is a radius of a sphere shape,in the form of latitude coordinates, the latitude coordinate,as longitude coordinates.

Preferably, the world coordinates of grid points of the same longitude and latitude and different atmospheric pressure layers can be calculated and obtained through the following formula:

wherein R is the set radius of the earth,the height value of the point from the earth surface is obtained,of the world coordinate system as the initial pointThe coordinate values on the axis are,of the world coordinate system as the initial pointThe coordinate values on the axes, X1, Y1, and Z1, are the X-axis coordinate, Y-axis coordinate, and Z-axis coordinate of the grid point, respectively.

Preferably, the gray scale value simulation using the gaussian distribution is performed by the following equation:

wherein:represents the distance from the center of the sphere;representative distance sphere centerThe gray value of the texture at (c);variance of gaussian distribution, set to 3;the modulation value of the central peak.

Preferably, the texture resolution is recorded as S1 × S1, then the following formula exists:

wherein, P represents the space coordinate of the vertex of the square; pt represents the coordinates of the center point of the square, namely the coordinates of grid points; k represents the unit vector of the square and the central point, and L is the length and width value of the plane square.

Preferably, the implementation of the interpolation animation effect on the change of the concentration value of the atmospheric air quality element from the time T0 to the time T1 specifically includes the following steps:

step S1: reading the attribute value of the current particle at the time of T0, and obtaining the corresponding RGBA value through a color mapping table, and recording the RGBA value as T (R0, G0, B0 and A0);

step S2: reading the attribute value of the current particle at the time of T1, and obtaining the corresponding RGBA value through a color mapping table, and recording the RGBA value as T (R1, G1, B1 and A1);

step S3: and (3) selecting the middle control point value of the color result value obtained at the middle moment of the three moments at equal intervals by using a Bezier curve interpolation algorithm, and obtaining the complementary animation effect from the color change value at the T0 moment to the color change value at the T1 moment by using the following formula:

wherein, b (T) is the result of color value in unit time, T is the control value in unit time, and its value range is [0-1], T0 is the value at time 0, T1 is the control point value obtained at the middle time, and T2 is the value at time T1.

The invention has the beneficial effects that:

the invention relates to a dynamic rendering method for air quality of a three-dimensional environment, which solves the technical problem that the effect of simulating change of particle clusters is achieved by changing the color and the transparency of textures by utilizing a particle and texture mode, so that the result data of a three-dimensional air quality mode changing at multiple moments is drawn at a webpage end. Meanwhile, position information is attached, and more accurate expression is provided for the change process of meteorological elements. The whole calculation process is carried out on the GPU, so that the efficiency is greatly improved when the web side is rendered. Meanwhile, the set color sampling interpolation change process can be naturally transited to the next rendering result, and the actual change process is more met. The method can continuously and dynamically display the atmospheric air quality factor change effect under the multi-time sequence, and has smooth program operation and visual and credible effect.

Drawings

FIG. 1 is a schematic diagram of a texture mapping slicing unit according to the present invention;

FIG. 2 is a schematic diagram illustrating a rendering process of a particle system based on web page side and GPU acceleration according to the present invention;

FIG. 3 is a flow chart of an improved particle system technique of the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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 invention.

1-3, a method for dynamically rendering air quality in a three-dimensional environment includes acquiring sample data by a client, and sending the sample data to a central server by the client;

preprocessing sample data in a central server, initializing a particle system grid field to obtain a grid point model, and calculating to obtain world coordinates of grid points with the same longitude and latitude and different air pressure layers;

establishing a dot matrix data set based on lattice point units, wherein the attribute data of each lattice point comprises a row-column layer number, a corresponding world coordinate and an attribute value;

in this embodiment, a point data set with a section as a unit is organized and formed according to the obtained data field grid point coordinates, where the basic unit is a grid point, and the attribute data includes a row-column layer number, a corresponding world coordinate, and an attribute value:

where i is the number of rows, j is the number of columns, lev is the number of layers, lon is the longitude, lat is the latitude, hei is the altitude, and val is the value of the current point.

Taking lattice points in the dot matrix data set as a center, establishing a plane square in a space, wherein the length and width values of the plane square are L, L is a preset value, and the number of the plane squares is the same as that of the lattice points in the dot matrix data set;

acquiring unit vectors Kn of four top points and a central point of a plane square by using a light projection technology, wherein the value of n is 1, 2, 3 and 4, and specifically setting an initial light source; connecting lines by taking the light source as an initial point and the unit grid point as an end point, and calculating a unit vector R of the light source; taking R as a normal vector and the ground plane as a horizontal datum point, calculating unit vectors Kn of four vertexes of the plane square and the center point of the plane square, and marking the unit vectors as K1, K2, K3 and K4;

in this embodiment, an initial light source is set, a ray is made, and when a light ray is projected into a cube from the initial light source and passes through a distance n (n < m), sampling is performed, so that a formula exists:

wherein Tstart represents the volume texture coordinates of the projected points of the surface of the cube; d represents a projection direction; the total represents a sampling interval, and is increased along with the increase of n; and t is the obtained sampling texture coordinate.

The voxel data can be looked up on the volume texture by the sampled texture coordinates found by the vertex shader. Until n > m, or the transparency accumulation exceeds 1, the sampling process for one ray ends.

Setting initial sampling texture, and setting the visual depth of the texture to be decreased from the center to the boundary, so that the gray value of the image texture of the mapping particles also meets the condition, and meanwhile, continuous transition is required, so that the gray value simulation is performed by adopting Gaussian distribution;

outputting sampling point coordinates after rasterization at a client through sampling texture coordinates obtained by a vertex shader; inputting the grid point model and the unit vector Kn of the plane square into a vertex shader for rasterization; placing the initial sampling texture on a square through a fragment shader, performing RGB color assignment on the square according to a color table according to a grid point attribute value val, and performing smooth gradual interpolation on four components of a color value to realize an interpolation animation effect of atmospheric air quality element concentration value change from the time T0 to the time T1;

and storing the final sampling result in a frame cache region of the client, and drawing and displaying in a Web map frame.

Preferably, the grid point model is expressed by the following formula:

wherein the content of the first and second substances,is a radius of a sphere shape,in the form of latitude coordinates, the latitude coordinate,as longitude coordinates.

Preferably, the longitude and latitude of the grid points of different grid layers are the same, but the atmospheric pressure layers are different, and the world coordinates of the grid points of different atmospheric pressure layers with the same longitude and latitude can be calculated through the following formula:

wherein R is the set radius of the earth,the height value of the point from the earth surface is obtained,of the world coordinate system as the initial pointThe coordinate values on the axis are,of the world coordinate system as the initial pointThe coordinate values on the axes, X1, Y1, and Z1, are the X-axis coordinate, Y-axis coordinate, and Z-axis coordinate of the grid point, respectively.

Preferably, the gray scale value simulation using the gaussian distribution is performed by the following equation:

wherein:represents the distance from the center of the sphere;representative distance sphere centerThe gray value of the texture at (c);is a variance of Gaussian distribution, and is set to 3;The modulation value of the central peak.

Preferably, the texture resolution is recorded as S1 × S1, then the following formula exists:

wherein, P represents the space coordinate of the vertex of the square; pt represents the coordinates of the center point of the square, namely the coordinates of grid points; k represents the unit vector of the square and the central point, and L is the length and width value of the plane square.

Preferably, the implementation of the interpolation animation effect on the change of the concentration value of the atmospheric air quality element from the time T0 to the time T1 specifically includes the following steps:

step S1: reading the attribute value of the current particle at the time of T0, and obtaining the corresponding RGBA value through a color mapping table, and recording the RGBA value as T (R0, G0, B0 and A0);

step S2: reading the attribute value of the current particle at the time of T1, and obtaining the corresponding RGBA value through a color mapping table, and recording the RGBA value as T (R1, G1, B1 and A1);

step S3: and (3) selecting the middle control point value of the color result value obtained at the middle moment of the three moments at equal intervals by using a Bezier curve interpolation algorithm, and obtaining the complementary animation effect from the color change value at the T0 moment to the color change value at the T1 moment by using the following formula:

wherein, b (T) is the result of color value in unit time, T is the control value in unit time, and its value range is [0-1], T0 is the value at time 0, T1 is the control point value obtained at the middle time, and T2 is the value at time T1.

The invention can be applied to a scene comprising the client and the central server, and the client and the central server are communicated through the Internet.

The traditional particle system takes a single point as a carrier, and performs displacement, displacement and color change to achieve the effect of simulating a large-range smoke cloud cluster. The invention uses the position information of the particles to carry out plane square fitting, simulates the plane square information of a single particle, and changes the color and the transparency of the initial texture through the discontinuous physical characteristics of the air quality elements, so that the traditional single particle filling is changed into the plane square filling. The invention can freely adjust the pattern of the initial sampling texture to achieve different display effects. Meanwhile, with the shader, large-range and high-resolution initial sampling textures can be loaded. The invention uses a cubic Bezier curve interpolation algorithm to be used at the side, and uses the intermediate value to simulate, thereby achieving the color change in sense.

In this embodiment, the system architecture includes a client and a central server, and the client and the central server communicate with each other via the internet. The central server preprocesses the original data of the ambient air quality, realizes the transmission of grid data from the server to the client based on an HTTP/HTTPS protocol, performs three-dimensional visual rendering by combining a GPU acceleration technology and a WebGL technology at the client, uses a Linux operating system to cover a 100M telecommunication optical fiber network environment, has good stability, durability and reset restart characteristics, ensures the all-weather stable operation of a loaded patent system, can be quickly restarted under abnormal conditions, and adopts a CPU (Central processing Unit) Xeon E5, a master frequency: 2.1 GHz, memory: 4GB, hard disk: 500G and above.

The invention relates to a dynamic rendering method for air quality of a three-dimensional environment, which solves the technical problem that the effect of simulating change of particle clusters is achieved by changing the color and the transparency of textures by utilizing a particle and texture mode, so that the result data of a three-dimensional air quality mode changing at multiple moments is drawn at a webpage end. Meanwhile, position information is attached, and more accurate expression is provided for the change process of meteorological elements. The whole calculation process is carried out on the GPU, so that the efficiency is greatly improved when the web side is rendered. Meanwhile, the set color sampling interpolation change process can be naturally transited to the next rendering result, and the actual change process is more met. The method can continuously and dynamically display the atmospheric air quality factor change effect under the multi-time sequence, and has smooth program operation and visual and credible effect.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种场景重建方法、系统、装置及扫地机器人

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!