Three-dimensional display method and device for virtual simulation scene

文档序号:1800655 发布日期:2021-11-05 浏览:23次 中文

阅读说明:本技术 一种虚拟仿真场景的立体显示方法及装置 (Three-dimensional display method and device for virtual simulation scene ) 是由 肖意 宗丹 黄一舟 叶知秋 林锐 于 2021-07-09 设计创作,主要内容包括:本发明提供了一种虚拟仿真场景的立体显示方法及装置,该方法包括序列帧图像生成和序列帧图像分离以及视差调整;若需要立体显示,可启用立体循环绘图,则虚拟仿真软件根据初始相机对象参数和瞳距参数分别计算左右眼相机对象参数,绘制虚拟仿真场景,将左右眼图像依次输出;让左眼只接收左眼图像,右眼只接收右眼图像;若需要桌面显示模式,可启用桌面循环绘图,则直接观看。本发明加强虚拟环境下舰船装备的培训效果;可实现立体与非立体显示的一键切换,通过虚拟仿真软件控制立体图像生成,无需额外的立体图像生成设备或第三方插件;无需在硬件设备上进行调试;可快速调整仿真场景的瞳距偏差以适应不同人员的观看需求,避免瞳距不匹配带来的不适。(The invention provides a three-dimensional display method and a three-dimensional display device for a virtual simulation scene, wherein the method comprises the steps of generating a sequence frame image, separating the sequence frame image and adjusting parallax; if three-dimensional display is needed, three-dimensional circular drawing can be started, the virtual simulation software respectively calculates left and right eye camera object parameters according to the initial camera object parameters and the interpupillary distance parameters, draws a virtual simulation scene, and sequentially outputs left and right eye images; the left eye only receives the left eye image, and the right eye only receives the right eye image; if the desktop display mode is needed, desktop circulation drawing can be started, and the user can directly watch the desktop circulation drawing. The training effect of ship equipment in the virtual environment is enhanced; the one-key switching between the three-dimensional display and the non-three-dimensional display can be realized, the generation of the three-dimensional image is controlled by virtual simulation software, and additional three-dimensional image generation equipment or a third-party plug-in is not needed; debugging on hardware equipment is not needed; the pupil distance deviation of the simulation scene can be quickly adjusted to adapt to the watching requirements of different people, and discomfort caused by mismatching of the pupil distance is avoided.)

1. A stereoscopic display method of a virtual simulation scene is characterized by comprising the following steps:

(1) sequential frame image generation

Initializing virtual simulation software, wherein the virtual simulation software is used for drawing circulation;

setting a drawing circulation mode, wherein the drawing circulation mode comprises desktop circulation drawing and three-dimensional circulation drawing;

initializing a virtual simulation scene;

starting a drawing cycle, acquiring initial camera parameters, and selecting a drawing cycle mode:

if the image is in a three-dimensional circulation drawing mode, virtual simulation software respectively calculates left and right eye camera parameters according to the initial camera parameters and the interpupillary distance parameters, draws a virtual simulation scene, and sequentially outputs left and right eye images; adjusting pupil distance parameters to match the pupil distances of different viewers;

if the desktop circulation drawing mode is adopted, the virtual simulation software acquires initial camera parameters, then directly draws a virtual simulation scene, and outputs an image;

(2) sequential frame image separation

If the image is in the three-dimensional circulation drawing mode, the left eye only receives the left eye image, and the right eye only receives the right eye image;

if the desktop circulation drawing mode is adopted, the user can directly view the desktop circulation drawing mode.

2. The stereoscopic display method of the virtual simulation scene according to claim 1, wherein the initialization of the virtual simulation software comprises: and creating a Windows drawing board, creating an OpenGL drawing board, and binding the OpenGL drawing board with the Windows drawing board.

3. The method for stereoscopic display of a virtual simulation scene of claim 1, wherein the virtual simulation software has four buffer areas, a front left buffer area, a rear left buffer area, a front right buffer area, a rear right buffer area, and a front buffer area and a rear buffer area.

4. The stereoscopic display method of the virtual simulation scene according to claim 3, wherein if the virtual simulation scene is in the stereoscopic circulation drawing mode, the virtual simulation software draws the virtual simulation scene to the left rear buffer area and the right rear buffer area, and the drawn virtual simulation scene is submitted to the left front buffer area and the right front buffer area, so as to sequentially output the left eye image and the right eye image;

if the desktop circulation drawing mode is adopted, the virtual simulation software draws the virtual simulation scene to a rear cache, the drawn virtual simulation scene is submitted to a front cache, and then the image is output.

5. The method of claim 1, wherein a variable is defined for the drawing loop, and the desktop loop drawing is selected when the variable value is "0", and the stereoscopic loop drawing is selected when the variable value is "1".

6. The method for stereoscopic display of a virtual simulation scenario of claim 1, wherein the initialization of the virtual simulation scenario comprises: the size of a visible area of a camera object is set in virtual simulation software, initial parameters of the camera object are set, a virtual simulation scene environment is defined, and model loading and model tree construction are completed.

7. The method for stereoscopic display of a virtual simulation scene of claim 6, wherein the initial parameters of the camera object comprise camera position, front view direction, and Z-axis orientation.

8. The stereoscopic display method of a virtual simulation scene of claim 1, wherein the parameters of the left and right eye cameras are directly adjusted to meet the viewing requirements of different people.

9. A stereoscopic display apparatus of a virtual simulation scenario for implementing the stereoscopic display method of the virtual simulation scenario of any one of claims 1 to 8, comprising a display card, a video matrix, a display system, a synchronization card, a stereoscopic signal transmitter, and stereoscopic glasses;

if the image is in the three-dimensional circulation drawing mode, the display card sends the left eye image and the right eye image to the display system through the video matrix, and the left eye image and the right eye image are scanned to the screen alternately; the display card simultaneously outputs a synchronous signal consistent with the screen refreshing rate, the synchronous signal is sent to a three-dimensional signal emitter by the synchronous card, and the three-dimensional signal emitter generates square waves with the same frequency as the screen refreshing; the stereoscopic glasses receive signals of the stereoscopic signal emitter, and the liquid crystal light valve of the stereoscopic glasses controls the opening and closing of the left lens and the right lens; when the screen displays a left-eye picture, the eyes receive the left-eye picture through the opened left lens, and the right lens is closed; similarly, when the screen displays a right-eye picture, the eyes receive the right-eye picture through the opened right lens, and the left lens is closed;

and if the desktop circulation drawing mode is adopted, the display card directly sends the image to the display system for displaying.

Technical Field

The invention belongs to the field of virtual simulation, and particularly relates to a three-dimensional display method and device of a virtual simulation scene.

Background

Modern ship equipment is a complex giant system project, a ship is composed of parts and assemblies in the order of tens of millions, and complexity and professional diversity of the ship equipment bring certain challenges to ship receiving training and equipment state familiarity of the equipment. The mode of training users by means of virtual simulation technology is more and more extensive, the three-dimensional display is one of the key technologies of virtual simulation, the users have stronger immersion in a virtual environment, and the simulation of ship equipment, such as virtual manufacturing, assembly verification, training, virtual maintenance and the like, can be closer to reality.

The traditional virtual simulation scene for realizing time division method stereo display needs to divide a plane image output by virtual simulation software into two parts through hardware equipment to generate a stereo image, needs special stereo image generation equipment for support, and is difficult to quickly adjust the depth of field effect of the stereo image in the using process.

Disclosure of Invention

The invention aims to provide a three-dimensional display method and device of a virtual simulation scene, wherein ship virtual simulation software automatically generates three-dimensional display of the virtual simulation scene, can quickly adjust the depth of field of the three-dimensional display, adapts to the watching requirements of different users, and provides an immersion environment for virtual simulation work of ship equipment, such as virtual manufacturing, assembly verification, collaborative review, training, virtual maintenance and the like.

The technical scheme adopted by the invention is as follows:

a stereoscopic display method of a virtual simulation scene comprises the following steps:

(1) sequential frame image generation

Initializing virtual simulation software, wherein the virtual simulation software is used for drawing circulation;

setting a drawing circulation mode, wherein the drawing circulation mode comprises desktop circulation drawing and three-dimensional circulation drawing;

initializing a virtual simulation scene;

starting a drawing cycle, acquiring initial camera parameters, and selecting a drawing cycle mode:

if the image is in a three-dimensional circulation drawing mode, virtual simulation software respectively calculates left and right eye camera parameters according to the initial camera parameters and the interpupillary distance parameters, draws a virtual simulation scene, and sequentially outputs left and right eye images; adjusting pupil distance parameters to match the pupil distances of different viewers;

if the desktop circulation drawing mode is adopted, the virtual simulation software acquires initial camera parameters, then directly draws a virtual simulation scene, and outputs an image;

(2) sequential frame image separation

If the image is in the three-dimensional circulation drawing mode, the left eye only receives the left eye image, and the right eye only receives the right eye image;

if the desktop circulation drawing mode is adopted, the user can directly view the desktop circulation drawing mode.

Preferably, the virtual simulation software initialization comprises: and creating a Windows drawing board, creating an OpenGL drawing board, and binding the OpenGL drawing board with the Windows drawing board.

Preferably, the virtual simulation software is provided with four cache areas, namely a front left cache area, a rear left cache area, a front right cache area, a rear right cache area and a front and rear double cache areas.

Preferably, if the three-dimensional cyclic drawing mode is adopted, the virtual simulation software draws the virtual simulation scene to the left rear cache region and the right rear cache region, the drawn virtual simulation scene is submitted to the left front cache region and the right front cache region, and then the left eye image and the right eye image are sequentially output;

if the desktop circulation drawing mode is adopted, the virtual simulation software draws the virtual simulation scene to a rear cache, the drawn virtual simulation scene is submitted to a front cache, and then the image is output.

Preferably, a variable is defined for the drawing loop, the desktop loop drawing is selected when the variable value is "0", and the stereoscopic loop drawing is selected when the variable value is "1".

Preferably, the initialization of the virtual simulation scenario comprises: the size of a visible area of a camera object is set in virtual simulation software, initial parameters of the camera object are set, a virtual simulation scene environment is defined, and model loading and model tree construction are completed.

Preferably, the camera object initial parameters include camera position, front view direction, Z-axis orientation.

Preferably, the shortcut key directly adjusts the parameters of the left and right eye cameras to adapt to the watching requirements of different people.

A stereoscopic display device of the virtual simulation scene for realizing the stereoscopic display method of the virtual simulation scene comprises a display card, a video matrix, a display system, a synchronization card, a stereoscopic signal emitter and stereoscopic glasses;

if the image is in the three-dimensional circulation drawing mode, the display card sends the left eye image and the right eye image to the display system through the video matrix, and the left eye image and the right eye image are scanned to the screen alternately; the display card simultaneously outputs a synchronous signal consistent with the screen refreshing rate, the synchronous signal is sent to a three-dimensional signal emitter by the synchronous card, and the three-dimensional signal emitter generates square waves with the same frequency as the screen refreshing; the stereo glasses receive the stereo signal emitter signal, and the stereo glasses liquid crystal light valve controls the opening and closing of the left and right lenses: when the screen displays a left-eye picture, the eyes receive the left-eye picture through the opened left lens, and the right lens is closed; similarly, when the screen displays a right-eye picture, the eyes receive the right-eye picture through the opened right lens, and the left lens is closed;

and if the desktop circulation drawing mode is adopted, the display card directly sends the image to the display system for displaying.

The invention has the beneficial effects that:

the invention provides a three-dimensional display method and a three-dimensional display device for a virtual simulation scene, which are used for enhancing the training effect of ship equipment in a virtual environment; the one-key switching between the three-dimensional display and the non-three-dimensional display is realized, the generation of the three-dimensional image is controlled by virtual simulation software, and additional three-dimensional image generation equipment or a third-party plug-in is not needed; need not to debug on hardware equipment, but the interpupillary distance deviation of quick adjustment emulation scene is in order to adapt to different personnel's the demand of watching, avoids the discomfort that the interpupillary distance mismatch brought.

Drawings

FIG. 1 is a schematic diagram of the principle of stereoscopic vision generation;

FIG. 2 is a schematic diagram of a flat panel display screen image for achieving a stereoscopic depth of field effect;

FIG. 3 is a schematic diagram of frame sequence image generation according to an embodiment of the present invention;

FIG. 4 is a flow chart of a drawing cycle according to an embodiment of the present invention;

FIG. 5 is a diagram illustrating sequential frame image separation according to an embodiment of the present invention.

Detailed Description

The present invention will be described in detail with reference to specific examples. The following examples will assist those skilled in the art in further understanding the invention, but are not intended to limit the invention in any way. It should be noted that it would be obvious to those skilled in the art that various changes and modifications can be made without departing from the spirit of the invention. All falling within the scope of the present invention.

The invention provides a three-dimensional display method and a three-dimensional display device for a virtual simulation scene, wherein the method comprises the steps of generating a sequence frame image, separating the sequence frame image and adjusting parallax; if the stereoscopic display is needed, a stereoscopic circulation drawing mode can be started, the virtual simulation software respectively calculates left and right eye camera object parameters according to the initial camera object parameters and the interpupillary distance parameters, draws a virtual simulation scene, and sequentially outputs left and right eye images; the left eye only receives the left eye image, and the right eye only receives the right eye image; if the desktop display mode is needed, the desktop loop drawing mode can be started, and the user can directly watch the image. The training effect of ship equipment in the virtual environment is enhanced; the one-key switching between the three-dimensional display and the non-three-dimensional display can be realized, the generation of the three-dimensional image is controlled by virtual simulation software, and additional three-dimensional image generation equipment or a third-party plug-in is not needed; debugging on hardware equipment is not needed; pupil distance deviation of simulation scene can be adjusted rapidly to adapt to the watching requirements of different people, and discomfort caused by mismatching of pupil distance is avoided

The principle basis of this solution is shown in fig. 1. The figure shows a case where an object is viewed with both eyes, and the pupil distance is the distance between the pupils of both eyes, and the difference in the positions of both eyes is a cause of stereoscopic vision. The position and the contour of the light reflected by the object B and mapped to the left eye and the right eye along the sight line direction have a difference, for example, L is a contour line on the object B, the positions of the L projected to the left eye and the right eye are obviously different, and the difference is the parallax of human eyes, which is shown in figure 1. Similarly, other contour lines have the parallax on the left eye and the right eye, and the brain can judge the distance of an object by using the parallax to generate the stereoscopic sense of depth.

In the ship virtual simulation project, a user usually watches a virtual simulation scene output by virtual simulation software through a display screen (plane), for example, the ship virtual simulation software draws left and right eye images with pupil distance deviation, and sends the left and right eye images to the plane display screen, and the left and right images are respectively sent to the left eye and the right eye of the user, so that the image watched by the user from the plane display screen is a stereoscopic image with depth of field, as shown in fig. 2.

Based on the visual deviation principle, the invention provides a method for automatically generating virtual simulation scene three-dimensional display by ship virtual simulation software, which comprises the following specific steps:

step 1: sequential frame image generation

And utilizing an OpenGL four buffer area to output left and right eye images. OpenGL provides four buffers, back left, back right, front left, and front right. As shown in fig. 3, the virtual simulation software draws a simulation scene image with a pupil distance to the left and right back buffer areas. The left and right rear caches are switched to the left and right front caches, and the display card sequentially outputs left and right images in the front caches to the display system. The left and right eye images that are sequentially output are referred to as sequential frame images.

Step 2: sequential frame image separation

After the image in the step 1 is pushed to the display system, if a user directly watches the screen, the left eye image can be simultaneously watched by two eyes, and the right eye image can also be simultaneously watched by two eyes, and the eyes watch overlapped pictures. The adaptive hardware system is designed to separate the left eye image and the right eye image with the pupil distance deviation, so that the left eye of a user receives the left eye image, and the right eye of the user receives the right eye image, and therefore three-dimensional display can be achieved.

The following is a more detailed description of the three-dimensional display method for the virtual simulation scene of the ship:

1) the sequence frame image is generated, and the sequence frame image generation flow is shown in detail in fig. 4.

Firstly, OpenGL initialization is carried out, specifically comprising the steps of creating a Windows drawing board, creating an OpenGL drawing board with four caches and two caches, and binding the OpenGL drawing board with the Windows drawing board.

A variable is defined for the double-cache and four-cache drawing loop, and drawing is carried out according to the desktop loop when the variable value is 0, and drawing is carried out according to the three-dimensional loop when the variable value is 1. The corresponding key values (e.g., 9 and 0 on the keyboard) or user icons of "1" and "0" are defined by the script. When a user needs to watch a stereoscopic image or a non-stereoscopic image, one-key switching between the stereoscopic image and the non-stereoscopic image can be realized through a shortcut key or a user interface.

Initializing a virtual simulation scene, setting the size of a visible area of a camera object in ship virtual simulation software, setting initial parameters (including the position, the front-view direction and the Z-axis direction) of the camera object, defining a virtual simulation scene environment, and completing model loading and model tree construction.

A drawing cycle is started and initial camera object parameters are acquired.

When the user needs to watch the stereo image, the value of the drawing cycle variable is controlled to be 1 by the shortcut key, and the stereo drawing mode is started: and respectively calculating left and right eye camera parameters by the ship virtual simulation software according to the initial camera parameters. And drawing the virtual simulation scene to the left rear cache and the right rear cache. And submitting the drawn virtual simulation scene to a left front cache and a right front cache, and pushing the virtual simulation scene to a display system by a display card.

The key values (examples K and L) are defined through the script, camera parameters of the left eye and the right eye defined in the above are controlled, and the pupil distance deviation of the virtual simulation image can be rapidly increased and decreased so as to adapt to the watching requirements of different people.

When the user needs to view the desktop image, the value of the drawing loop variable in the above is controlled to be 0 by the shortcut key defined above, the desktop drawing mode is enabled: the ship virtual simulation software directly draws the virtual simulation scene to a back cache after acquiring the initial camera parameters, submits the drawn virtual simulation scene to a front cache, and pushes the virtual simulation scene to a display system by the display card.

2) Sequential frame image separation

And the display card in the workstation sends the left eye image and the right eye image to a display system through the video matrix. The images in the front buffer are scanned to the screen alternately, and the display card simultaneously outputs a synchronous signal consistent with the screen refresh rate. The synchronous card sends the synchronous signal to the three-dimensional signal transmitter, and the three-dimensional signal transmitter generates square waves with the same frequency as the screen refreshing. The stereo glasses receive the signal of the stereo signal emitter, and the liquid crystal light valve controls the opening and closing of the left and right lenses of the stereo glasses.

When the screen displays a left eye picture, the eyes receive the left eye picture through a left lens opened by the stereoscopic glasses, and a right lens is closed to prevent the right eye from watching the left eye picture; similarly, when the screen displays the right-eye picture, the person receives the right-eye picture through the opened right lens, and the left lens is closed. The system implements sequential frame separation in a specific manner as shown in fig. 5.

The invention also provides a stereoscopic display device of the virtual simulation scene for implementing the stereoscopic display method of the virtual simulation scene, as shown in fig. 5, comprising a display card, a video matrix, a display system, a synchronization card, a stereoscopic signal emitter and stereoscopic glasses;

if the image is in the three-dimensional circulation drawing mode, the display card sends the left eye image and the right eye image to the display system through the video matrix, and the left eye image and the right eye image are scanned to the screen alternately; the display card simultaneously outputs a synchronous signal consistent with the screen refreshing rate, the synchronous signal is sent to a three-dimensional signal emitter by the synchronous card, and the three-dimensional signal emitter generates square waves with the same frequency as the screen refreshing; the stereoscopic glasses receive signals of the stereoscopic signal emitter, and the liquid crystal light valve of the stereoscopic glasses controls the opening and closing of the left lens and the right lens; when the screen displays a left-eye picture, the eyes receive the left-eye picture through the opened left lens, and the right lens is closed; similarly, when the screen displays a right-eye picture, the eyes receive the right-eye picture through the opened right lens, and the left lens is closed;

and if the desktop circulation drawing mode is adopted, the display card directly sends the image to the display system for displaying.

In summary, the invention provides a method for automatically generating stereoscopic display of a virtual simulation scene, which is based on the principle that the depth of field is generated due to the pupil distance deviation when an object is naturally watched by human eyes, and left and right eye images with the pupil distance deviation are generated under the control of ship virtual simulation software; based on the persistence characteristics of human vision, a hardware integration system is designed to separate left and right eye images, so that the left and right eye images respectively enter the left and right eyes to generate a stereoscopic image with deep scene sense; the rapid matching of parallax is realized through the definition and adjustment of the camera object of the ship virtual simulation software, the depth of field of the three-dimensional display can be rapidly adjusted, the viewing requirements of different users are met, the immersive experience of the ship equipment simulation scene is realized, the virtual maintenance process, the cabin environment and the layout of the ship equipment are displayed in a realistic manner, the user is helped to quickly get familiar with the state of a ship product in an immersive manner, and the training effect is enhanced.

The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes or modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention. The embodiments and features of the embodiments of the present application may be combined with each other arbitrarily without conflict.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种用于乐器炫彩学习的辅助工具

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!