CN101511034A - Truly three-dimensional stereo display method facing Skyline - Google Patents

Truly three-dimensional stereo display method facing Skyline Download PDF

Info

Publication number
CN101511034A
CN101511034A CNA200910025123XA CN200910025123A CN101511034A CN 101511034 A CN101511034 A CN 101511034A CN A200910025123X A CNA200910025123X A CN A200910025123XA CN 200910025123 A CN200910025123 A CN 200910025123A CN 101511034 A CN101511034 A CN 101511034A
Authority
CN
China
Prior art keywords
dimensional
function
stereo display
api
matrix
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CNA200910025123XA
Other languages
Chinese (zh)
Inventor
闾国年
温永宁
盛业华
吴明光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Normal University
Original Assignee
Nanjing Normal University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Normal University filed Critical Nanjing Normal University
Priority to CNA200910025123XA priority Critical patent/CN101511034A/en
Publication of CN101511034A publication Critical patent/CN101511034A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a real three-dimension display method facing to Skyline which includes steps as follows: using an embedded romance data holding up technique between 3D API transferring and display card displaying used by the software; capturing original single chunnel color signal and deep signal, three-dimension scene transformation matrix and projecting transformation matrix; analyzing the information and reconstructing rasterized three-dimension data; self adaptive transforming the scene to two various visual point positions renewedly for forming a dual-eye visual three-dimension image pair for three-dimension displaying, and a driving display card processing three-dimension outputting to the dual-eye three-dimension image pair; processing real three-dimension scene display and observation by using polarization, red-green and fast close type glasses. The method can realize real three-dimension scene display in condition of no changing the program and the operation mode of the present Skyline software.

Description

True three-dimensional stereo display method towards Skyline
Technical field
The present invention relates to the three-dimensional visualization technique field, be specifically related to a kind of true three-dimensional stereo display method towards Skyline.
Background technology
Along with development of computer, stereo display has become fields such as environmental simulation, simulated training and planning and designing technological means commonly used, even beginning combines the generation three-dimensional film with film, computer game etc. and true 3d gaming incorporates daily life.Virtual earth software is as a kind of three important application systems, and in the hope of rich data, friendly user experience has been subjected to paying close attention to widely, and Skyline software is exactly one of them.
Realize that in three-dimensional applications stereoscopic vision is a kind of trend, on single display equipment, observe three-dimensional scenery, the image that images of left and right eyes is seen independently need be separated separately, make right and left eyes see that different images passes through the physiological action formation stereoscopic vision of brain by specific external device then.Traditional stereo display needs the equipment of specialty to carry out stereo display, comprises the video card of supporting left and right sides buffer memory and supports the stereoscopic display device that binary channels shows.Based on above-mentioned technology, produced widely popular virtual reality technology, obtained in fields such as machine emulation, battlefield simulations using widely.But, owing to need professional equipment, with high costs, also limited the application of stereo display technique, so the application of stereo display can not obtain promoting, a large amount of three-dimensional programs still adopts the single channel technology to show, lack third dimension, lost the due stereo display characteristic of three-dimensional program.Simultaneously, because stereo display needs specialised hardware, special art of programming, also caused a large amount of programs when exploitation, not consider the stereo display characteristic, in program, do not realize supporting the function of stereo display, even make these programs can not show solid having on the hardware of three-dimensional display function.These programs have occupied the overwhelming majority of present three-dimensional display program, Skyline does not break through above-mentioned restriction yet, and it is in modeling process, and the user still can only see single pass perspective three dimensional, very three-dimensional stereo display can not be realized, best effect can not be reached.
Summary of the invention
Problem to be solved by this invention is to overcome the deficiency that Skyline software exists in three-dimensional display, realize that the real tri-dimension that former software is not added modification shows.Core of the present invention is to utilize the basic principle of three-dimensional rendering, by color data and depth data in the interception video card result frame image, resolve the projective transformation matrix that generates the result frame image, the basic principle that applying three-dimensional is played up and the three-dimensional scenic of reconstructing grid, on this scene basis, use principle of stereoscopic vision, generate stereogram, based on different stereo display patterns, drive video card and carry out solid output.
The technical foundation that the present invention relies on is about the basic model of three-dimensional rendering in the computer graphics, be the basic model of the three-dimensional rendering of the 3D API (Direct3D) that uses of Skyline (current under Windows Skyline use Direct 3D), comprise the transformation pipeline, Z buffering area algorithm on three-dimensional rendering streamline, summit etc.Realize that according to being Direct3D API and video card both all are based on this basic model and carry out work.The present invention makes this computer software realize the three-dimensional true three-dimensional display and the observation of binocular vision under the situation of not changing Skyline source code, binary code or computer hardware structure.
The basic principle that Computerized three-dimensional shows is with after three-dimensional scenic process geometric transformation and photo-irradiation treatment and the rasterizing, generates a width of cloth two-dimensional grid image and exports on output equipment.Comprise a series of three dimensional object in the three-dimensional scenic, three dimensional object is to be combined by the geometric graphic element (comprising some line and triangle) that a series of summits constitute.The summit is one and comprises three-dimensional space position and the corresponding coordinate points of playing up parameter thereof.At first vertex data is carried out perspective grid conversion and photo-irradiation treatment.In the coordinate transform stage, the summit of describing geometry of objects is transformed under the coordinate system that viewpoint is the center, carries out color and brightness that illumination calculation determines that each summit should have again.The basic display unit of computer graphics is a pixel, and these geometric objects are tiled into pixel, and it is medium to be shown that these pixels are sent to frame buffer at last, as shown in Figure 2.
In 3-D graphic is played up, exist a series of coordinate transform, at last the coordinate transform of object itself is become the pixel coordinate on the two-dimensional screen.These coordinate transforms all with the previous step transformation results as output, constitute the streamline of an apex coordinate conversion, as shown in Figure 3.The coordinate of all three dimensional objects has all been arrived under the same coordinate system by unified, forms normalized coordinate through projection and cutting, forms image pixel by the rasterizing conversion.
Z buffering area algorithm claims depth buffered algorithm again.Because the two dimensional surface coordinate can corresponding unlimited a plurality of three-dimensional coordinates under perspective projection.So what the geometric object of rasterizing had comprised each pixel correspondence is called the parameter of depth value to viewpoint, if the depth value of rasterizing geometric object pixel is less than original pixel, just replace the value of origin-location with the value of this pixel, this has just guaranteed that always nearest apart from viewpoint pixel is saved.
At above principle, realize that the technical scheme of the object of the invention is:
Towards the true three-dimensional stereo display method of Skyline, this method may further comprise the steps:
Data interception is monitored and played up to step (1) at the 3D API that Skyline uses;
Step (2) is utilized scene change matrix and projective transformation matrix reconstructing grid three-dimensional data;
Step (3) self adaptation screen resolution and people's eye cardinal distance is set two different viewpoint positions and is generated stereogram;
Step (4) is carried out true three-dimensional observation at different stereovision equipment.
The concrete available the following step of method of the present invention realizes, the following step in no particular order:
A. the function of three-dimensional display environment is created in monitoring, in this function, add system's detection function function of calling 3D API, obtain system's stereo display characteristic, according to corresponding stereo display characteristic, stereo display pattern in the display environment of change original start, on the hardware of supporting stereo display, open real tri-dimension and show support, on the hardware of not supporting stereo display, sign is set so that carry out red green stereo display.
B. monitoring beginning one frame is drawn function, and the adding code obtains the viewport size when the pre-plot frame in this function, is that stereogram is created interim buffering area according to the pixel format of playing up.
C. monitoring changes current drafting matrix function, in this function, add code to obtain of the change of three-dimensional applications software, by the projection type of matrix parameter identification scene rendering, when being perspective projection to current drafting matrix, write down this matrix, as the key parameter of three-dimensional scenic reconstruct;
D. monitor the function that frame buffer is outputed to display device, add code to obtain each color of pixel and depth data in the entire frame at the monitoring function, the projective transformation matrix information of obtaining based on step c, the three-dimensional coordinate of each pixel of inverse under eye coordinates system reconstructs the three-dimensional scenic based on the rasterizing of pixel; According to the stereoscopic vision model of eye, generation can be for the stereogram of stereo display.
In the described step (1) monitoring of 3D API with play up data interception and further comprise: utilize API interception technology, obtain the output of 3 D rendering correlation matrix and three-dimensional rendering data, extract the wide height of projection matrix, viewport of realizing the three-dimensional perspective conversion, as the key parameter of three-dimensional scenic reconstruct; Utilize the specific function of 3D API, the output of interception three-dimensional rendering is extracted color and depth data in the video card frame buffer, as the basis of three-dimensional scenic reconstruct.
3D API interception is meant and utilizes computer programming, the 3D api function that Skyline is used calls to be monitored, and the data of playing up that 3D API produces are tackled and insert self-defined code therein, reach the purpose that original API is monitored or realizes again.API tackles technology maturation and is widely used, as screen word-selecting software, anti-viral software, network firewall or the like.The 3D API of indication of the present invention plays up the some crucial 3D api function that interception is meant the interception specific function.
Also further comprise the concrete steps that realize the interception of 3D api function at it in the described step (1): at the 3D API (Direct 3D) of Skyline use, inject or/and the Hook Function technology is write specific hook procedure by code, in the data load stage of three-dimensional visualization program, 3D API hook procedure is loaded in the process of three-dimensional visualization program, thus interception and monitoring 3D API Calls.The crucial function of the 3D API that indication of the present invention need be tackled is as follows:
(21) 3D API creates the function of three-dimensional display environment;
(22) 3D API begins the function of a frame scene rendering;
(23) 3D API changes the current function of playing up matrix;
(24) 3D API finishes the function of a frame scene rendering;
(25) 3D API will play up data and output to function on the current screen.
Described step (2) further comprises utilizes 3D API to output to color and depth data in the video card frame buffer, and the projective parameter that obtains in conjunction with interception 3D API Calls is resolved the three-dimensional spatial information that generates color image and depth data.Promptly, by generating the projection matrix and the wide height of viewport of three-dimensional rendering output, calculate the color and the depth data of the output of three-dimensional rendering key control parameter (viewpoint position, hither plane, far plane) and three-dimensional rendering, and then calculate the three-dimensional coordinate of each pixel in the visual space and corresponding color characteristics, the three-dimensional scenic data of rasterizing under the reconstruct visual space.It specifically can comprise following steps:
I. the identification of perspective projection transformation matrix.In the render process of a frame scene, three-dimensional applications software may repeatedly be changed projective transformation matrix, has only perspective transformation matrix just can produce the perspective three dimensional effect.Be without loss of generality, suppose that the perspective projection transformation matrix is consistent in the render process of a frame, perspective projection matrix is tackled, the characteristic value in the matrix as criterion, is judged whether the matrix of current interception is perspective projection matrix.
II. setting up viewpoint is the three dimensional space coordinate system (being called for short eye coordinates system) of the origin of coordinates.The perspective projection transformation matrix of intercepting and capturing with step I is a parameter, foundation is the view coordinate system of the origin of coordinates with the power pin: the Z axle passes the center of hither plane, the X-axis of the Y-axis of hither plane and X-direction and this coordinate system, the Y direction unanimity, hither plane is positioned on the scale of Z axle of hither plane value correspondence.The codomain of X is [width/2, width/2] on the hither plane, and the codomain of Y is [height/2, height/2].In this coordinate system, (X, Y Z) can be tried to achieve by the perspective projection matrix conversion with the coordinate figure P ' of the intersection point of hither plane (X ', Y ', Z ') arbitrary coordinate point P, and wherein Z ' is corresponding to the depth value in the frame depth buffer.Can get: X ' equals width/2*X/Z; Y ' equals height/2*Y/Z; Z ' equals (z-zNear)/z*zFar/ (zFar-zNear), and wherein Z ' is corresponding to the value in the depth buffer.
III. the reconstruct of rasterizing three-dimensional scenic data.If the width of viewport is width ', highly is height ' to be obtained by Direct3D API correlation function.By the proportionate relationship of viewport and the hither plane coordinate P of three-dimensional rendering two field picture pixel " ' (X " ' arbitrarily as can be known, Y " ') corresponding to the three-dimensional coordinate Pn on the hither plane (xn; yn; zn); wherein xn=(X ' ' '-width '/2) * width/2, yn=(Y " '-height '/2) * height/2.Value Z ' in the corresponding depth buffer, by Step II as can be known, corresponding eye coordinates system Z value down is Z ' * (zFar-zNear)/zFar+zNear, can get the coordinate P of pixel under eye coordinates system (X, Y, Z), wherein X equals xNear/zNear*Z, and Y equals yNear/zNear*Z.
By calling color buffer district function and the depth buffer function in the video card of reading of Direct3D API, utilize coordinate system and the above-mentioned relation set up in the Step II, can obtain the eye coordinates system three-dimensional coordinate of all pixels down.All three-dimensional coordinates are coupled together with triangle surface, just constituted a three-dimensional surface that can carry out three-dimensional rendering, is playing up under the visual angle arbitrarily by the three-dimensional flow waterline on this surface.
" setting two different viewpoint positions and generate stereogram " in the described step (3) is the three-dimensional scenic that utilizes step (2) reconstruct, generates two width of cloth images, forms stereogram.The present invention proposes the stereo display model based on the three-dimensional scenic of " voxel ", so-called voxel is meant the three-dimensional coordinate of each pixel of the three-dimensional scenic of step (2) reconstruct and its corresponding view space composition sequence [(X together, Y, Z), (R, G, B)], a voxel space of formation.At each pixel in this space,, calculate its location of pixels point in new viewpoint according to the perspective transform principle.
Generate stereogram and can adopt following two kinds of methods:
Method one. call 3D API, play up the contextual data that obtains in the step (2), original image as left visual point image situation under, generate right visual point image; Original image as right visual point image situation under, generate left visual point image; Do not preserving under the original image situation, generating left and right sides visual point image, thereby realizing that stereogram generates.
Method two. adopt rasterizing three-dimensional scenic data, make up the mapping relations of pixel under original visual space and the target visual space, the pixel under the original visual space is converted directly under the target visual space.Original image as left visual point image situation under, generate right visual point image; Original image as right visual point image situation under, generate left visual point image; Do not preserving under the original image situation, generating left and right sides visual point image, thereby realizing that stereogram generates fast.Wherein:
The viewpoint horizontal-shift is meant the change amount D of the new viewpoint original viewpoint of distance on X-direction x
The viewpoint vertical shift is meant the change amount D of the new viewpoint original viewpoint of distance on Z-direction z
Image pixel is offset, and is meant the additional offset D of the image pixel horizontal direction of generation Pixel
Then under another eye coordinates system, (the coordinate X that pixel Z) is marked under the left viewpoint is Width ' * (X-Dx)/(Z-Dz)+Dpixel for X, Y, and Y is Height ' * Y/ (Z-Dz) to primitive frame image mid point P.This pixel is under for right eye coordinates being, coordinate calculates according to the method described above, but Dx, Dz gets negative sign.
Each color of pixel is copied to the target location.Thereby two viewpoints are all used this method obtain stereogram.This method has without graphics pipeline, and program composition is simple, optimizes advantages such as easy.
" carry out true three-dimensional observation " in the described step (4) and be meant stereogram that step (3) is generated, by display device output and carry out stereovision at different stereovision equipment.The stereogram that the present invention generates is carried out true three-dimensional display in the following way:
X. the binocular solid of video card support shows.As supporting under the Direct3D API ring border of stereo display, creating the stereo display pattern that the equipment handle stage starts Direct3D API, about being transported to respectively, the stereogram that generates in two buffering areas, realizes stereo display.
Y. on the video card of not supporting stereo display, stereogram is synthesized a width of cloth red and green complementary color stereo-picture, and an image from the stereogram of the left and right sides extracts red channel, extracts green and blue channel in another image, the passage that extracts is merged, form the stereo-picture of a complementary colours.And send original image buffer back to and carry out stereo display and observation.
Z. stereo-picture or picture are supported on the stereoscopic display device being transported to other.
The present invention is intended to solve the problem that the Skyline program can not be supported stereo display, relies on ripe code interception technical intercept to carry out layout again at Skyline for calling of 3D API.By the monitoring projection matrix, obtain the key parameter of inverse three-dimensional scenic, by color image and the depth image of drawing,, and pixel value is mapped on the position of correspondence by counter its three-dimensional coordinate of asking of pixel, form stereogram.Carry out stereo display by various display modes, the present invention also provides a feasible approach for the direct three-dimensional of existing a large amount of three-dimensional programs.The present invention has following characteristic:
(1) solved the problem that to carry out stereo display at Skyline, promoted mutual and user experience at Skyline.
(2) the algorithm novelty of Shi Xianing is redistributed the formation stereogram by color image data in the frame buffer zone and depth data process, and algorithm principle is simple, and programming realizes convenient.
(3) made full use of existing technical resource,, had good adaptability, do not had specific (special) requirements for video card owing to develop based on the Direct3D API of industrial standard.Support plurality of display modes, can realize stereo display under the display environment arbitrarily.
Description of drawings
The method flow diagram of Fig. 1 embodiment of the invention 1
The fundamental mode of the three-dimensional rendering that Fig. 2 the present invention adopts
The coordinate transform streamline of the 3-D graphic that Fig. 3 the present invention adopts
The perspective projection of Fig. 4 embodiment of the invention 1 and perspective transformation matrix
Fig. 5 embodiment of the invention 1 be the coordinate system at center with the viewpoint
The quick generation method figure of the stereogram of Fig. 6 embodiment of the invention 1
Embodiment
Below in conjunction with drawings and Examples the present invention is described in further details.
Embodiment 1
As shown in Figures 2 and 3 owing to all use Direct3D API as three-dimensional rendering API at modelling phase Skyline, so present embodiment based on Direct3D API as objective for implementation, operating system platform is implemented for Windows XP.
The interception of Direct3D 9 is developed based on Micorsoft Detours SDK with monitoring.Detours is the kit that a cover that Microsoft provides carries out the API Calls interception under the windows platform, supports all platforms of Win32.
As shown in Figure 1, towards the true three-dimensional stereo display method of Skyline, this method may further comprise the steps:
Data interception is monitored and played up to step (1) at the Direct3D API that Skyline uses;
Step (2) is utilized scene change matrix and projective transformation matrix reconstructing grid three-dimensional data;
Step (3) self adaptation screen resolution and people's eye cardinal distance is set two different viewpoint positions and is generated stereogram;
Step (4) is carried out true three-dimensional observation at different stereovision equipment.
In the step (1) interception of Direct3D API with obtain the scene rendering data and further comprise: utilize 3D API interception technology, obtain 3 D rendering correlation matrix and three-dimensional rendering data, extract the wide height of projection matrix, viewport of realizing the three-dimensional perspective conversion, as the key parameter of three-dimensional scenic reconstruct; Utilize the specific function of 3D API, the output of interception three-dimensional rendering is extracted color and depth data in the video card frame buffer, as the basis of three-dimensional scenic reconstruct.
Step (2) further comprises utilizes Direct3D API to output to color and depth data in the video card frame buffer, and the projective parameter that obtains in conjunction with interception Direct3D API Calls is resolved the three-dimensional spatial information that generates color image and depth data.It further comprises following steps:
I. the identification of perspective projection transformation matrix.In the render process of a frame scene, three-dimensional applications software may repeatedly be changed projective transformation matrix, has only perspective transformation matrix just can produce the perspective three dimensional effect.Be without loss of generality, suppose that the perspective projection transformation matrix is consistent in the render process of a frame.Every Control Parameter of perspective projection is seen shown in the accompanying drawing 4 with corresponding matrix relationship.Perspective projection matrix is tackled, the characteristic value in the matrix as criterion, is judged whether the matrix of current interception is perspective projection matrix.
II. setting up viewpoint is the three dimensional space coordinate system (being called for short eye coordinates system) of the origin of coordinates.The perspective projection transformation matrix of intercepting and capturing with a is a parameter, foundation is the view coordinate system of the origin of coordinates with the power pin: the Z axle passes the center of hither plane, the X-axis of the Y-axis of hither plane and X-direction and this coordinate system, the Y direction unanimity, hither plane is positioned on the scale of Z axle of hither plane value correspondence.The codomain of X is [width/2, width/2] on the hither plane, and the codomain of Y is [height/2, height/2].In this coordinate system, (X, Y Z) can be tried to achieve by the perspective projection matrix conversion with the coordinate figure P ' of the intersection point of hither plane (X ', Y ', Z ') arbitrary coordinate point P, and wherein Z ' is corresponding to the depth value in the frame depth buffer, as shown in Figure 5.Can get: X ' equals width/2*X/Z; Y ' equals height/2*Y/Z; Z ' equals (z-zNear)/z*zFar/ (zFar-zNear), and wherein Z ' is corresponding to the value in the depth buffer.
III. the reconstruct of rasterizing three-dimensional scenic data.If the width of viewport is width ', highly is height ' to be obtained by Direct3D API correlation function.By the proportionate relationship of viewport and the hither plane coordinate P of three-dimensional rendering two field picture pixel " ' (X " ' arbitrarily as can be known, Y " ') corresponding to the three-dimensional coordinate Pn on the hither plane (xn; yn; zn); wherein xn=(X ' ' '-width '/2) * width/2, yn=(Y " '-height '/2) * height/2.Value Z ' in the corresponding depth buffer, by b as can be known, corresponding eye coordinates system Z value down is Z ' * (zFar-zNear)/zFar+zNear, can get the coordinate P of pixel under eye coordinates system (X, Y, Z), wherein X equals xNear/zNear*Z, and Y equals yNear/zNear*Z.
By calling color buffer district function and the depth buffer function in the video card of reading of Direct3D API, utilize coordinate system and the above-mentioned relation set up in the Step II, can obtain the eye coordinates system three-dimensional coordinate of all pixels down.All three-dimensional coordinates are coupled together with triangle surface, just constituted a three-dimensional surface that can carry out three-dimensional rendering, is playing up under the visual angle arbitrarily by the three-dimensional flow waterline on this surface.
Step (3) is utilized the three-dimensional scenic of step (2) reconstruct, generates two width of cloth images, forms stereogram.Generate stereogram and can adopt following two kinds of methods:
Method one. call 3D API, play up the contextual data that obtains in the step (2), original image as left visual point image situation under, generate right visual point image; Original image as right visual point image situation under, generate left visual point image; Do not preserving under the original image situation, generating left and right sides visual point image, thereby realizing that stereogram generates.
Method two. adopt rasterizing three-dimensional scenic data, make up the mapping relations of pixel under original visual space and the target visual space, the pixel under the original visual space is converted directly under the target visual space.Original image as left visual point image situation under, generate right visual point image; Original image as right visual point image situation under, generate left visual point image; Do not preserving under the original image situation, generating left and right sides visual point image, thereby realizing that stereogram generates fast.Wherein:
The viewpoint horizontal-shift is meant the change amount D of the new viewpoint original viewpoint of distance on X-direction x
The viewpoint vertical shift is meant the change amount D of the new viewpoint original viewpoint of distance on Z-direction z
Image pixel is offset, and is meant the additional offset D of the visual pixel level direction of generation Pixel
Then under another eye coordinates system, (the coordinate X that pixel Z) is marked under the left viewpoint is Width ' * (X-Dx)/(Z-Dz)+D for X, Y to primitive frame image mid point P Pixel, Y is Height ' * Y/ (Z-Dz).This pixel is under for right eye coordinates being, coordinate calculates according to the method described above, but Dx, Dz gets negative sign.
Each color of pixel is copied to the target location.Thereby two viewpoints are all used this method obtain stereogram.This method has without graphics pipeline, and program composition is simple, optimizes advantages such as easy.
The stereogram that step (4) generates step (3) is by display device output and carry out stereovision.The stereogram that the present invention generates is carried out true three-dimensional display in the following way:
X. the binocular solid of video card support shows.As supporting under the Direct 3D environment of stereo display, creating the stereo display pattern that the equipment handle stage starts Direct 3D, about being transported to respectively, the stereogram that generates in two buffering areas, realizes stereo display.Or
Y. on the video card of not supporting stereo display, stereogram is synthesized a width of cloth red and green complementary color stereo-picture, and an image from the stereogram of the left and right sides extracts red channel, extracts green and blue channel in another image, the passage that extracts is merged, form the stereo-picture of a complementary colours.And send original image buffer back to and carry out stereo display and observation.Or
Z. stereo-picture or picture are supported on the stereoscopic display device being transported to other.
Embodiment 2
A kind of true three-dimensional stereo display method towards Skyline comprises the interception with minor function:
A. create the function of three-dimensional display environment, monitor this function, in the monitoring function, add system's detection function function of calling Direct3D API, obtain system's stereo display characteristic, according to corresponding stereo display characteristic, the stereo display pattern in the display environment of change original start is opened real tri-dimension and is shown support on the hardware of supporting stereo display, on the hardware of not supporting stereo display, sign is set so that carry out red green stereo display.
B. begin a frame and draw function, monitor this function, the adding code obtains the viewport size when the pre-plot frame in the monitoring function, is that stereogram is created interim buffering area according to the pixel format of playing up.
D. frame buffer is outputed to the function of display device, monitor this function, add code to obtain each color of pixel and depth data in the entire frame at the monitoring function, the projective transformation matrix information of obtaining based on c, the three-dimensional coordinate of each pixel of inverse under eye coordinates system reconstructs the three-dimensional scenic based on the rasterizing of pixel;
E. the projection matrix information of obtaining based on c, the parameters of perspective projection in the inverse 3 D rendering, according to these parameters, rebuild the three-dimensional scenic of rasterizing, according to the stereoscopic vision model of eye, generation can be for the stereogram of stereo display.
Following implementation process is the concrete software decoding process of said method.
1. based on Detours API, under Windows XP platform based on Visual Studio 2005 set up based on based on the Win32 DLL engineering StereoDriver_SkyLine_D3D of C Plus Plus as the interception code skeleton.
2. define a data structure D3D_Stereo in StereoDriver_SkyLine_D3D, this data structure comprises following content:
1) the window variable hWnd of Windows, type HWND;
2) the equipment interface pointer of Direct3D, pDevice, type i Direct3DDevice9;
3) the wide high variable width of record viewport, height, type int;
4) the variable ColorBuffer of buffer memory color data, type B YTE*;
5) the variables D epthBuffer of buffer memory depth data, type float;
6) the variable MatrixMode of the current matrix pattern of record, type D3DTRANSFORMSTATETYPE;
7) the variable Matrix of the current perspective projection matrix of record, type D3DMATRIX;
8) the chained list gD3D_Stereos that creates an overall situation preserves the pointer of D3D_Stereo structure.
9) the D3D_Stereo pointer of an overall situation of establishment, ActiveD3D_Stereo is initialized as NULL.
3. realize monitoring based on DetoursAPI as minor function:
1)Direct3DCreate9
Direct3DCreate9 is the main-inlet of Direct3D9, creates the pointer of an IDirect3D9.Create monitoring function My_Direct3DCreate9, be achieved as follows function:
When the user calls this function for the first time, utilize the CreateDevice function of Detours monitoring IDirect3D9.
Call original Direct3DCreate9 function.
2) the CreateDevice function of Direct3DDevice9
CreateDevice is in order to create a Direct3D equipment.Create monitoring function My_IDirect3DDevice9_CreateDevice, be achieved as follows function:
Whether the inquiry user enables three-dimensional the support, is that the degree of depth form that the judgement user uses guarantees that it is the pattern that lockable reads if select;
Carry out original CreateDevice, obtain an IDirect3DDevice9 pointer.
If it is three-dimensional that the user selects to start, create a D3D_Stereo, with the IDirect3DDevice9 pointer assignment of the pDevice in the parameter, D3D_Stereo is added gD3D_Stereos.
Monitoring IDirect3DDevice9 such as minor function.
3) the BeginScene function of IDirect3DDevice9
BeginScene begins the drafting of a frame.Create monitoring function My_IDirect3DDevice9_BeginScene and be achieved as follows function therein:
According to the IDirect3DDevice9 pointer that imports into, in gD3D_Stereos, find identically with current device, give ActiveD3D_Stereo with its assignment.If do not have identical then be set to NULL.
Call original BeginScene.
4) SetViewport of IDirect3DDevice9
SetViewport is set to assigned address and size with the viewport of the IDirect3DDevice9 rendering context of current active.Create monitoring function My_IDirect3DDevice9_SetViewport, in My_glViewport, be achieved as follows function:
If ActiveD3DL_Stereo is not empty, then judge the wide height of new viewport whether with ActiveD3D_Stereo in width, height equates.If original ColorBuffer and DepthBuffer internal memory among the unequal release ActiveD3D_Stereo.Wide high color buffer district ColorBuffer and the depth buffer data DepthBuffer of creating according to viewport.
Call original SetViewport.
5) SetTransform of IDirect3DDevice9
SetTransform is provided with the matrix of appointment.Create monitoring function My_IDirect3DDevice9_SetTransform, be achieved as follows function: if ActiveD3D_Stereo is not for empty, whether the judgment matrix type parameter is D3DTS_PROJECTION, if according to the present invention the indication decision condition, if be perspective projection matrix, then record in the variable of ActiveD3D_Stereo.
Call original SetTransform.
6) the Present function of IDirect3DDevice9
This function outputs to the two field picture that Direct3D plays up on the screen.Create monitoring function My_IDirect3DDevice9_Present, in this function, be achieved as follows function:
If ActiveD3D_Stereo is not empty, call the GetBackSurfaceData function of IDirect3DDevice9, from the color buffer district, read the ColorBuffer variable of color image to ActiveD3D_Stereo; Call the GetDepthData function to read depth value in the DepthBuffer of ActiveD3D_Stereo.
From the Matrix variable of ActiveD3D_Stereo, obtain the width width of the hither plane of perspective projection, height height, and the zNear of hither plane and far plane zFar.
According to the width ViewPortWidth and the ViewPortHeight of ActiveD3D_Stereo viewport, create interim color buffer district, ColorBufferLeft and ColorBufferRight.
From being provided with, the user obtains viewpoint skew D x, depth migration D zWith pixel-shift D Pixel.
Set up a circulation,, take out corresponding pixel coordinate iX, the depth value among the DepthBuffer of iY and color RGB and correspondence each ColorBuffer pixel.The method of utilizing the present invention to design, and the coordinate P in the eye coordinates system of pixel correspondence (X, Y, Z).Left eye is used D x, D z, D Pixe1Be parameter.The quick stereo picture that uses the present invention's design calculates the pixel coordinate P of P correspondence to generating algorithm LeftTo right eye use-D X ,-D Z ,-D PixelBe parameter, the quick stereo picture that uses the present invention's design calculates the pixel coordinate P of P correspondence to generating algorithm RightThe color difference assignment of current pixel is given the P of ColorBufferLeft LeftThe P of position and ColorBufferRight RightThe position.
Because the Direct3D9 acquiescence is not supported the stereo display pattern, extracts red channel from ColorBufferLeft, extract blueness and green channel among the ColorBufferRight, form red green stereotome, output to screen.
4. compiling StereoDriver_SkyLine_D3D engineering generates the StereoDriver_SkyLine_D3D.DLL file
5. with the withdll.Exe order line startup Skyline program of StereoDriver_SkyLine_D3D.DLL file by detours SDK.

Claims (10)

  1. Towards the true three-dimensional stereo display method of Skyline, it is characterized in that 1, this method may further comprise the steps:
    Data interception is monitored and played up to step (1) at the 3D API that Skyline uses;
    Step (2) is utilized scene change matrix and projective transformation matrix reconstructing grid three-dimensional data;
    Step (3) self adaptation screen resolution and people's eye cardinal distance is set two different viewpoint positions and is generated stereogram;
    Step (4) is carried out true three-dimensional observation at different stereovision equipment.
  2. 2, true three-dimensional stereo display method according to claim 1 is characterized in that, described true three-dimensional stereo display method further comprises the following steps, the following step in no particular order:
    A. the function of three-dimensional display environment is created in monitoring, in this function, add system's detection function function of calling 3D API, obtain system's stereo display characteristic, according to corresponding stereo display characteristic, stereo display pattern in the display environment of change original start, on the hardware of supporting stereo display, open real tri-dimension and show support, on the hardware of not supporting stereo display, sign is set so that carry out red green stereo display;
    B. monitoring begins the function that a frame is drawn, and the adding code obtains the viewport size when the pre-plot frame in this function, is that stereogram is created interim buffering area according to the pixel format of playing up;
    C. monitoring changes the function of current drafting matrix, in this function, add code to obtain of the change of three-dimensional applications software, by the projection type of matrix parameter identification scene rendering, when being perspective projection to current drafting matrix, write down this matrix, as the key parameter of three-dimensional scenic reconstruct;
    D. monitor the function that frame buffer is outputed to display device, add code to obtain each color of pixel and depth data in the entire frame at the monitoring function, the projective transformation matrix information of obtaining based on step c, the three-dimensional coordinate of each pixel of inverse under eye coordinates system reconstructs the three-dimensional scenic based on the rasterizing of pixel; According to the stereoscopic vision model of eye, generation can be for the stereogram of stereo display.
  3. 3, true three-dimensional stereo display method according to claim 1, it is characterized in that, in the described step (1) monitoring of 3D API with play up data interception and further comprise: utilize API interception technology, obtain the output of 3 D rendering correlation matrix and three-dimensional rendering data, extract the wide height of projection matrix, viewport of realizing the three-dimensional perspective conversion, as the key parameter of three-dimensional scenic reconstruct; Utilize the specific function of 3D API, the output of interception three-dimensional rendering is extracted color and depth data in the video card frame buffer, as the basis of three-dimensional scenic reconstruct.
  4. 4, true three-dimensional stereo display method according to claim 1, it is characterized in that, also further comprise the concrete steps that realize the interception of 3D api function at it in the described step (1): inject or/and the Hook Function technology is write specific hook procedure by code, in the data load stage of three-dimensional visualization program, 3D API hook procedure is loaded in the process of three-dimensional visualization program, thus interception and monitoring 3D API Calls.
  5. 5, true three-dimensional stereo display method according to claim 1, it is characterized in that, described step (2) further comprises the following steps: by generating the projection matrix and the wide height of viewport of three-dimensional rendering output, calculate the color and the depth data of the output of three-dimensional rendering key control parameter and three-dimensional rendering, and then calculate the three-dimensional coordinate of each pixel in the visual space and corresponding color characteristics, the three-dimensional scenic data of rasterizing under the reconstruct visual space.
  6. 6, true three-dimensional stereo display method according to claim 1 is characterized in that, described step (2) further comprises following steps:
    I. the identification of perspective projection transformation matrix: suppose that the perspective projection transformation matrix is consistent in the render process of a frame, perspective projection matrix is tackled, the characteristic value in the matrix as criterion, is judged whether the matrix of current interception is perspective projection matrix;
    II. setting up viewpoint is the three dimensional space coordinate system of the origin of coordinates: the perspective projection transformation matrix of intercepting and capturing with step I is a parameter, foundation is the view coordinate system of the origin of coordinates with the power pin: the Z axle passes the center of hither plane, the X-axis of the Y-axis of hither plane and X-direction and this coordinate system, Y direction unanimity, hither plane are positioned on the scale of Z axle of hither plane value correspondence; The codomain of X is [width/2, width/2] on the hither plane, and the codomain of Y is [height/2, height/2]; In this coordinate system, (X, Y Z) are tried to achieve by the perspective projection matrix conversion with the coordinate figure P ' of the intersection point of hither plane (X ', Y ', Z ') arbitrary coordinate point P, and wherein Z ' is corresponding to the depth value in the frame depth buffer, X '=width/2*X/Z; Y '=height/2*Y/Z; Z '=(z-zNear)/z*zFar/ (zFar-zNear), wherein Z ' is corresponding to the value in the depth buffer;
    III. the reconstruct of rasterizing three-dimensional scenic data: the width of establishing viewport is width ', highly for height ', the coordinate P of any three-dimensional rendering two field picture pixel " ' (X " ', Y " ') corresponding to the three-dimensional coordinate Pn on the hither plane (xn; yn; zn); xn=(X " '-width '/2) * width/2 wherein, yn=(Y " '-height '/2) * height/2; Value Z ' in the corresponding depth buffer, corresponding eye coordinates system is Z=Z ' * (zFar-zNear)/zFar+zNear down, the coordinate of pixel under eye coordinates system be P (X, Y, Z), X=xNear/zNear*Z wherein, Y=yNear/zNear*Z; All three-dimensional coordinates are coupled together with triangle surface, just constituted a three-dimensional surface that can carry out three-dimensional rendering.
  7. 7, true three-dimensional stereo display method according to claim 1, it is characterized in that the method that generates space image in the described step (3) is: call 3D API, play up the contextual data that obtains in the described step (2), original image as left visual point image situation under, generate right visual point image; Original image as right visual point image situation under, generate left visual point image; Do not preserving under the original image situation, generating left and right sides visual point image, thereby realizing that stereogram generates.
  8. 8, true three-dimensional stereo display method according to claim 1, it is characterized in that, the method that generates space image in the described step (3) is: adopt rasterizing three-dimensional scenic data, make up the mapping relations of pixel under original visual space and the target visual space, the pixel under the original visual space is converted directly under the target visual space; Original image as left visual point image situation under, generate right visual point image; Original image as right visual point image situation under, generate left visual point image; Do not preserving under the original image situation, generating left and right sides visual point image, thereby realizing that stereogram generates fast.
  9. 9, true three-dimensional stereo display method according to claim 1 is characterized in that, at different demonstrations and scope, carries out stereo display and observation in the described step (4), comprising:
    X. on the equipment of supporting stereo display, stereogram is outputed to two passages about video card respectively, carry out stereo display; Or
    Y. on the equipment of not supporting stereo display, in stereogram, an image extracts red channel, and another image extracts green and blue channel, and the passage that extracts is merged, and forms the stereo-picture of a complementary colours, and supports mycyscope to observe; Or
    Z. stereo-picture or picture are supported on the stereoscopic display device being transported to other.
  10. 10, true three-dimensional stereo display method according to claim 1 is characterized in that, the 3D api function of described interception comprises:
    (21) 3D API creates the function of three-dimensional display environment;
    (22) 3D API begins the function of a frame scene rendering;
    (23) 3D API changes the current function of playing up matrix;
    (24) 3D API finishes the function of a frame scene rendering;
    (25) 3D API will play up data and output to function on the current screen.
CNA200910025123XA 2009-02-24 2009-02-24 Truly three-dimensional stereo display method facing Skyline Pending CN101511034A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNA200910025123XA CN101511034A (en) 2009-02-24 2009-02-24 Truly three-dimensional stereo display method facing Skyline

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNA200910025123XA CN101511034A (en) 2009-02-24 2009-02-24 Truly three-dimensional stereo display method facing Skyline

Publications (1)

Publication Number Publication Date
CN101511034A true CN101511034A (en) 2009-08-19

Family

ID=41003263

Family Applications (1)

Application Number Title Priority Date Filing Date
CNA200910025123XA Pending CN101511034A (en) 2009-02-24 2009-02-24 Truly three-dimensional stereo display method facing Skyline

Country Status (1)

Country Link
CN (1) CN101511034A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102143084A (en) * 2011-04-15 2011-08-03 东南大学 Tiered service aggregation model under open network environment
WO2018045793A1 (en) * 2016-09-07 2018-03-15 中国科学院心理研究所 Binocular balancing correction device, complementary image processing system and method
CN108568085A (en) * 2017-03-10 2018-09-25 精工爱普生株式会社 It can be used in the training device, its control unit and recording medium of rehabilitation
CN108596825A (en) * 2018-04-17 2018-09-28 宁波视睿迪光电有限公司 3D effect display methods and device
CN112235562A (en) * 2020-10-12 2021-01-15 聚好看科技股份有限公司 3D display terminal, controller and image processing method

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102143084A (en) * 2011-04-15 2011-08-03 东南大学 Tiered service aggregation model under open network environment
CN102143084B (en) * 2011-04-15 2013-07-17 东南大学 Tiered service aggregation model under open network environment
WO2018045793A1 (en) * 2016-09-07 2018-03-15 中国科学院心理研究所 Binocular balancing correction device, complementary image processing system and method
CN108568085A (en) * 2017-03-10 2018-09-25 精工爱普生株式会社 It can be used in the training device, its control unit and recording medium of rehabilitation
CN108596825A (en) * 2018-04-17 2018-09-28 宁波视睿迪光电有限公司 3D effect display methods and device
CN112235562A (en) * 2020-10-12 2021-01-15 聚好看科技股份有限公司 3D display terminal, controller and image processing method
CN112235562B (en) * 2020-10-12 2023-09-15 聚好看科技股份有限公司 3D display terminal, controller and image processing method

Similar Documents

Publication Publication Date Title
CN101477700B (en) Real tri-dimension display method oriented to Google Earth and Sketch Up
CN101477701B (en) Built-in real tri-dimension rendering process oriented to AutoCAD and 3DS MAX
CN101477702B (en) Built-in real tri-dimension driving method for computer display card
CN101635061B (en) Adaptive three-dimensional rendering method based on mechanism of human-eye stereoscopic vision
CN102834849A (en) Image drawing device for drawing stereoscopic image, image drawing method, and image drawing program
US10217259B2 (en) Method of and apparatus for graphics processing
CN102819855B (en) The generation method of two dimensional image and device
CN101521828B (en) Implanted type true three-dimensional rendering method oriented to ESRI three-dimensional GIS module
CN101540056B (en) Implanted true-three-dimensional stereo rendering method facing to ERDAS Virtual GIS
CN101511034A (en) Truly three-dimensional stereo display method facing Skyline
Gimeno et al. Multiuser augmented reality system for indoor exhibitions
CN106204703A (en) Three-dimensional scene models rendering intent and device
CN101488229B (en) PCI three-dimensional analysis module oriented implantation type ture three-dimensional stereo rendering method
CN101488230B (en) VirtualEarth oriented ture three-dimensional stereo display method
CN101482978B (en) ENVI/IDL oriented implantation type true three-dimensional stereo rendering method
CN101488232B (en) Implanted true three-dimension volumetric display method oriented to C Tech software
CN101561935B (en) GoCAD software-oriented implanted true three-dimensional display method
CN101561936B (en) GeoGlobe-oriented true three-dimensional stereoscopic display method
CN101482977B (en) Microstation oriented implantation type true three-dimensional stereo display method
KR101227155B1 (en) Graphic image processing apparatus and method for realtime transforming low resolution image into high resolution image
CN101488231B (en) Creator software oriented implantation type true three-dimensional stereo display method
KR101227183B1 (en) Apparatus and method for stereoscopic rendering 3-dimension graphic model
CN107038737B (en) Three-dimensional chess and card drawing method and device
CN106445517A (en) Naked eye 3D interactive method based on Android device
KR20130117074A (en) Autostereoscopic 3d vr engine development method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Open date: 20090819