fantastic! I've gotten my first 3d vision demo running!!

superlxt
One Eyed Hopeful
Posts: 5
Joined: Thu Dec 03, 2009 5:07 am

fantastic! I've gotten my first 3d vision demo running!!

Post by superlxt »

It's exciting!I finally let my codes run and see the stereocopic effect.And I wanna share with you since I got all the important infomation from this forum.

I have a Nvidia 3d vision kit and my platform is win7, direct9.0c sdk.I successfully display a stereo image(just 2 images side by side indeed) with the shutter glass activated
Nvidia used to say something about develop with its 3d vision driver but that's not easy to find them.You can get something here
http://www.mtbs3d.com/phpBB/viewtopic.php?f=60&t=4026" onclick="window.open(this.href);return false;
The GDC09 pdf is important.Nvapi is not necessary.

The steps to display a stereo image are correct. However the codes in that pdf are not totally right.
There are some points you should pay attention to.
1. The size of offscreensurface should be gImageWidth * 2 and gImageHeight (not gImageHeight+1)
2. _Nv_Stereo_Image_Header is correct but the write opperation to surface is wrong. It should be:
// write stereo signature in the last raw of the stereo image
LPNVSTEREOIMAGEHEADER pSIH =
(LPNVSTEREOIMAGEHEADER)(((unsigned char *) lr.pBits) + (lr.Pitch * (gImageHeight-1)));
3. The pdf doesn't write code for the last step. It should be
g_pd3dDevice->StretchRect(gImageSrc, &imageSrcRect, gBackBuf, &backBufferRect, D3DTEXF_NONE);


my code looks ugly and is buggy.I'll work on it and release a demo a few days later probably.
But I wanna show some important codes which I think are enough for you guys to know the key point.

HWND g_hWnd = NULL;
LPDIRECT3D9 g_pD3D = NULL;
LPDIRECT3DDEVICE9 g_pd3dDevice = NULL;
IDirect3DSurface9* gImageSrc = NULL; // Source stereo image beeing created
IDirect3DSurface9* gBackBuf = NULL; //BackBuffer

int gImageWidth = 1680; // Source image width
int gImageHeight = 1050; // Source image height


g_pD3D = Direct3DCreate9( D3D_SDK_VERSION );
D3DPRESENT_PARAMETERS d3dpp;
d3dpp.Windowed = FALSE;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferWidth = 1680;
d3dpp.BackBufferHeight = 1050;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
d3dpp.BackBufferCount = 1;

g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_hWnd,
flags, &d3dpp, &g_pd3dDevice )
//create offscreenplainsurface and load the stereo image "TestPic.bmp" ( width is gImageWidth*2 and height is gImageHeight )
g_pd3dDevice->CreateOffscreenPlainSurface(gImageWidth*2, gImageHeight, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &gImageSrc, NULL);
D3DXLoadSurfaceFromFile(gImageSrc, NULL, NULL, L"G:/TestPic.bmp", NULL, D3DX_FILTER_NONE, 0, NULL);

// Lock the stereo image
D3DLOCKED_RECT lr;
gImageSrc->LockRect(&lr,NULL,0);
// write stereo signature in the last raw of the stereo image
LPNVSTEREOIMAGEHEADER pSIH =
(LPNVSTEREOIMAGEHEADER)(((unsigned char *) lr.pBits) + (lr.Pitch * (gImageHeight-1)));
// Update the signature header values
pSIH->dwSignature = NVSTEREO_IMAGE_SIGNATURE;
pSIH->dwBPP = 32;
pSIH->dwFlags = SIH_SWAP_EYES; // Src image has left on left and right on right
pSIH->dwWidth = gImageWidth*2;
pSIH->dwHeight = gImageHeight;
// Unlock surface
gImageSrc->UnlockRect();

g_pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &gBackBuf);

//then present
void render( void )
{
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET,
D3DCOLOR_ARGB(1,0,0,0), 1.0f, 0 );
g_pd3dDevice->BeginScene();
g_pd3dDevice->StretchRect(gImageSrc, &imageSrcRect, gBackBuf, &backBufferRect, D3DTEXF_NONE);
g_pd3dDevice->EndScene();
g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
JasonMiller
One Eyed Hopeful
Posts: 7
Joined: Thu Dec 10, 2009 9:07 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by JasonMiller »

This sounds fantastic and is exactly what I was looking for.
I only just recently discovered the possibility to program with the 3DVision Kit as an output device and the information available for it is very scarce.

I'm looking forward to see your complete code sample!
What version of Windows 7 are you running, the 32bit or the 64bit version?
Also I gather you programmed this solely using the DirectX SDK without making use of the Nvidia SDK?
Please correct me if I'm wrong here. Knowing the right specs and kits needed to start programming succesfully for the 3DVision Kit would be awesome, so any further information is greatly appreciated!
superlxt
One Eyed Hopeful
Posts: 5
Joined: Thu Dec 03, 2009 5:07 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by superlxt »

my os is win7 32bit.You don't need nvidia sdk, just direct3d sdk is ok.
JasonMiller
One Eyed Hopeful
Posts: 7
Joined: Thu Dec 10, 2009 9:07 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by JasonMiller »

Thanks for the answer!
I tried emulating your success using the DirectX SDK from August 2009, just working from the CreateDevice sample.
EDIT: This no longer appliesWhen compiling I get several errors though concerning the following lines:

D3DXLoadImageFromFile()
LPNVSTEREOIMAGEHEADER

Both can not be found. I assume I'm missing some includes, but I'm still trying to figure out which.

Maybe you could upload your sample here, I don't care how buggy or anything it is.
Any help is greatly appreciated!

EDIT:
I got the application running. The result is not really the desired one but I'm gonna continue playing around with it from there.
I simply forgot to define the Nvidia Header and inlcude the d3dx9 one.
I am still curious about your progress though!
Kosalos
One Eyed Hopeful
Posts: 3
Joined: Mon Jan 11, 2010 7:21 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by Kosalos »

Hi,
Have Win7 with VisualStudio 2008, and Nvidia 3d vision hardware.
I need explicit instructions on what software to download, and a complete example program that demonstrates drawing a simple oject (such as a spinning cube) in 3D.
The recognize the expertise and hard work it takes to get this all to add up.
Please name your price for the software.
thanks
rajkosto
Two Eyed Hopeful
Posts: 59
Joined: Thu Sep 10, 2009 12:04 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by rajkosto »

huh, if you know what youre doing you should be set with this, the basic premise is very simple, simply present on a backbuffer thats 2x the width of a normal one, and then write some metadata at the end.
there's a stereoscopic sample on iz3d.com/developer, it includes the matrix multiplications needed for 3d with 3d objects, for example
you should just modify it and take the left and right view and present them like in this example, and you should be able to see 3d with nvidia.

id try doing it but i dont have a 3d vision setup, sorry.
crim3
Certif-Eyed!
Posts: 642
Joined: Sat Sep 22, 2007 3:11 am
Location: Valencia (Spain)

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by crim3 »

I learnt direct3d 9 from this excelent book: http://www.amazon.com/Introduction-Prog ... 1556229135" onclick="window.open(this.href);return false;
Zalman Trimon ZM-M220W / Acer H5360 with Another Eye2000 shutters / nVIDIA GTX760
rajkosto
Two Eyed Hopeful
Posts: 59
Joined: Thu Sep 10, 2009 12:04 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by rajkosto »

all i needed was msdn.com and google, but i already had very extensive opengl and general computer graphics knowledge
JasonMiller
One Eyed Hopeful
Posts: 7
Joined: Thu Dec 10, 2009 9:07 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by JasonMiller »

It finally works!

I worked exclusively off the GDC09 presentation and some Direct3D tutorials.
Thanks to rajkosto for spelling out what you have to do. Sometimes you're too close to see the big picture.

Anyway, my Direct3D knowledge was nonexistend prior to this, but digging through several online tutorials I learned enough to accomplish what I wanted.
I'm gonna upload the source code. It's quite bad, I just piled almost everything into one big file. But it works and that's what counts for now.
Keep in mind that I hardwired the resolution to 1680x1050, which was also the resolution of the pictures I worked with.
You might have to change that along with the location and name of your pictures.
Also I had to discard the SIH_SWAP_EYES flag. If you load your left image left and your right image right there's no need to swap them.

I hope this helps other people and let me know if it works for you too.
You do not have the required permissions to view the files attached to this post.
Kosalos
One Eyed Hopeful
Posts: 3
Joined: Mon Jan 11, 2010 7:21 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by Kosalos »

Thanks for everyone's advice.
Attached is my first working 3D Vision program, using Direct3D9
You do not have the required permissions to view the files attached to this post.
Kosalos
One Eyed Hopeful
Posts: 3
Joined: Mon Jan 11, 2010 7:21 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by Kosalos »

Jason, can you post your TestPicL images as companions for your code?
JasonMiller
One Eyed Hopeful
Posts: 7
Joined: Thu Dec 10, 2009 9:07 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by JasonMiller »

I'm sorry but I can't do that as I don't own the copyright to the pictures I used.
ginko
One Eyed Hopeful
Posts: 1
Joined: Sun Feb 21, 2010 7:46 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by ginko »

Hi everybody, thanks for all these informations.
JasonMiller I have compiled your code but at the execution I have an access violation.
Do you know why ?

The error is :
__vfptr CXX0030: Error: expression cannot be evaluated

It mean that it can't access to virtual fonctions of *d3ddev, like IDirect3DDevice9::CreateOffscreenPlainSurface Method, but why ?
I'm using windows 7 x64 (but compile for 32, i guess...) and visual studio 2010 beta 2.

Kosalos with your's my screen is flicking until 1 second but nothing happened.

I'm not a good cpp developper nor a good english talker, so, sorry for that ;)

Ginko
JasonMiller
One Eyed Hopeful
Posts: 7
Joined: Thu Dec 10, 2009 9:07 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by JasonMiller »

I'm not really familiar with that error. It seems like it doesn't properly set up the device.
The only advice is trying it with VS2008 as it could be something caused by the beta vesrion you are using.
Despite that I'm sorry I don't have more to help.
User avatar
gl
One Eyed Hopeful
Posts: 20
Joined: Sat Feb 16, 2008 3:13 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by gl »

Does anyone know if you can correct the aspect ratio of your images in the StretchRect call? I've tried various things (eg. using different source and destination rectangles, or adjusting dwWidth & dwHeight), nothing makes any difference.

Also what are dwWidth and dwHeight actually used for? They don't seem to do anything.
User avatar
artehistoria
One Eyed Hopeful
Posts: 1
Joined: Tue May 04, 2010 8:22 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by artehistoria »

That's great, I've been trying to get some help on stereo video on the nVidia forums with no luck. If i get this working I'll post my own findings.
--
ARTEHISTORIA.COM
visionlabz
One Eyed Hopeful
Posts: 3
Joined: Tue Jun 01, 2010 7:23 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by visionlabz »

@ gl:

I had the same problem with the aspect ratio till I tried further flags. NVidia did not mention further flags but it works!

You can change the Stretchrect to scale to fullscreen by using a further flag for the Signature:
#define SIH_SCALE_TO_FIT2 0x00000004

So your final flag in the signature would be:
// Update the signature header values
pSIH->dwFlags= SIH_SWAP_EYES | SIH_SCALE_TO_FIT | SIH_SCALE_TO_FIT2; // Srcimage has left on left and right on right

I don't know what the dwWidth and dwHeight values are for. I did not experience any difference.


@ superlxt:
IMHO It is right what the pdf says. The surfaces height must be +1. The driver will erase the last extra line. Obviously it still works without +1 because the driver always checks for the last line. But without +1 the last line of your actual texture/picture would be erased.
User avatar
gl
One Eyed Hopeful
Posts: 20
Joined: Sat Feb 16, 2008 3:13 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by gl »

visionlabz wrote:@ gl:

I had the same problem with the aspect ratio till I tried further flags. NVidia did not mention further flags but it works!

You can change the Stretchrect to scale to fullscreen by using a further flag for the Signature:
#define SIH_SCALE_TO_FIT2 0x00000004
I discovered that flag too, but it doesn't help if your video doesn't match the screen dimensions. I've been in touch with Nivida and they say there's no way to do arbitrary aspect ratio correction except manually with an extra step. They also confirmed the dwWidth/dwHeight params aren't used for anything (yet).
visionlabz
One Eyed Hopeful
Posts: 3
Joined: Tue Jun 01, 2010 7:23 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by visionlabz »

I am just wondering why it works with me. I have 2*640x480 Input and display at 1280x720. The ratio has not been an issue when using both flags...

i might need to recheck.
User avatar
gl
One Eyed Hopeful
Posts: 20
Joined: Sat Feb 16, 2008 3:13 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by gl »

I think we might be talking about different things.

I'm actually talking about correcting PAR (pixel aspect ratio). Example, HDV is displayed as full HD (1920x1080p) but stored as 1440x1080p, so you need to stretch the horizontal by 1.3x. I found no way to do that with the flags.

IIRC, there are two flags, one which stretches the video to fit the screen horizontally, and another vertically, but they both assume that the pixel aspect ratio of the source frames is 1:1.
salmanmaslam
One Eyed Hopeful
Posts: 1
Joined: Wed Jun 09, 2010 4:08 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by salmanmaslam »

Jason, thanks so much. Worked first time around. Brilliant!!

Also, to get stereo images, try the following database:

http://research.microsoft.com/en-us/um/ ... tabase.zip" onclick="window.open(this.href);return false;

This database contains left and right pair avi's. To extract images from the avi's, you can use Virtual Dub (File->Export->image sequence)
visionlabz
One Eyed Hopeful
Posts: 3
Joined: Tue Jun 01, 2010 7:23 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by visionlabz »

@ gl:

I understand your problem with the aspect ratio. Why don't you just copy the frame you want to display to an offscreen surface with the size of the (backbuffer width x 2) x (backbuffer height).
You copy it to that surface using vertices which take in account the aspect ratio of your display.

e.g. 1280x1024 backbuffer size
- create offscreen surface 2560x1024
- copy frame you want to display to offscreen using coordinates (0,0,2560,720). The offscreen would then be letterboxed.
- use stretchrect to display on backbuffer

With this solution you dont even need a flag at all

Hope that helps!
User avatar
gl
One Eyed Hopeful
Posts: 20
Joined: Sat Feb 16, 2008 3:13 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by gl »

I know how to do it manually, but I wanted to avoid an extra copy for performance reasons. I've recommended NV implement this in the future, it's not hard to do for them (they could use the width & height params for exactly that).
akira32
One Eyed Hopeful
Posts: 6
Joined: Sat Jul 17, 2010 10:59 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by akira32 »

http://developer.download.nvidia.com/SD" onclick="window.open(this.href);return false; ... reoAPI.zip
The sample code appears 13 error when I compile as below:
That seems to don't include DXUT.h. But I add DXUT.h, the error still appear. I use DirectX SDK June 2005 update.
Does anyone meeet the same problem? Or I must install whch SDK?

Error 13 error LNK2019: unresolved external symbol "long __cdecl DXUTCreateWindow(wchar_t const *,struct HINSTANCE__ *,struct HICON__ *,struct HMENU__ *,int,int)" (?DXUTCreateWindow@@YAJPB_WPAUHINSTANCE__@@PAUHICON__@@PAUHMENU__@@HH@Z) referenced in function _WinMain@16 StereoAPIApp.obj
Error 14 error LNK2019: unresolved external symbol "public: __thiscall CDXUTMesh::CDXUTMesh(wchar_t const *)" (??0CDXUTMesh@@QAE@PB_W@Z) referenced in function "void __cdecl InitApp(void)" (?InitApp@@YAXXZ) StereoAPIApp.obj
Error 15 error LNK2019: unresolved external symbol "public: long __thiscall CDXUTDialog::AddStatic(int,wchar_t const *,int,int,int,int,bool,class CDXUTStatic * *)" (?AddStatic@CDXUTDialog@@QAEJHPB_WHHHH_NPAPAVCDXUTStatic@@@Z) referenced in function "void __cdecl InitApp(void)" (?InitApp@@YAXXZ) StereoAPIApp.obj
Error 16 error LNK2019: unresolved external symbol "public: long __thiscall CDXUTListBox::AddItem(wchar_t const *,void *)" (?AddItem@CDXUTListBox@@QAEJPB_WPAX@Z) referenced in function "void __cdecl InitApp(void)" (?InitApp@@YAXXZ) StereoAPIApp.obj
Error 17 error LNK2019: unresolved external symbol "public: long __thiscall CDXUTDialog::AddCheckBox(int,wchar_t const *,int,int,int,int,bool,unsigned int,bool,class CDXUTCheckBox * *)" (?AddCheckBox@CDXUTDialog@@QAEJHPB_WHHHH_NI1PAPAVCDXUTCheckBox@@@Z) referenced in function "void __cdecl InitApp(void)" (?InitApp@@YAXXZ) StereoAPIApp.obj
Error 18 error LNK2019: unresolved external symbol "public: long __thiscall CDXUTDialog::AddButton(int,wchar_t const *,int,int,int,int,unsigned int,bool,class CDXUTButton * *)" (?AddButton@CDXUTDialog@@QAEJHPB_WHHHHI_NPAPAVCDXUTButton@@@Z) referenced in function "void __cdecl InitApp(void)" (?InitApp@@YAXXZ) StereoAPIApp.obj
Error 19 error LNK2019: unresolved external symbol "long __stdcall DXUTTrace(char const *,unsigned long,long,wchar_t const *,bool)" (?DXUTTrace@@YGJPBDKJPB_W_N@Z) referenced in function "long __stdcall OnCreateDevice(struct IDirect3DDevice9 *,struct _D3DSURFACE_DESC const *,void *)" (?OnCreateDevice@@YGJPAUIDirect3DDevice9@@PBU_D3DSURFACE_DESC@@PAX@Z) StereoAPIApp.obj
Error 20 error LNK2019: unresolved external symbol "wchar_t const * __cdecl DXUTGetDeviceStats(void)" (?DXUTGetDeviceStats@@YAPB_WXZ) referenced in function "void __cdecl RenderText(void)" (?RenderText@@YAXXZ) StereoAPIApp.obj
Error 21 error LNK2019: unresolved external symbol "public: long __thiscall CDXUTTextHelper::DrawTextLine(wchar_t const *)" (?DrawTextLine@CDXUTTextHelper@@QAEJPB_W@Z) referenced in function "void __cdecl RenderText(void)" (?RenderText@@YAXXZ) StereoAPIApp.obj
Error 22 error LNK2019: unresolved external symbol "wchar_t const * __cdecl DXUTGetFrameStats(void)" (?DXUTGetFrameStats@@YAPB_WXZ) referenced in function "void __cdecl RenderText(void)" (?RenderText@@YAXXZ) StereoAPIApp.obj
Error 23 error LNK2019: unresolved external symbol "public: long __thiscall CDXUTMesh::Create(struct IDirect3DDevice9 *,wchar_t const *)" (?Create@CDXUTMesh@@QAEJPAUIDirect3DDevice9@@PB_W@Z) referenced in function "long __cdecl LoadMeshHelperFunction(class CDXUTMesh *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> >,struct IDirect3DDevice9 *)" (?LoadMeshHelperFunction@@YAJPAVCDXUTMesh@@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@PAUIDirect3DDevice9@@@Z) StereoAPIApp.obj
Error 24 error LNK2019: unresolved external symbol "public: long __thiscall CDXUTStatic::SetText(wchar_t const *)" (?SetText@CDXUTStatic@@QAEJPB_W@Z) referenced in function "void __cdecl UpdateConvergence(void)" (?UpdateConvergence@@YAXXZ) StereoAPIApp.obj
Error 25 fatal error LNK1120: 12 unresolved externals ../../bin/debug/StereoAPI.exe
cbuchner1
One Eyed Hopeful
Posts: 1
Joined: Tue Aug 03, 2010 2:58 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by cbuchner1 »

Hi everybody.

Thank you for this sample - it was helpful. I am greeted with wonderful 3D boobies on my screen (didn't have any better test image, haha)

But be careful, you have to release the backbuffer once you're done with it or you will have a memory leak.

Code: Select all


    d3ddev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &gBackBuf);
    d3ddev->StretchRect(gImageSrc, NULL, gBackBuf, &destRect, D3DTEXF_NONE);
    gBackBuf->Release();

And shouldn't the bottom and right members of most RECTs subtract one pixel from Width and Height?

Here's more info: nVidia driver 186.18 (the first one with 3D Vision discover, i.e. red/cyan anaglyph mode) does not appear to handle SIH_SCALE_TO_FIT2. My source image is in full HD resolution (boobies!) however when trying to blit it to the 1280x800 screen in analglyph mode this flag does not work. I only see part of the source image.

The SIH_SCALE_TO_FIT flag works fine and maintains aspect ratio however. I get black stripes on top and bottom because my laptop screen is 16:10, the source image is 16:9

Do different driver versions handle these flags differently? If so, this would be a nightmare for application developers.
mgb
One Eyed Hopeful
Posts: 10
Joined: Fri Aug 06, 2010 11:29 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by mgb »

Has anyone got an example of a running program?

I tried JasonMiller's program (Direct3DTutorial.zip) but I just get two images side/side - the Vision glass don't activate.
EDIT: Following up my own post - you have to manually turn on the NVidia glasses!

Note: the sample code has the resolution of a Samsung 2233 hardcoded into it, to run it on any other screen (or projector) remember to change this!!!
Robulus
One Eyed Hopeful
Posts: 1
Joined: Mon Aug 16, 2010 12:21 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by Robulus »

I'm trying to do the same thing... My C++ tools are asking for D3DX9.DLL to define Direct3DCreate9(). But I can't find D3DX9.DLL on my computer. There are several versions, I believe, labeled d3dx9_24.dll through d3dx9_43.dll... I even tried renaming one of them to d3dx9.dll but my implib utility failed to create an LIB from it. :( All suggestions are welcome, thanks!
User avatar
gl
One Eyed Hopeful
Posts: 20
Joined: Sat Feb 16, 2008 3:13 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by gl »

Robulus wrote:I'm trying to do the same thing... My C++ tools are asking for D3DX9.DLL to define Direct3DCreate9(). But I can't find D3DX9.DLL on my computer. There are several versions, I believe, labeled d3dx9_24.dll through d3dx9_43.dll... I even tried renaming one of them to d3dx9.dll but my implib utility failed to create an LIB from it. :( All suggestions are welcome, thanks!
Install the latest DirectX SDK. If that isn't it, check the search order of your include and library paths - the DX SDK should come above (ie. should be searched before) most other headers/libraries.
DeVi
One Eyed Hopeful
Posts: 1
Joined: Sun Apr 11, 2010 9:33 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by DeVi »

How can I display a stereo image with Direct3D 10 or 11? In Direct3D9 I can use the StretchRect method, but what is the equivalent of this in D3D10 or 11? Somehow they do this in Crysis 2. :)

NVAPI documentation mentions the ResourceCopyRegion function at the NvAPI_Stereo_ReverseStereoBlitControl's description, but how can I get a D3D10DDI_HDEVICE from an ID3D10Device?
LukasBandeira
One Eyed Hopeful
Posts: 1
Joined: Tue Sep 28, 2010 9:33 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by LukasBandeira »

guys I am very much a super noob at graphics and Stereoscopic 3d programming so do any of you know a tutorial for how to make existing projects Stereoscopic 3D.
Thanks
reventon
One Eyed Hopeful
Posts: 6
Joined: Tue Jun 29, 2010 6:19 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by reventon »

cbuchner1 wrote:
The SIH_SCALE_TO_FIT flag works fine and maintains aspect ratio however. I get black stripes on top and bottom because my laptop screen is 16:10, the source image is 16:9
Hi, cbuchner1. Could you tell me how to use the SIH_SCALE_TO_FIT flag? What are the rectangle parameters in your StretchRect function? Currently, I need to calculate the destination rectangle manually to maintain the aspect ratio. It would be great if the graphics driver can automatically do this job.
nsa666
One Eyed Hopeful
Posts: 3
Joined: Sat Jan 01, 2011 6:01 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by nsa666 »

Did someone managed to get it to work in a window like this website http://videos.3dvisionlive.com/" onclick="window.open(this.href);return false; (works only with new 1.38 driver)? :shutter
nsa666
One Eyed Hopeful
Posts: 3
Joined: Sat Jan 01, 2011 6:01 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by nsa666 »

Image it DOES actually work... in a window.. without quadro card. :mrgreen:
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by cybereality »

Wow, you got it working! Was there a trick? What are your system specs?
nsa666
One Eyed Hopeful
Posts: 3
Joined: Sat Jan 01, 2011 6:01 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by nsa666 »

There is a list(in nvidia driver) of applications that is allowed to make stereo 3d in a window. For example googlearth.
You just make it windowed on CreateDevice(..) parameters. Than you just rename it to googleearth.exe and it work. :3D


P.S.: You will need driver-cd 1.45 for this to work!

P.S.2: It DOES NOT work with anaglyph discovery mode, only with real vision 3d glases.

System specs: C2Q Q6600, GTX470, 4GB RAM.
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by cybereality »

nsa666 wrote:There is a list(in nvidia driver) of applications that is allowed to make stereo 3d in a window. For example googlearth.
Just the kind of thing Nvidia loves to do. I wonder how much Google had to pay to enable that feature...
User avatar
phil
Cross Eyed!
Posts: 160
Joined: Sat Apr 26, 2008 4:23 pm
Location: Montréal, Canada
Contact:

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by phil »

Windowed mode, awesome!! :D

However, with the new drivers it seems that the game configs are no longer stored in the registry :(

For apps that render native stereo, previously we would create a config in the registry and set StereoTextureEnable to 0 to stop the driver from mucking-about with the rendering. Now we have to rename the exe to something like "avatar.exe" to get the same result, unless someone knows a better way? I had a look in the NVIDIA API for a function to disable the driver-generated stereo (and enable windowed mode) but couldn't see anything.

Renaming the exe to "googleearth.exe" lets the native stereo apps do their "reverse stereo blit" successfully in a window, but the driver still mucks about with the rendering because the Google Earth profile doesn't disable the driver-generated stereo.

We would have a perfect workaround if one of the windowed-enabled apps in the list were generating its stereo natively. Does anyone know if this is the case, and if so what is the name of its exe?

If anyone finds out how we're actually supposed to configure the driver during development now (disable driver-generated stereo, enable windowed mode) please let us know! I'll do the same if I find anything out.

Cheers,
phil
User avatar
cybereality
3D Angel Eyes (Moderator)
Posts: 11407
Joined: Sat Apr 12, 2008 8:18 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by cybereality »

phil wrote: We would have a perfect workaround if one of the windowed-enabled apps in the list were generating its stereo natively. Does anyone know if this is the case, and if so what is the name of its exe?
What about the 3D Vision web browser plug-in? That does windowed mode on the 3D Vision Live site, and it might be using native mode.
hughli
One Eyed Hopeful
Posts: 1
Joined: Mon Mar 07, 2011 1:33 pm

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by hughli »

Hi, Guys:

I am working on online 3D vision. Do somebody know how will 3D vision work with silverlight (C# mamaged code)? or Do someboday get experiences?

Thanks,

Hugh
commaster
One Eyed Hopeful
Posts: 4
Joined: Mon Aug 27, 2012 10:59 am

Re: fantastic! I've gotten my first 3d vision demo running!!

Post by commaster »

superlxt wrote: HWND g_hWnd = NULL;
LPDIRECT3D9 g_pD3D = NULL;
LPDIRECT3DDEVICE9 g_pd3dDevice = NULL;
IDirect3DSurface9* gImageSrc = NULL; // Source stereo image beeing created
IDirect3DSurface9* gBackBuf = NULL; //BackBuffer

int gImageWidth = 1680; // Source image width
int gImageHeight = 1050; // Source image height


g_pD3D = Direct3DCreate9( D3D_SDK_VERSION );
D3DPRESENT_PARAMETERS d3dpp;
d3dpp.Windowed = FALSE;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferWidth = 1680;
d3dpp.BackBufferHeight = 1050;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
d3dpp.BackBufferCount = 1;

g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_hWnd,
flags, &d3dpp, &g_pd3dDevice )
//create offscreenplainsurface and load the stereo image "TestPic.bmp" ( width is gImageWidth*2 and height is gImageHeight )
g_pd3dDevice->CreateOffscreenPlainSurface(gImageWidth*2, gImageHeight, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &gImageSrc, NULL);
D3DXLoadSurfaceFromFile(gImageSrc, NULL, NULL, L"G:/TestPic.bmp", NULL, D3DX_FILTER_NONE, 0, NULL);

// Lock the stereo image
D3DLOCKED_RECT lr;
gImageSrc->LockRect(&lr,NULL,0);
// write stereo signature in the last raw of the stereo image
LPNVSTEREOIMAGEHEADER pSIH =
(LPNVSTEREOIMAGEHEADER)(((unsigned char *) lr.pBits) + (lr.Pitch * (gImageHeight-1)));
// Update the signature header values
pSIH->dwSignature = NVSTEREO_IMAGE_SIGNATURE;
pSIH->dwBPP = 32;
pSIH->dwFlags = SIH_SWAP_EYES; // Src image has left on left and right on right
pSIH->dwWidth = gImageWidth*2;
pSIH->dwHeight = gImageHeight;
// Unlock surface
gImageSrc->UnlockRect();

g_pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &gBackBuf);

//then present
void render( void )
{
g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET,
D3DCOLOR_ARGB(1,0,0,0), 1.0f, 0 );
g_pd3dDevice->BeginScene();
g_pd3dDevice->StretchRect(gImageSrc, &imageSrcRect, gBackBuf, &backBufferRect, D3DTEXF_NONE);
g_pd3dDevice->EndScene();
g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
Does this NVSTEREOIMAGEHEADER method still work on the latest NVidia Geforce 301.42 driver?
Post Reply

Return to “NVIDIA GeForce 3D Vision Driver Forums”