The magic of the 3D stereo driver question

Post Reply
User avatar
Freke1
Certif-Eyable!
Posts: 1060
Joined: Wed Feb 28, 2007 6:40 pm
Location: Wake Island

The magic of the 3D stereo driver question

Post by Freke1 »

How does the Nvidia 3D stereo driver changes the perspective in a game to produce 2 alternating and ajustable images without the game being designed to do this?
I've programmed 3D objects in perspective myself and it is a huge amount of calculations You have to do to draw it correctly on the screen. This would be coded in the game offcause so how can the driver mess with the gamecode?
This is a mystery to me so if anyone knows pls explain thx :?:
User avatar
Neil
3D Angel Eyes (Moderator)
Posts: 6882
Joined: Wed Dec 31, 1969 6:00 pm
Contact:

Here's Something That May Answer Your Question

Post by Neil »

Try this link out. It's a bit old, but the principals are the same.

http://computer.howstuffworks.com/3d-pc-glasses.htm

I really like this site.

Regards,
Neil 8)
Defender
Two Eyed Hopeful
Posts: 54
Joined: Fri Mar 02, 2007 6:26 am

Post by Defender »

The link you gave explains rather how stereo3d works. I think he wants to know how the nvidia driver works.

Theoretically the driver has all information about the 3d scene so it can compute 2 perpectives. It is not the game which computes the 3d. The game only says place character here and there and a wall at depth z and so on.

This is only possible if the driver gets all information in real3d. If there is some 2D-overlay on the image to produce glow effects or HUD you get this display errors. (see Half life 2 HUD Problem)
User avatar
Freke1
Certif-Eyable!
Posts: 1060
Joined: Wed Feb 28, 2007 6:40 pm
Location: Wake Island

Post by Freke1 »

I imaging it works like this?:
The gamecode calculates the position of view (the gamer in the game) and all objects (their pos, their lighting, shadows, tilt, the surface image etc.). The gamecode then calculates what this 3D world would look like displayed on the screen (2D).
So how can using a 5Mb 3Dstereodriver suddenly make the gamecode calculate all that 2 times (1 for each eye)?
Can You make another driver that follows 2 soldiers and displays their view alternating? It's like that.
I'm really impressed with the 3Dstereo driver as You can probably tell.
nathansteinke
3D Angel Eyes (Moderator)
Posts: 129
Joined: Wed Feb 28, 2007 7:28 pm

Post by nathansteinke »

I think it's kind of like what you're saying, Freke.

I'm guessing as well, but since the hardware can render the picture from different angles/viewpoints, it just needs to be told from which viewpoint to draw it. So it just has to alternate back and forth
Frame 0: draw left eye viewpoint
Frame 1: draw right eye viewpoint
Frame 0: draw left eye viewpoint
...

I imagine if you were in a fps, and could strafe left and right by the distance of the separation of your eyes, move left in 1/120th of a second and then move back right in 1/120th of a second and then repeat over and over again (in non-stereo mode), you should get the same effect as what the computer displays when in 3d mode.
-Nate
I
User avatar
KindDragon
Cross Eyed!
Posts: 108
Joined: Sat Mar 10, 2007 4:05 am
Location: Russia

Post by KindDragon »

NVidia stereo driver work that (Direct3D):
1. Create rendertarget for right back buffer
2. Create depthstencil for right back buffer
3. When application called CreateDepthStencil or create RenderTarget texture or surface they create second for right buffer.
4. When application call DrawPrimitive they
a. set left buffer rendertarget and depthstencil surface and render to that buffer
b. set right buffer rendertarget and depthstencil surface and render to that buffer
5. When application call Present they combine left and right backbuffer into one image
Hugo
Two Eyed Hopeful
Posts: 69
Joined: Thu Mar 22, 2007 8:31 pm
Location: Bavaria

Post by Hugo »

The princip (just that) how it works is realy simple.

Actual games will not calculate the flat 2D (perspective) picture of a 3D object.

Let?s take a point in a 3D-room. The game has just the coordinates x,y,z, the real values. It will transmit it to the driver (directx/opengl) and the remainding stuff (transforming, perspective etc.) is done by driver/gfx-card.

So the driver/gfx-card already has real 3d-coordinats (flat 2D- or real 3D-Mode) and is calculating the perspective. The "only" thing it has to do now, is to create two viewpoints instead of one (move the original one a bit left for fist and a bit right for the second picture).

Game = 3D -> driver/gfx-card isl converting from 3D to 2D
User avatar
Freke1
Certif-Eyable!
Posts: 1060
Joined: Wed Feb 28, 2007 6:40 pm
Location: Wake Island

Post by Freke1 »

Thx, that sounds logically.
shendoo
One Eyed Hopeful
Posts: 2
Joined: Tue Mar 27, 2007 12:31 am

Painting different texture to right eye/left eye

Post by shendoo »

Guys,

I need to send a different video texture to the left eye than the right eye. We are coding a video texture that is pulled from one camera tied to the right eye and one to the left eye. The textures are rendered in Valve Source SDK. Of course, I can send one texture in a 3D scene without a problem. But I would like to be able to have the graphics card render a different texture depending on what eye it is rendering.

Anyone know how to pull this off? Valve Source is a gaming engine that uses direct X. Is there a particular buffer in Direct X dedicated to the left eye and one for the right eye?

Thanks!
nathansteinke
3D Angel Eyes (Moderator)
Posts: 129
Joined: Wed Feb 28, 2007 7:28 pm

Post by nathansteinke »

I don't know the answer to that question, I wonder if Alex Matveev would have any input on this...
I'm not familiar with how to assign different texture buffers to different render targets (which is what I'm guessing you would have to do?).
-Nate
AlexanderMatveev
One Eyed Hopeful
Posts: 1
Joined: Tue Mar 27, 2007 7:36 am

Post by AlexanderMatveev »

DirectX 9 stereo drivers currently work with applications that generate only one mono view. If your DirectX 9 apllication can generate both left and right images on one's own, you cannot then use stereo drivers to convert your images to stereo format used by stereo monitor/glasses installed. Why? Because there is no API how to do that. Stereo drivers are just DirectX 9 full wrappers, so they use DirectX 9 API only. But the API said doesn't have all functions implemented to support stereo. First, you need to set STEREO flag when you create Direct3DDevice9 to declare you will generate stereo images, but there is no variable in the API to set. Second, both left and right backbuffers must be available (D3DBACKBUFFER_TYPE_LEFT, D3DBACKBUFFER_TYPE_RIGHT), now you can read "Stereo view is not supported in Microsoft DirectX 9.0, so the only valid value for this parameter is D3DBACKBUFFER_TYPE_MONO". Finally, there are some more minor API changes have to be done as well. So, current DirectX 9 API must be extended to support stereo applications.
nathansteinke
3D Angel Eyes (Moderator)
Posts: 129
Joined: Wed Feb 28, 2007 7:28 pm

Post by nathansteinke »

Thanks for the info, Alex!
-Nate
shendoo
One Eyed Hopeful
Posts: 2
Joined: Tue Mar 27, 2007 12:31 am

Thanks!

Post by shendoo »

Alex and Nate - Thank you very much!

Perhaps I can use OpenGL to render the texture behind the DirectX game graphics..
dr_barnowl
One Eyed Hopeful
Posts: 20
Joined: Thu Apr 19, 2007 3:43 pm

Cunning use of 3D textures

Post by dr_barnowl »

How about rendering a flat texture in game that is an anaglyphic 3D image.

Make the character don coloured glasses (with a different transparency texture for each eye) to view it.

Bwahahahaa.
Post Reply

Return to “NVIDIA GeForce 3D Vision Driver Forums”