|
|
It is currently Thu May 23, 2013 4:27 am
|
|
Page 1 of 1
|
[ 17 posts ] |
|
My 1st app, Zalman 3D monitor on ATI/nvidia without drivers
| Author |
Message |
|
1140
One Eyed Hopeful
Joined: Sat Dec 22, 2007 3:38 am Posts: 23
|
Just received a 22" Zalman stereoscopic monitor at work
Since this monitor should be able to present EvenLines to the left-eye and OddLines to the right-eye...
(or viceversa) I experimented with our 3D application, to render it two times in half-height
and the interlace the two images using a shader.
This way I should be able to create stereoviewports on every type of videocard.
Even lowbudget onboards, could generate stereo in a window.
Instead of buying and expensive Quadro
Only thing to check for, some one doesn't start his viewport on an odd-scanline.
But this can be checked, and correctly handled at runtime. (Now it doesn't)
For now it shows at the left the normal view in full-height-resolution and at the right
it shows an interlaced stereoscopic image.
Ability to modify at runtime:
- Field Of View
- Cross eye angle
- Distance between eyes
If any one is interested in the shader code. To experiment with it themself.
Maybe I can release this demo for you guys to play with,
but I will have to check this at work.
Here are to example images:
link to png1
link to png2
..

|
| Mon Jul 28, 2008 1:56 pm |
|
 |
|
erikdendekker
One Eyed Hopeful
Joined: Wed Aug 06, 2008 9:15 am Posts: 2
|
Hey!
Today I also received a Zalman 22" stereo monitor at work,..  and I started fiddling with the NVidia stereoscopic drivers. From what I experienced, applications that are doing 3D rendering using common OpenGL or DirectX operations are showing stereo just fine. Apart from a little ghosting that depends of the angle (height) of the viewer with respect to the screen it all looks great,...
However, my case is a little different, since my image source is a custom stereo camera rig that we are building. To show images from these cameras I need to display them as a texture that has a different representation for the left/right eye. NVidia has a powerpoint presentation on their website ( http://developer.download.nvidia.com/presentations/2008/GDC/GDC08_stereo-web.pdf) that refers to textures that have a separate representation for left/right but I just don't understand how to tell the driver that I have such a texture and what the format of the texture should be. (e.g. left/right next to each other, or some other form?). Anyone experience with this?
Yet another solution to my problem would be to render even and odd lines myself, just like you did,.. This has the advantage that I would not depend on stereo drivers from nvdia (which do not seem reliably available?), or even a specific video card manufacturer, but has the disadvantage that I would not be able to support other types of stereo rendering devices out-of-the-box.
Anyhow, I am very interested in your shader code to combine two pre-rendered images into a single an interlaced stereoscopic image.
Erik den Dekker
|
| Wed Aug 06, 2008 10:57 am |
|
 |
|
LukePC1
Golden Eyed Wiseman! (or woman!)
Joined: Wed May 16, 2007 11:30 am Posts: 1378 Location: Europe
|
Can't you just take a something like stereoscopic player or any other S-3D player to play your two files?
I know stereoscopic player supports two different files (e.g. .avi) and is also able to display interlaced. You shouldn't need a NV card either, but it needs some (ok a LOT of) power
just google for the name 
_________________Play Nations at WAR with this code to get 5.000$ as a Starterbonus: ayqz1u0s http://mtbs3d.com/naw/AMD x2 4200+ 2gb Dualchannel GF 7900gs for old CRT with Elsa Revelator SG's currently 94.24 Forceware and 94.24 Stereo with XP sp2!
|
| Wed Aug 06, 2008 11:50 am |
|
 |
|
erikdendekker
One Eyed Hopeful
Joined: Wed Aug 06, 2008 9:15 am Posts: 2
|
Nope, I can't use any normal stereo player, since we are developing our own application that needs to be able to show both live and recorded stereo streams at the same time,... (using a custom gui, user defined settings etc,...)
Unless you know where I can get the source code of such a product,.. that would be another case 
|
| Thu Aug 07, 2008 3:15 am |
|
 |
|
Neil
3D Angel Eyes (Moderator)
Joined: Wed Dec 31, 1969 6:00 pm Posts: 3883
|
Is this some kind of Star Trek scene? The ship in the picture looks Cardassian.
Regards,
Neil
_________________
|
| Thu Aug 07, 2008 8:06 am |
|
 |
|
1140
One Eyed Hopeful
Joined: Sat Dec 22, 2007 3:38 am Posts: 23
|
Since you are just working with video streams a 3D applications maybe is a little overkill.
There are some samples to get a bitmap filled when reading from an .AVI
1)Create one monochrome bitmap with the odd lines black and even white.
2)And one with odd lines white and even lines black.
3)Then use a BitBlt, MaskBly, or PlgBlt, to copy even or odd lines from the frame from your inputs,
to the destination dialog.
When you have found the correct DirectMedia / DShow sample to read an .AVI and capture frames to a 'CBitmap',
The rest of the application is 10 lines of code 
_________________ ---------------------------------
What a strange username..
1140 <=> ETA
|
| Sat Aug 23, 2008 12:29 pm |
|
 |
|
yuriythebest
Petrif-Eyed
Joined: Mon Feb 04, 2008 12:35 pm Posts: 2399 Location: Kiev, ukraine
|
Neil wrote: Is this some kind of Star Trek scene? The ship in the picture looks Cardassian.
Regards, Neil
yup but the overall room looks generic- I won't say federationy because it doesn't have the standard TNG style GUI, on the other hand could be from the early days 
_________________ Oculus Rift / 3d Sucks - 2D FTW!!!
|
| Sat Aug 23, 2008 1:23 pm |
|
 |
|
CarlKenner
Binocular Vision CONFIRMED!
Joined: Tue Aug 28, 2007 12:22 pm Posts: 332
|
That nvidia presentation won't help you Erik. All that presentation means is that a game can render the world like normal to a screen-sized texture, then render the texture to the screen, and the nvidia 3D driver will still be able to make it 3D.
What you need to use is the nvidia StereoBLT SDK. It allows you to render to the left and right eye seperately.
Alternatively, you can ignore the nvidia driver, and just use a stencil buffer or a pixel shader to draw half the lines at a time.
_________________Copy this code to clipboard: 0o1rp5zk then go to http://mtbs3d.com/naw to register. Use the code for $5000 startup bonus, and to support Gaza. 
|
| Thu Sep 18, 2008 7:12 am |
|
 |
|
1140
One Eyed Hopeful
Joined: Sat Dec 22, 2007 3:38 am Posts: 23
|
At last the code I forgot to add, the pixel-shader: Code: float4 ps_main( PS_IN In ) : COLOR { // Convert to Pixel, use proper rounding int DestinationPixelY = (In.UV0.y*ViewPortSize.y) + 0.5; // Detect odd pixel row int Odd=(DestinationPixelY%2); // Calculate source pixel // Odd pixels are from 2nd viewport at half of viewportsize int SourcePixel = ((DestinationPixelY-Odd) + Odd*ViewPortSize.y)*0.5; // offset 0.5 to center of pixel // Scale to 0..1 float2 UV =float2(In.UV0.x,(SourcePixel+0.5)/ViewPortSize.y); float4 tc = tex2D(BaseTexture, UV); return tc; }
And the game loop code, which modifies the eye camera's, the following are my in game hotkeys, to change parameters: 1/2 Fov X 3/4 Yaw 5/6 Eye distance 7 Inverse parameters 8 Toggle pitch correction 9 Default stereo parameters 0 Disabled stereo parameters Code: while ( spApp->Run() ) { // Needs to be reset on resize.. g_spContextP2[0]->SetViewport ( 0, 0, iSizeX, iSizeY/2 ); g_spContextP2[1]->SetViewport ( 0, iSizeY/2, iSizeX, iSizeY/2 );
// Check keys fFOVX -= ::Key.IsPressed(VGLK_1) * 1.0f; fFOVX += ::Key.IsPressed(VGLK_2) * 1.0f;
fYaw -= ::Key.IsPressed(VGLK_3)*0.1f; fYaw += ::Key.IsPressed(VGLK_4)*0.1f;
fDistanceEyeToCenter -= ::Key.IsPressed(VGLK_5)*0.1f; fDistanceEyeToCenter += ::Key.IsPressed(VGLK_6)*0.1f;
// Switch eye's if ( ::Key.IsPressed(VGLK_7) ) { fYaw *= -1.0f; fDistanceEyeToCenter *= -1.0f; } // Toggle Pitch correction, between, -1, 0 and 1 // To tilt/pitch the camera 0.5 scanline down or up if ( ::Key.IsPressed(VGLK_8) ) { iUsePitchCorrection = (((iUsePitchCorrection+1)+1)%3)-1; } // set some nice default if ( ::Key.IsPressed(VGLK_9) ) { fFOVX = fOrgX; fFOVY = fOrgY; fYaw = -2.0f; fDistanceEyeToCenter = -2.0f; } // disable stereoscopic view if ( ::Key.IsPressed(VGLK_0) ) { fFOVX = fOrgX; fFOVY = fOrgY; fYaw = 0.0f; fDistanceEyeToCenter = 0.0f; }
// Update Field of view // Since the context ignores our viewportsize, they now look all the same. g_spContextP1->SetFOV ( fFOVX, fFOVY); g_spContextP2[0]->SetFOV ( fFOVX, fFOVY); g_spContextP2[1]->SetFOV ( fFOVX, fFOVY);
// Left side of the screen shows the normal camera position spCameraP1->AttachToEntity(pMouseCamera, VisVector_cl(0, 0,0) );
// left eye slightly translated and rotated ::Math.EulerToMatrix(-fYaw,0,0, rotMat); spCameraP2[0]->AttachToEntity(pMouseCamera, VisVector_cl(0, fDistanceEyeToCenter,0), &rotMat );
// right eye slightly translated and rotated, optionally pitch correction, too improve resolution ::Math.EulerToMatrix( fYaw,iUsePitchCorrection*fFOVY/iSizeY,0, rotMat); spCameraP2[1]->AttachToEntity(pMouseCamera, VisVector_cl(0,-fDistanceEyeToCenter,0), &rotMat ); }
_________________ ---------------------------------
What a strange username..
1140 <=> ETA
|
| Sun Dec 07, 2008 5:44 am |
|
 |
|
KindDragon
Cross Eyed!
Joined: Sat Mar 10, 2007 4:05 am Posts: 108 Location: Russia
|
1140 wrote: At last the code I forgot to add, the pixel-shader: Code: float4 ps_main( PS_IN In ) : COLOR { // Convert to Pixel, use proper rounding int DestinationPixelY = (In.UV0.y*ViewPortSize.y) + 0.5; // Detect odd pixel row int Odd=(DestinationPixelY%2); // Calculate source pixel // Odd pixels are from 2nd viewport at half of viewportsize int SourcePixel = ((DestinationPixelY-Odd) + Odd*ViewPortSize.y)*0.5; // offset 0.5 to center of pixel // Scale to 0..1 float2 UV =float2(In.UV0.x,(SourcePixel+0.5)/ViewPortSize.y); float4 tc = tex2D(BaseTexture, UV); return tc; }
I used the pixel shader Code: float4 cHalfScreenSize : register(c2) = { 640 / 2, 480 / 2, 0.5 / 640, 0.5 / 480 };
struct PS_INPUT { float2 t : TEXCOORD0; };
float4 shaderHorizontalInterlacedOptimized(PS_INPUT input) : COLOR { if (frac(input.t.y * cHalfScreenSize.y) < 0.5f) // y odd check return tex2D(sL, input.t + float2(0, cHalfScreenSize.w)); else return tex2D(sR, input.t - float2(0, cHalfScreenSize.w)); }
Also, better use Off-Axis (Asymmetric frustum parallel axis projection) method. http://local.wasp.uwa.edu.au/~pbourke/m ... reorender/http://www.orthostereo.com/geometryopengl.html
_________________Stereoscopic Steam Group: Join now
|
| Sun Dec 07, 2008 8:02 am |
|
 |
|
1140
One Eyed Hopeful
Joined: Sat Dec 22, 2007 3:38 am Posts: 23
|
KindDragon wrote: I used the pixel shader Code: float4 shaderHorizontalInterlacedOptimized(PS_INPUT input) : COLOR { if (frac(input.t.y * cHalfScreenSize.y) < 0.5f) // y odd check return tex2D(sL, input.t + float2(0, cHalfScreenSize.w)); else return tex2D(sR, input.t - float2(0, cHalfScreenSize.w)); }
I dont know if yours is faster, there are less lines, but almost the same calculations are done within those 3 lines. I had one requirement, it should run on my laptop (Go6800) which is terribly bad when using IF statements. In other shaders I made the nVidia started flipping on me, when using IF / ELSE statements. So I just made them unneeded  Maybe your shader should work, but when using the following it totally screws up my picture. Code: If ( x < 1. ) {..} else if ( x < 2. ) {..}
Since I was using only one texture, I had to render the left and right view in the same texture. So the pixel calculation is slightly larger, since I needed to add 0.5*view_size_y for the right view. Maybe I could use the frac(...) in my pixel shader, to get it faster, but I though integer calculation would work faster. And I did not find the frac() when searching for such a method  And I also dont know how smart the GPU-pipeline is, on a P4 it is better to calculated, then to do some branching. This seems interesting, but this is not what the iZ3D driver is doing. At least not when the AUTOFOCUS is on, this still gives the crossed-eyed look. ... Or this only makes both the Zplanes parallel.. We have an application, which shows an excavator bucket in close range, and the world 2000 meters behind it. This means the tree's in the background are very much displaced when comparing right and left eye. When a tree would almost be visible in the center of the viewport, for the left eye, the tree is almost at the right-side of the monitor, and for the right-eye the tree is almost rendered at the left-side of the monitor. Giving exactly the same view when looking through a window to an object 2000m away, but it looks very stranges when rendered as anaglyph red/blue. These are two links of some of our recent and older applications : Excavator simulator: linkCutterSuctionDredger simulator: link
_________________ ---------------------------------
What a strange username..
1140 <=> ETA
|
| Sun Dec 07, 2008 12:33 pm |
|
 |
|
KindDragon
Cross Eyed!
Joined: Sat Mar 10, 2007 4:05 am Posts: 108 Location: Russia
|
1140 wrote: I dont know if yours is faster, there are less lines, but almost the same calculations are done within those 3 lines. I had one requirement, it should run on my laptop (Go6800) which is terribly bad when using IF statements. In other shaders I made the nVidia started flipping on me, when using IF / ELSE statements. So I just made them unneeded  Maybe your shader should work, but when using the following it totally screws up my picture. Code: If ( x < 1. ) {..} else if ( x < 2. ) {..}
D3D shader compiler automatic use static brunching without if instructions (ps.2.0). 1140 wrote: Since I was using only one texture, I had to render the left and right view in the same texture. So the pixel calculation is slightly larger, since I needed to add 0.5*view_size_y for the right view. You can use only arithmetic instructions because you use one texture, we can't (. 1140 wrote: Maybe I could use the frac(...) in my pixel shader, to get it faster, but I though integer calculation would work faster. And I did not find the frac() when searching for such a method  And I also dont know how smart the GPU-pipeline is, on a P4 it is better to calculated, then to do some branching. Integer calculations only support for shaders version 4.0, older shaders emulate using floating point instructions. 1140 wrote: This seems interesting, but this is not what the iZ3D driver is doing. At least not when the AUTOFOCUS is on, this still gives the crossed-eyed look. ... Or this only makes both the Zplanes parallel.. We have an application, which shows an excavator bucket in close range, and the world 2000 meters behind it. This means the tree's in the background are very much displaced when comparing right and left eye. When a tree would almost be visible in the center of the viewport, for the left eye, the tree is almost at the right-side of the monitor, and for the right-eye the tree is almost rendered at the left-side of the monitor. Giving exactly the same view when looking through a window to an object 2000m away, but it looks very stranges when rendered as anaglyph red/blue. These are two links of some of our recent and older applications : Excavator simulator: linkCutterSuctionDredger simulator: linkiZ3D driver uses 100% off-axis method. Auto-focus only change convergence. I know for sure  Draw plane parallel to screen, set convergence on it and you'll see that the separation would have no influence on it.
_________________Stereoscopic Steam Group: Join now
|
| Sun Dec 07, 2008 7:02 pm |
|
 |
|
1140
One Eyed Hopeful
Joined: Sat Dec 22, 2007 3:38 am Posts: 23
|
KindDragon wrote: D3D shader compiler automatic use static brunching without if instructions (ps.2.0).. Quote: Static branch prediction always assumes two things: Forward-pointing branches will not be taken. Backward-pointing branches will be taken. How does this work ? There should be some sort of 'cmp' instruction, to check which piece of shadercode to call? KindDragon wrote: You can use only arithmetic instructions because you use one texture, we can't (. Why not, just divide the viewport Y by 2 and place right view in lower half. But I guess you like to re-use code for all renderpaths (iZ3d/interlaced/dlp/..) ? And how about using my second (SLI-mode) videocard to render the right eye ? For iZ3D monitors this would be easy, since you use two monitor outputs. But could this also be used for interlaced ? And another question.... In our application we can have mirrors in our 3D world and Picture-in-Picture for rendering extra camera angles. A mirror is a magic texture which is different for the left and right rendered view. How does the driver know when to render a stereo image, and when not to ? Can I force one rendercontext to render stereoscopic and another one to render mono ? Then I can have one large stereoscopic view, and some mono picture-in-picture views, to preserve the FPS.
_________________ ---------------------------------
What a strange username..
1140 <=> ETA
|
| Tue Dec 09, 2008 3:01 am |
|
 |
|
KindDragon
Cross Eyed!
Joined: Sat Mar 10, 2007 4:05 am Posts: 108 Location: Russia
|
1140 wrote: How does this work ? There should be some sort of 'cmp' instruction, to check which piece of shadercode to call? Yes, executed all code, but result selected using 'cmp'. Code: ps_2_0 def c0, -0.5, 0, 0, 0 dcl t0.xy dcl_2d s0 dcl_2d s1 texld r0, t0, s0 texld r1, t0, s1 mul r2.w, t0.y, c2.y frc r2.x, r2.w add r2.x, r2.x, c0.x cmp r0, r2.x, r1, r0 mov oC0, r0
1140 wrote: Why not, just divide the viewport Y by 2 and place right view in lower half. But I guess you like to re-use code for all renderpaths (iZ3d/interlaced/dlp/..) ? You are right. Also, reduce of all render targets height by 2 is a very complicated task, because the game thinks that they are normal size. 1140 wrote: And how about using my second (SLI-mode) videocard to render the right eye ? For iZ3D monitors this would be easy, since you use two monitor outputs. But could this also be used for interlaced ? We also difficult, because we work with two monitors through one D3D device. 1140 wrote: And another question.... In our application we can have mirrors in our 3D world and Picture-in-Picture for rendering extra camera angles. A mirror is a magic texture which is different for the left and right rendered view. How does the driver know when to render a stereo image, and when not to ? Can I force one rendercontext to render stereoscopic and another one to render mono ? Then I can have one large stereoscopic view, and some mono picture-in-picture views, to preserve the FPS. The driver assumes that all render targets (RT) is a stereo (we create the second for the right view), exceptions can be set only in profile. For example, key CreateSquareRTInMono said that all square RT will be set up in mono or key CreateRTThatLessThanBBInMono said that all RT are less back buffer will be created in mono.
_________________Stereoscopic Steam Group: Join now
|
| Tue Dec 09, 2008 6:21 am |
|
 |
|
1140
One Eyed Hopeful
Joined: Sat Dec 22, 2007 3:38 am Posts: 23
|
We just received our z800, I am looking forward to the 3D experiment. Anyone have some info on telling the z800 for which eye the view is ? Is there a way to put a RED upperleft pixel for left eye, and BLUE upperleft pixel for right eye ? Or is it actually needed to have 60fps in our application.
_________________ ---------------------------------
What a strange username..
1140 <=> ETA
|
| Wed May 13, 2009 12:46 pm |
|
 |
|
crim3
Certif-Eyed!
Joined: Sat Sep 22, 2007 3:11 am Posts: 635 Location: Spain
|
1140 wrote: Anyone have some info on telling the z800 for which eye the view is ? I've seen that same question often, but only negative answers. There isn't a way of doing that with the normal single input z800, or at least none has reported it.
_________________ Zalman Trimon ZM-M220W / Acer H5360 with Another Eye2000 shutters / nVIDIA GTX285
|
| Thu May 14, 2009 12:46 am |
|
 |
|
superdtec
One Eyed Hopeful
Joined: Tue Jun 16, 2009 3:44 am Posts: 6
|
How do you save the rendered result in your app? I just was wondering how you save the left-eye image and right-eye image. There always comes some incorrect results while I render the scene twice through left half viewport and right half viewport and this may decrease the image resolution. How about if I render the scene with origional viewport to my rendertarget( textures created by myself at the app initialization), I think it would be right but I cannot make it right when I try to do so. The app didnot allow me to change the current render target or I could not get the right result.
|
| Mon Feb 01, 2010 9:57 pm |
|
 |
|
|
Page 1 of 1
|
[ 17 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|