dwmkerr / sharpgl

Use OpenGL in .NET applications. SharpGL wraps all modern OpenGL features and offers a powerful scene graph to aid development.
MIT License
770 stars 300 forks source link

How can I use it to play a video in stereo 3d format? #92

Open RYG81 opened 9 years ago

RYG81 commented 9 years ago

Hi I want to play a stereoscopic 3d video with quad buffers, is it possible? Please suggest the way if possible.

Rahul

robinsedlaczek commented 9 years ago

Thanks for your question. Yes, there is a way. You have to render two images. One for each eye with different camera positions reflecting eye position and view. Please see this article for some details: http://www.gali-3d.com/archive/articles/StereoOpenGL/StereoscopicOpenGLTutorial.php

Does this help a bit?

If not, please come back to us and we'll give further assistance!

Von meinem Windows Phone gesendet


Von: RYG81mailto:notifications@github.com Gesendet: ‎07.‎02.‎2015 12:20 An: dwmkerr/sharpglmailto:sharpgl@noreply.github.com Betreff: [sharpgl] How can I use it to play a video in stereo 3d format? (#92)

Hi I want to play a stereoscopic 3d video with quad buffers, is it possible? Please suggest the way if possible.

Rahul


Reply to this email directly or view it on GitHub: https://github.com/dwmkerr/sharpgl/issues/92

RYG81 commented 9 years ago

I have seen that, but just want to know how to do that with SharpGL and if it is possible to to with SharpGL or not.

RYG81 commented 9 years ago

Also the samples given there are not for true OpenGL and are for interlaced 3D. May be because true stereoscopic 3D samples were licensed to RealD So the question remains how to do that in SharpGL with c#?

Rahul

robinsedlaczek commented 9 years ago

Ok, please give me some time to evaluate it. Answer comes tomorrow since i am on holiday today.

Von meinem Windows Phone gesendet


Von: RYG81mailto:notifications@github.com Gesendet: ‎07.‎02.‎2015 13:45 An: dwmkerr/sharpglmailto:sharpgl@noreply.github.com Cc: Robin Sedlaczekmailto:robin.sedlaczek@live.de Betreff: Re: [sharpgl] How can I use it to play a video in stereo 3d format? (#92)

Also the samples given there are not for true OpenGL and are for interlaced 3D. May be because true stereoscopic 3D samples were licensed to RealD So the question remains how to do that in SharpGL with c#?

Rahul


Reply to this email directly or view it on GitHub: https://github.com/dwmkerr/sharpgl/issues/92#issuecomment-73362899

RYG81 commented 9 years ago

No Issue.

Enjoy the holiday. Thanks for helping out in advance.

Rahul

RYG81 commented 9 years ago

Hi robinsedlaczek , If you get time today, please look in to this as it will be great help to me for starting working on SharpGL.

Rahul

robinsedlaczek commented 9 years ago

Hey Rahul! I started evaluating your question. Before I say something wrong, I need some more time to evaluate this. Can't give you a simple tutorial today. Sorry for that. So I'll come back to you tomorrow! Kind regards!Robin

Date: Mon, 9 Feb 2015 03:56:31 -0800 From: notifications@github.com To: sharpgl@noreply.github.com CC: robin.sedlaczek@live.de Subject: Re: [sharpgl] How can I use it to play a video in stereo 3d format? (#92)

Hi robinsedlaczek ,

If you get time today, please look in to this as it will be great help to me for starting working on SharpGL.

Rahul

— Reply to this email directly or view it on GitHub.

RYG81 commented 9 years ago

Thank you very much for starting it out, Robin. I wish you achieve it and make it very simple for me to understand.

Rahul

RYG81 commented 9 years ago

Hello Robin,Sorry for asking again and again. Any Update? I really need to know this, so please help!

robinsedlaczek commented 9 years ago

Hi!

No prob. I am still on it. Maybe today, latest tomorrow!

Robin

Von meinem Windows Phone gesendet


Von: RYG81mailto:notifications@github.com Gesendet: ‎12.‎02.‎2015 07:24 An: dwmkerr/sharpglmailto:sharpgl@noreply.github.com Cc: Robin Sedlaczekmailto:robin.sedlaczek@live.de Betreff: Re: [sharpgl] How can I use it to play a video in stereo 3d format? (#92)

Hello Robin,Sorry for asking again and again. Any Update? I really need to know this, so please help!


Reply to this email directly or view it on GitHub: https://github.com/dwmkerr/sharpgl/issues/92#issuecomment-74023723

dwmkerr commented 9 years ago

Hi @RYG81 and @robinsedlaczek,

Just dropping into this discussion to see if I can help.

You can do stereoscopic rendering with SharpGL no problems, remember because it can be done in OpenGL that means it can be done in SharpGL. SharpGL supports quad buffers (front/back left/right), render buffers and pixel buffers. All of these together allow you to create multiple views of a scene and render like that.

However, to answer your question with more detail, I need more information:

  1. You want to play 3D video - what format?
  2. Are you expecting to play using special hardware, if so, what?
  3. If not, are you using red/green stereoscopic rendering?
RYG81 commented 9 years ago

Thanks for clearing things Sir, Here are the answers to your questions. It would be great help if you can provide some guidance on this. However I do expect that Robin may have something for me today. You want to play 3D video - at present MP4 and Mkv if possible Are you expecting to play using special hardware, yes- a Quadro graphic card and DLP linked 3D projector If not, are you using red/green stereoscopic rendering? - NOT at all. Interested in True Stereoscopic 3D only.

Thanks Rahul

robinsedlaczek commented 9 years ago

There ist the open source tool Bino (http://bino3d.org/index.html). I think they do exactly what you want to do. I try to figure out how they do it. Maybe you can look into their code, too!

Von meinem Windows Phone gesendet


Von: RYG81mailto:notifications@github.com Gesendet: ‎13.‎02.‎2015 07:17 An: dwmkerr/sharpglmailto:sharpgl@noreply.github.com Cc: Robin Sedlaczekmailto:robin.sedlaczek@live.de Betreff: Re: [sharpgl] How can I use it to play a video in stereo 3d format? (#92)

Thanks for clearing things Sir, Here are the answers to your questions. It would be great help if you can provide some guidance on this. However I do expect that Robin may have something for me today. You want to play 3D video - at present MP4 and Mkv if possible Are you expecting to play using special hardware, yes- a Quadro graphic card and DLP linked 3D projector If not, are you using red/green stereoscopic rendering? - NOT at all. Interested in True Stereoscopic 3D only.

Thanks Rahul


Reply to this email directly or view it on GitHub: https://github.com/dwmkerr/sharpgl/issues/92#issuecomment-74210219

RYG81 commented 9 years ago

The problem with Bino is it is in c++ I think and also it has many features which I do not need. It is also very slow and jerky in playback I think ( I have used it foe more then year, so can give this input). This is why I am here searching a way to make my own player to play my videos. Rahul

robinsedlaczek commented 9 years ago

Yes, it is really slow. But since it is open source we can look how they do it with OpenGL. Then, because SharpGL provides an 1-to-1 wrapper for OpenGL, it should be easy to adapt.

Von meinem Windows Phone gesendet


Von: RYG81mailto:notifications@github.com Gesendet: ‎13.‎02.‎2015 07:52 An: dwmkerr/sharpglmailto:sharpgl@noreply.github.com Cc: Robin Sedlaczekmailto:robin.sedlaczek@live.de Betreff: Re: [sharpgl] How can I use it to play a video in stereo 3d format? (#92)

The problem with Bino is it is in c++ I think and also it has many features which I do not need. It is also very slow and jerky in playback I think ( I have used it foe more then year, so can give this input). This is why I am here searching a way to make my own player to play my videos. Rahul


Reply to this email directly or view it on GitHub: https://github.com/dwmkerr/sharpgl/issues/92#issuecomment-74212708

RYG81 commented 9 years ago

Do you know which specific file I should check for getting idea on this? Rahul

dwmkerr commented 9 years ago

Search for:

GL_FRONT_LEFT

Basically you need to do the following:

  1. Render the left stream frame to GL_FRONT_LEFT
  2. Render the right stream frame to GL_FRONT_RIGHT
  3. Swap buffers

Bingo, your NVidia card knows how to handle the rest.

See: http://3dvision-blog.com/tag/quad-buffer-opengl-stereo/

SharpGL will let you activate and manipulate the framebuffers, but you'll have to work out how to decode the video format and render the actual pixels.

RYG81 commented 9 years ago

OK. Thanks for this much of help. I am still not clear on my path as I am not a hard coder. But still good enough to fins my way ahead. I think I am on right place by finding SharpGL. Thanks Rahul

dwmkerr commented 9 years ago

No problems, I suggest you attack the problem the following way:

  1. Create a basic WPF/WinForms application which allows the user to select a video file and press play/stop/pause.
  2. Use an OpenGL control to render the video (2D only). This will be the stage where you have to work out how to decode the video stream and render it as pixels.
  3. Once you've done this, extend it to decode the second stream and render to the right buffer.
  4. Double check config for the graphics card to make sure it's rendering the left and right buffers correctly and you are done
RYG81 commented 9 years ago

Hi I tried to as mentioned above but not able to go ahead from 1st step only. I made a WPF project and used media player component to play video with controls, but I do not understand how I can use SharpGL to get video rendered in buffers? My videos are in Top-Bottom squeeze/half resolution format. How I load them in buffers and then use swap buffer? Sorry for this but I am very noob in openGL programing. Rahul

robinsedlaczek commented 9 years ago

Hi Rahul!

This is a bit out of our scope.

As Dave said, get the streams from your file, draw them to the appropriate buffers and then swap them.

I think the media Player control won't help here.

Kind regards!

Robin

Von meinem Windows Phone gesendet


Von: RYG81mailto:notifications@github.com Gesendet: ‎14.‎02.‎2015 12:34 An: dwmkerr/sharpglmailto:sharpgl@noreply.github.com Cc: Robin Sedlaczekmailto:robin.sedlaczek@live.de Betreff: Re: [sharpgl] How can I use it to play a video in stereo 3d format? (#92)

Hi I tried to as mentioned above but not able to go ahead from 1st step only. I made a WPF project and used media player component to play video with controls, but I do not understand how I can use SharpGL to get video rendered in buffers? My videos are in Top-Bottom squeeze/half resolution format. How I load them in buffers and then use swap buffer? Sorry for this but I am very noob in openGL programing. Rahul


Reply to this email directly or view it on GitHub: https://github.com/dwmkerr/sharpgl/issues/92#issuecomment-74371710

dwmkerr commented 9 years ago

@RYG81 as @robinsedlaczek mentioned as developers of SharpGL we can certainly help with SharpGL related issues, but if you are looking for general advice on playing media with OpenGL somewhere like StackOverflow may be a better resource. Most issues on this site will be related directly to SharpGL, your issue is actually not related to SharpGL (yet), you need to first get the video rendered using OpenGL. If you find that there are problems with the OpenGL APIs exposed via SharpGL, such as they are not working as per documentation, then we can certainly help with that.