Nvidia StereoAPI problem

Discussion of legacy stereoscopic 3D gaming hardware and software (e.g. NVIDIA XP stereoscopic 3D drivers).
Post Reply
vendetta122
One Eyed Hopeful
Posts: 2
Joined: Thu Aug 06, 2009 4:50 am

Nvidia StereoAPI problem

Post by vendetta122 »

Hi,

I would like to develop a 3D stereoscopic media player for my own purpose. I'm using a Geforce GTX 295 on Vista 64-bit. DirectX SDK is from March 2009.
I have downloaded the StereoAPI from http://developer.download.nvidia.com/SD ... reoAPI.zip" onclick="window.open(this.href);return false;.
But the program is not linking (DXUT library errors). Does someone have experience with this API ?

thanks for any help.
Last edited by vendetta122 on Fri Aug 07, 2009 3:26 am, edited 1 time in total.
Tril
Certif-Eyed!
Posts: 655
Joined: Tue Jul 31, 2007 6:52 am
Location: Canada

Re: Nvidia StereoAPI problem

Post by Tril »

You typed the url wrong. It's http://developer.download.nvidia.com/SD ... reoAPI.zip" onclick="window.open(this.href);return false;

DXUT is from DirectX SDK. Don't bother with StereoAPI. It was something to be used with the old NVIDIA stereo drivers. The code sample contains the message "This sample requires the NVIDIA 71.83 Stereo driver or greater. Please visit NVIDIA.COM for details."

If you are trying to make a player to use with NVIDIA 3D Vision, take a look at this pdf of a presentation given at GDC 2009. Look at pages 36 to 40. It shows that to make the video card alternate between the left and right views each frame, you place them side by side and you add a line on which you add some signature code. This stereo tag will tell the video card to display the left and right views one after the other and it most likely also activates the glasses. It looks like the code given in the pdf could be used by itself. If the glasses automatically activate when the stereo tag is detected by the NVIDIA drivers, this sample code should work.

I think that this code might be a sample from NVIDIA NVAPI. There's a public version and a NDA customers version. I think that all the 3D Vision related functions are in the NDA version. Take for example the function NvAPI_Stereo_ReverseStereoBlitControl on p. 43 of the pdf. It's not in the documentation of the public version of NVAPI.
CPU : Intel i7-7700K
RAM : 32 GB ram
Video card : GeForce GTX 980 Ti
OS : Windows 10
Display : Samsung UN40JU7500 Curved 40-Inch UHD TV with shutter glasses
HMD : Oculus Rift

Image
vendetta122
One Eyed Hopeful
Posts: 2
Joined: Thu Aug 06, 2009 4:50 am

NVAPI with stereo

Post by vendetta122 »

Thanks for your answers. It makes things clear now. I've corrected the link.
The NVIDIA NVAPI web site has been updated. Make sure the last update is 05 / 21 / 2009 not 09 / 17 / 2008. There is a new NVAPI from may 2009 which contains stereo functions.
For example the "NvAPI_Stereo_ReverseStereoBlitControl" is now available in the public version of the api.

New NVAPI from May 2009

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

Re: Nvidia StereoAPI problem

Post by superlxt »

Have anyone tried the codes in the pdf of gdc09 on page 38-40?
It doesn't tell me the details of how to "StretchRect the video surface into the back buffer",and I did like this way but program failed. :(

RECT backBufferRect = {0, 0, gImageWidth, gImageHeight};
RECT imageSrcRect = {0, 0, gImageWidth*2, gImageHeight+1};
g_pd3dDevice->StretchRect(gImageSrc, &imageSrcRect, gBackBuf, &backBufferRect, D3DTEXF_LINEAR);
g_pd3dDevice->Present( NULL, NULL, NULL, NULL );

Can anyone give me some hint?Many thanks!
shuitu
One Eyed Hopeful
Posts: 1
Joined: Fri Dec 18, 2009 7:20 am

Re: Nvidia StereoAPI problem

Post by shuitu »

I've try that the codes in the pdf of gdc09 on page 38-40,but failed too.
I've wonder after the vedio surface has been Stretch into Backbuffer ,the NVSTEREO_IMAGE_SIGNATURE has been changed .so the driver
cann't recognise the Stereo Tag.But even though I make the BackBuffer size equal to the Vedio Surface,it failed too.
I just want to develop a "NVIDIA 3D Vision Photo Viewer" like program.who can help me?
TO Tril:now that you know There's a public version and a NDA customers version, do you have a copy of NDA customers version. we can see that NVSTEREOIMAGEHEADER struct was not in the last update (05 2009)of NVAPI.
I suspect that the NDA version has something corresponding to Stereo Tag which not included in the public version.
prama
One Eyed Hopeful
Posts: 5
Joined: Thu Feb 04, 2010 5:41 pm

Re: Nvidia StereoAPI problem

Post by prama »

Hi Shuito,

I am also trying to enable the drivers. The stereo tag does not seem to do the trick. Did you get a solution to your problem? If so, could you enlighten me a bit please:)

Thanks
GALOP1N
One Eyed Hopeful
Posts: 3
Joined: Sun Mar 07, 2010 10:55 am
Location: France

Re: Nvidia StereoAPI problem

Post by GALOP1N »

Hi,

You should set direct3D to debug, from the dx control panel of the SDK. With break on error and maximum validation, it should stop you on the error.

Also, I implement the stretchrect trick today without problem.

My merged surface use to StretchRect in the backbuffer is a rendertarget of resolution [ w*2; h+1 ]. I blit left and right eye separatly on it. And finaly, i blit a small quad of one pixel height with the stereo ugly header in a texture. This let me remove the crappy Lock that can crush performance.

And you only need the NvApi library if you want to detect if the stereo mode is on or off while in game (since it's plug on a keyboard shortcut)

Enjoy :)
prama
One Eyed Hopeful
Posts: 5
Joined: Thu Feb 04, 2010 5:41 pm

Re: Nvidia StereoAPI problem

Post by prama »

So if I understand correctly, you take 3 direct3ddevices and blit the left and right onto one? I am not sure I understand correctly. Could you please kindly expand and explain further.
Do you apply the NVSTEREOIMAGEHEADER header to i. It works? as in enables the glasses for a 3d vision kit?
And what do you mean by the keyboard shortcut for nvapi to enable the mode?

Thanks
GALOP1N
One Eyed Hopeful
Posts: 3
Joined: Sun Mar 07, 2010 10:55 am
Location: France

Re: Nvidia StereoAPI problem

Post by GALOP1N »

I explain with code snippet.

I create two render target, one to draw each eye, one after another and the other will receive the merged result.

Code: Select all

pd3dDevice->CreateRenderTarget(width,height,D3DFMT_A8R8G8B8,D3DMULTISAMPLE_NONE ,0,false,&gFrameBuffer,NULL);
pd3dDevice->CreateRenderTarget(width*2,height+1,D3DFMT_A8R8G8B8,D3DMULTISAMPLE_NONE ,0,true,&gPackedStereo,NULL);
I also create a texture that contains the custom nvidia trick stretchrect configuration

Code: Select all

IDirect3DTexture9* gBlitConfigSM;
	
pd3dDevice->CreateTexture( sizeof(_Nv_Stereo_Image_Header) / 4, 1, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM,&gBlitConfigSM,NULL);
pd3dDevice->CreateTexture( sizeof(_Nv_Stereo_Image_Header) / 4, 1, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT,&gBlitConfig,NULL);

D3DLOCKED_RECT lRect;
gBlitConfigSM->LockRect(0,&lRect,NULL,0);

_Nv_Stereo_Image_Header hd;

_Nv_Stereo_Image_Header* pSIH = &hd;

// Update the signature header values
pSIH->dwSignature= NVSTEREO_IMAGE_SIGNATURE;
pSIH->dwBPP= 32;
pSIH->dwFlags= SIH_SWAP_EYES; // Srcimage has left on left and right on right
pSIH->dwWidth= width*2;
pSIH->dwHeight= height;

memcpy(lRect.pBits, &hd, sizeof(_Nv_Stereo_Image_Header));
	
gBlitConfigSM->UnlockRect(0);

pd3dDevice->UpdateTexture(gBlitConfigSM, gBlitConfig);
gBlitConfigSM->Release();
Now, after each eye draw, i blit it at the right position in the packed surface

Code: Select all

// left
RECT srcLRect= { 0, 0,  width, height};
RECT dstRect= { 0, 0, width, height};
pd3dDevice->StretchRect(gFrameBuffer, &srcLRect, gPackedStereo, &dstRect, D3DTEXF_LINEAR);

//right
RECT srcRRect= { 0, 0,  width, height};
RECT dstRRect= { width, 0, width*2, height};
pd3dDevice->StretchRect(gFrameBuffer, &srcRRect, gPackedStereo, &dstRRect, D3DTEXF_LINEAR);
And just before the Present

Code: Select all

// copy the header in the last row
IDirect3DSurface9* pConfig; gBlitConfig->GetSurfaceLevel(0,&pConfig);

RECT srcRRect= { 0, 0,  sizeof(_Nv_Stereo_Image_Header)/4, 1};
RECT dstRRect= { 0, height, sizeof(_Nv_Stereo_Image_Header)/4, height+1};
pd3dDevice->StretchRect(pConfig, &srcRRect, gPackedStereo, &dstRRect, D3DTEXF_POINT);

pConfig->Release();
	
// Final blit
IDirect3DSurface9* lBack;
pd3dDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&lBack);

RECT srcRect= { 0, 0, width* 2, height+1};
RECT dstRect= { 0, 0, width, height};
pd3dDevice->StretchRect(gPackedStereo, &srcRect, lBack, &dstRect, D3DTEXF_LINEAR);
lBack->Release();
What you have to know! NVIDIA driver still duplicate draws if surface have a resolution >= to the backbuffer, i trick it with an height-2 for the frame buffer. Also, if the user press ctrl+T, this disable the 3D Vision mode and the last stretchrect will be a common one, so you'll see the two eyes like a split screen :)

voilà ^^
prama
One Eyed Hopeful
Posts: 5
Joined: Thu Feb 04, 2010 5:41 pm

Re: Nvidia StereoAPI problem

Post by prama »

Thank you so much!!:) I understand better now.
Will try this out and let you know how it goes.
JasonMiller
One Eyed Hopeful
Posts: 7
Joined: Thu Dec 10, 2009 9:07 am

Re: Nvidia StereoAPI problem

Post by JasonMiller »

This looks very nice GAOLOP1N.

I put my first tries with the Nvidia system online in this thread here:
http://www.mtbs3d.com/phpBB/viewtopic.php?f=7&t=5072" onclick="window.open(this.href);return false;

Now I'm running in the problem that the data is duplicated in my left and right view.
It seems like you found a way around that too! How does your implementation hold up on performance? As mine pulls fps down to something like 30-40fps.

Would love to see more of your tries.
Cheers!

Jason
GALOP1N
One Eyed Hopeful
Posts: 3
Joined: Sun Mar 07, 2010 10:55 am
Location: France

Re: Nvidia StereoAPI problem

Post by GALOP1N »

Your question about performance is meaningless. It depends on too much unknowns parameters. First, the computer power, cpu, gpu, memory. Second is what you draw, which resolution, scene complexity.

Then it depends widely of your implementation and the additional work you have to do to render the second eye.

Otherwise, i can tell you that doing things yourself is a win. For example, it allow me to reduce the horizontal resolution in stereo mode on some part of the frame to save fill rate and pixel processing. Resolution doesn't matter so much in stereo :)

Also, you won't see anything of my tries because i do this for a professional video game, so i am under NDA ^^
rahuxx
One Eyed Hopeful
Posts: 21
Joined: Fri Jun 20, 2008 9:09 am

Re: Nvidia StereoAPI problem

Post by rahuxx »

Hi there

with hope that you may solve my problem i would like to ask you about using nvapi to invert nvidia 3d vision settings for game play.
Actually to play game in 3d i have to were my glasses upside down and i want to solve this problem using nvapi 3d vision reverse stereo function

hope i wiil get some help from you because i am 0 in programing.

thanks
rahu
akira32
One Eyed Hopeful
Posts: 6
Joined: Sat Jul 17, 2010 10:59 pm

Re: Nvidia StereoAPI problem

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
crim3
Certif-Eyed!
Posts: 642
Joined: Sat Sep 22, 2007 3:11 am
Location: Valencia (Spain)

Re: Nvidia StereoAPI problem

Post by crim3 »

To me it seems like you have to add a lib file in the input field at the linking options inside project options. What I don't know is which file. DXUT.lib perhaps?
Zalman Trimon ZM-M220W / Acer H5360 with Another Eye2000 shutters / nVIDIA GTX760
akira32
One Eyed Hopeful
Posts: 6
Joined: Sat Jul 17, 2010 10:59 pm

Re: Nvidia StereoAPI problem

Post by akira32 »

I had checked the lib and incude directory settting. I do not change them. They are set correctly. Does anyone run successfully?
I use the DirectX SDK 2005 June by according to the executable file in bin directory.
akira32
One Eyed Hopeful
Posts: 6
Joined: Sat Jul 17, 2010 10:59 pm

Re: Nvidia StereoAPI problem

Post by akira32 »

I adjust the lib include directory. But it appears the error message as below:
Does anyone ever compile correctly?
My DirectX is 2005 June.

Error 1 fatal error LNK1181: cannot open input file 'DXUT.lib' StereoAPI
crim3
Certif-Eyed!
Posts: 642
Joined: Sat Sep 22, 2007 3:11 am
Location: Valencia (Spain)

Re: Nvidia StereoAPI problem

Post by crim3 »

Yes, the directories must be configured. But I was referering to the "Additional dependecies" field (that's the name then). There you can type any library used in your project. Take a look here:
http://stackoverflow.com/questions/1114 ... -c-project" onclick="window.open(this.href);return false;
Zalman Trimon ZM-M220W / Acer H5360 with Another Eye2000 shutters / nVIDIA GTX760
akira32
One Eyed Hopeful
Posts: 6
Joined: Sat Jul 17, 2010 10:59 pm

Re: Nvidia StereoAPI problem

Post by akira32 »

Crim3,Do you compile without any error? I think the DXUT.lib has some problem.
crim3
Certif-Eyed!
Posts: 642
Joined: Sat Sep 22, 2007 3:11 am
Location: Valencia (Spain)

Re: Nvidia StereoAPI problem

Post by crim3 »

I'm not developing anything with that library. It's just that your linking problems seem the typical when the necessary library are missed in the project properties, just where I told you (additional dependencies).

As none was helping you I thought I could tell you to try that.

I've also found this:
http://www.gamedev.net/community/forums ... _id=394442" onclick="window.open(this.href);return false;
Zalman Trimon ZM-M220W / Acer H5360 with Another Eye2000 shutters / nVIDIA GTX760
a486257rtrtrcom
One Eyed Hopeful
Posts: 1
Joined: Mon May 07, 2012 1:55 pm

Re: Nvidia StereoAPI problem

Post by a486257rtrtrcom »

I have managed to display video in stereoscopic using this method. On the newer nvidia display drivers (280+ it seems) it fails to pick up the NV3D image header [?] unless I recreate the render texture (width*2,height+1) a few times and then it will merge the left/right images. I was wondering if there was perhaps an other step that was added or needed? I don't get the difference as creating the render target returns s_OK.


>>> code that recreates the render texture
// release the render texture
SAFE_RELEASE(g_dbBackBuf);

// create the render texture
if(SUCCEEDED(g_pd3dDevice->CreateRenderTarget(rect.right*2,rect.bottom+1,D3DFMT_X8R8G8B8,D3DMULTISAMPLE_NONE,0,true,&g_dbBackBuf,NULL)))
{
DebugLog("Succeeded");
}
<<<
Post Reply

Return to “Nvidia Legacy Drivers”