VTK Stereo - Help Rendering Left & Right Eye Separately

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
This post was updated on .
Hi VTK-Users,

So currently I was able to render a stereoscopic 3D cube using VTK's default capabilities.
I was using Crystal Eyes and everything works fine. However, I am now in need of adding head tracking, and I have the eye positions in 3D space.

My question is, is it possible to render the left and right eyes separately instead of just using the default Crystal Eyes specification? Basically, I want to be able to set the left view's camera position, and right view's camera position based of the the eye positions.

Would really appreciate any help!

Regards,
Teek
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTk Stereo - Help Rendering Left & Right Eye Seperately

Sankhesh Jhaveri-2

Hi Teek,

You can use the vtkRenderWindow::SetStereoTypeToLeft() and vtkRenderWindow::SetStereoTypeToRight() API to tell VTK which eye you’re rendering.

Hope that helps.

Sankhesh


On Tue, Jun 6, 2017 at 11:17 AM Teek <[hidden email]> wrote:
Hi VTK-Users,

So currently I was able to render a stereoscopic 3D cube using VTK's default
capabilities.
I was using Crystal Eyes and everything works fine. However, I am now in
need of adding head tracking, and I have the eye positions in 3D space.

My question is, is it possible to render the left and right eyes separately
instead of just using the default Crystal Eyes specification? Basically, I
want to be able to set the left view's camera position, and right view's
camera position based of the the eye positions.

Would really appreciate any help!

Regards,
Teek



--
View this message in context: http://vtk.1045678.n5.nabble.com/VTk-Stereo-Help-Rendering-Left-Right-Eye-Seperately-tp5743559.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
--
Sankhesh Jhaveri
Sr. Research & Development Engineer | Kitware | (518) 881-4417

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
This post was updated on .
Thanks for the reply Sankhesh.

I read that earlier as well and I wasn't sure if I was implementing that correctly.
If I use those do I have the right understanding of the pipeline:

1. Create RenderWindow
2. Create Renderer
3. Add Renderer to RenderWindow
4. Enable StereoCapable Window and StereoRendering
(renderWindow->StereoCapableWindowOn(); renderWindow->StereoRenderOn();)
5. SetStereoTypeToLeft
6. Change Camera
7. Repeate 5 & 6 with Right

Am I missing anything there? As in do I have to update the Renderer or Window anytime inbetween and where would I add the cube?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
This post was updated on .
In reply to this post by Sankhesh Jhaveri-2
So this is the current flow I am following:

1.  I set up the Renderer and RenderWindow as normal. By this I mean create a Renderer and RenderWindow and add the Renderer to the RenderWindow.

2. I create the Cube right after this and add the Actor to the Renderer that was created earlier.

3. At this point I call the StereoCapableWindowOn() and StereoRenderingOn()

4-1. Now this is where I'm slightly confused. Do I call SetStereoTypeToLeft() and how do I manipulate the camera for just the left view? As in how do I get the reference to the camera that is currently being used for the left view?

4-2. I'm assuming whatever I do with the camera in 4-1 I can do for the right view here.

4-3. Do I have to change the StereoType again after doing both, because if I run it as in, I seem to only the the right view? As in I no longer get the both views showing on my screen.


If it helps I'm actually using the zSpace display to try and render this. That is also how I am getting the head tracking information.

Regards,
Teek

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTk Stereo - Help Rendering Left & Right Eye Seperately

mchinand
Would the OpenVR-related VTK classes be helpful in your situation?


On Tue, Jun 6, 2017 at 11:14 AM, Teek <[hidden email]> wrote:
So this is the current flow I am following:

1.  I set up the Renderer and RenderWindow as normal. By this I mean create
a Renderer and RenderWindow and add the Renderer to the RenderWindow.

2. I create the Cube right after this and add the Actor to the Renderer that
was created earlier.

3. At this point I call the StereoCapableWindowOn() and StereoRenderingOn()

*/4-1. Now this is where I'm slightly confused. Do I call
SetStereoTypeToLeft() and how do I manipulate the camera for just the left
view? As in how do I get the reference to the camera that is currently being
used for the left view?

4-2. I'm assuming whatever I do with the camera in 4-1 I can do for the
right view here.

4-3. Do I have to change the StereoType again after doing both, because if I
run it as in, I seem to only the the right view? As in I no longer get the
both views showing on my screen./*

If it helps I'm actually using the zSpace display to try and render this.
That is also how I am getting the head tracking information.

Regards,
Teek





--
View this message in context: http://vtk.1045678.n5.nabble.com/VTk-Stereo-Help-Rendering-Left-Right-Eye-Seperately-tp5743559p5743562.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
This post was updated on .
I don't think that would be necessary though would it?
I only say that because I already able to render the cube in 3D on my display.
I can also modify the camera position and focal point, however it modifies it for both eyes.

The only thing I would like to achieve is to be able to modify the camera separately for each eye.
Not sure if the OpenVR classes would really help facilitate that.

mchinand wrote
Would the OpenVR-related VTK classes be helpful in your situation?

https://blog.kitware.com/using-virtual-reality-devices-with-vtk
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTk Stereo - Help Rendering Left & Right Eye Seperately

Sankhesh Jhaveri-2

Perhaps, I misunderstood what you’re trying to do.

That API lets you render a whole scene (i.e. OpenGL context) with one eye. For rendering both, left and right, you’d have to have two different windows with the same scene - one for left and one for right.
The compositing will have to be dealt with, by the external system this way.

What is the display setup you use? CAVE, HMD, etc?

If you’re using off-axis projection, you could use vtkCamera::SetEyePosition (the center of the two eyes) and vtkCamera::SetEyeSeparation. However, these settings are only used for off-axis frustum calculation.



On Tue, Jun 6, 2017 at 12:32 PM Teek <[hidden email]> wrote:

I don't think that would be necessary though would it?
I only say that because I already able to render the cube in 3D on my
display.
I can also modify the camera position and focal point, however it modifies
it for both eyes.

The only thing I would like to achieve is to be able to modify the camera
separately for each eye.
Not sure if the OpenVR classes would really help facilitate that.


mchinand wrote
> Would the OpenVR-related VTK classes be helpful in your situation?
>
> https://blog.kitware.com/using-virtual-reality-devices-with-vtk





--
View this message in context: http://vtk.1045678.n5.nabble.com/VTk-Stereo-Help-Rendering-Left-Right-Eye-Seperately-tp5743559p5743564.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers



--
Sankhesh Jhaveri
Sr. Research & Development Engineer | Kitware | <a href="tel:(518)%20881-4417" value="+15188814417" target="_blank">(518) 881-4417

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTk Stereo - Help Rendering Left & Right Eye Seperately

Teek
Ahhh I should've been more clear. But I'm using zSpace as my display which handles the stereoscopic rendering fine if I use Crystal Eyes.

Would it be possible for me to have 2 renderers on top of each other in one window, and then use the front and back buffers for each renderer?

For my use, I can't actually use just the center of the two eyes. I would need to render each eye separately or set the camera for each eye.

zSpace has an example of rendering in OpenGL in which they render the scene twice using GL_FRONT_LEFT and GL_BACK_LEFT buffers, respective to each eye. I'm trying to recreate that with VTK because VTK implies volume rendering significantly.

Sankhesh Jhaveri-2 wrote
Perhaps, I misunderstood what you’re trying to do.

That API lets you render a whole scene (i.e. OpenGL context) with one eye.
For rendering both, left and right, you’d have to have two different
windows with the same scene - one for left and one for right.
The compositing will have to be dealt with, by the external system this way.

What is the display setup you use? CAVE, HMD, etc?

If you’re using off-axis projection, you could use vtkCamera::SetEyePosition
(the center of the two eyes) and vtkCamera::SetEyeSeparation. However,
these settings are only used for off-axis frustum calculation.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTk Stereo - Help Rendering Left & Right Eye Seperately

Aashish Chaudhary-2
If you are using zspace, then you can use Paraview VR plugin and a configuration that lets you open two windows (one for left eye and one for right). One of my colleague was able to run a setup like this in the past. However, then you are using ParaView inside zspace and not using zSpace SDK directly. 

- Aashish

On Tue, Jun 6, 2017 at 2:03 PM Teek <[hidden email]> wrote:
Ahhh I should've been more clear. But I'm using zSpace as my display which
handles the stereoscopic rendering fine if I use Crystal Eyes.

Would it be possible for me to have 2 renderers on top of each other in one
window, and then use the front and back buffers for each renderer?

For my use, I can't actually use just the center of the two eyes. I would
need to render each eye separately or set the camera for each eye.

zSpace has an example of rendering in OpenGL in which they render the scene
twice using GL_FRONT_LEFT and GL_BACK_LEFT buffers, respective to each eye.
I'm trying to recreate that with VTK because VTK implies volume rendering
significantly.


Sankhesh Jhaveri-2 wrote
> Perhaps, I misunderstood what you’re trying to do.
>
> That API lets you render a whole scene (i.e. OpenGL context) with one eye.
> For rendering both, left and right, you’d have to have two different
> windows with the same scene - one for left and one for right.
> The compositing will have to be dealt with, by the external system this
> way.
>
> What is the display setup you use? CAVE, HMD, etc?
>
> If you’re using off-axis projection, you could use
> vtkCamera::SetEyePosition
> (the center of the two eyes) and vtkCamera::SetEyeSeparation. However,
> these settings are only used for off-axis frustum calculation.





--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-Stereo-Help-Rendering-Left-Right-Eye-Separately-tp5743559p5743566.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTk Stereo - Help Rendering Left & Right Eye Seperately

Sankhesh Jhaveri-2

If zSpace creates the OpenGL context, you could also use the vtkRenderingExternal module (ExternalVTKWidget in particular) which allows one to use VTK in third party visualization architectures. For an example, take a look at the VruiVTK examples on GitHub that allow using VTK inside VRUI.


On Tue, Jun 6, 2017 at 2:12 PM Aashish Chaudhary <[hidden email]> wrote:
If you are using zspace, then you can use Paraview VR plugin and a configuration that lets you open two windows (one for left eye and one for right). One of my colleague was able to run a setup like this in the past. However, then you are using ParaView inside zspace and not using zSpace SDK directly. 

- Aashish

On Tue, Jun 6, 2017 at 2:03 PM Teek <[hidden email]> wrote:
Ahhh I should've been more clear. But I'm using zSpace as my display which
handles the stereoscopic rendering fine if I use Crystal Eyes.

Would it be possible for me to have 2 renderers on top of each other in one
window, and then use the front and back buffers for each renderer?

For my use, I can't actually use just the center of the two eyes. I would
need to render each eye separately or set the camera for each eye.

zSpace has an example of rendering in OpenGL in which they render the scene
twice using GL_FRONT_LEFT and GL_BACK_LEFT buffers, respective to each eye.
I'm trying to recreate that with VTK because VTK implies volume rendering
significantly.


Sankhesh Jhaveri-2 wrote
> Perhaps, I misunderstood what you’re trying to do.
>
> That API lets you render a whole scene (i.e. OpenGL context) with one eye.
> For rendering both, left and right, you’d have to have two different
> windows with the same scene - one for left and one for right.
> The compositing will have to be dealt with, by the external system this
> way.
>
> What is the display setup you use? CAVE, HMD, etc?
>
> If you’re using off-axis projection, you could use
> vtkCamera::SetEyePosition
> (the center of the two eyes) and vtkCamera::SetEyeSeparation. However,
> these settings are only used for off-axis frustum calculation.





--
View this message in context: http://vtk.1045678.n5.nabble.com/VTK-Stereo-Help-Rendering-Left-Right-Eye-Separately-tp5743559p5743566.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
--
Sankhesh Jhaveri
Sr. Research & Development Engineer | Kitware | (518) 881-4417

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
This post was updated on .
In reply to this post by Aashish Chaudhary-2
Unfortunately, one of my constraints is to use the zSpace SDK.
Now when you say "directly", would I still be able to use the zSpace SDK for getting tracker information if I were to go this route?
Aashish Chaudhary-2 wrote
If you are using zspace, then you can use Paraview VR plugin and a
configuration that lets you open two windows (one for left eye and one for
right). One of my colleague was able to run a setup like this in the past.
However, then you are using ParaView inside zspace and not using zSpace SDK
directly.

- Aashish
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
In reply to this post by Sankhesh Jhaveri-2
Currently I actually have VTK creating window, and then initializing zSpace after that.
I'm really using zSpace SDK only for the tracker information such as the pen coordinates and the eye coordinates.
I'm passing that information to VTK after transforming the coordinates for the VTK world space.

I could try going the other way if it's easier, however would prefer going VTK for the context because I want to incorporate Qt after and not sure if that would be as easy if I had zSpace creating the context.

Are there any other ways I could go about modifying each camera (per eye) independently for now?

Sankhesh Jhaveri-2 wrote
If zSpace creates the OpenGL context, you could also use the
vtkRenderingExternal module (ExternalVTKWidget in particular) which allows
one to use VTK in third party visualization architectures. For an example,
take a look at the VruiVTK examples <https://github.com/VruiVTK> on GitHub
that allow using VTK inside VRUI.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
This post was updated on .
In reply to this post by Teek
Looking through the OGL sample application again, possible other question: Would I be able to bind 2 VTK renderers, one to the GL_BACK_LEFT draw buffer, and one to the GL_BACK_RIGHT draw buffer? (Using Quad Buffered)

In the mean time building VTK with the External module.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

VTK - Users mailing list
You should be able to write a subclass of vtkWin32OpenGLRenderWindow
(or whatever **actual** vtkRenderWindow subclass gets instantiated for
your app) and then provide your own overrides of the methods
StereoUpdate, StereoMidpoint, and StereoRenderComplete.

In the StereoUpdate method, call the parent method first, and then
call camera->SetEyePosition to be at the left eye. In the
StereoMidpoint method, call the parent method first, and then call
camera->SetEyePosition to be at the right eye.

In the StereoRenderComplete method, call the parent method first, and
then call camera->SetEyePosition back to its pre-stereo rendering
values.

The trick with SetEyePosition calls is that they coordinates have to
be in **camera** space, not world space.


HTH,
David C.



On Thu, Jun 8, 2017 at 12:35 PM, Teek <[hidden email]> wrote:

> Looking through the OGL sample application again, possible other question:
> Would I be able to bind 2 VTK renderers, one to the GL_BACK_LEFT draw
> buffer, and one to the GL_BACK_RIGHT draw buffer?
>
> In the mean time building VTK with the External module.
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/VTK-Stereo-Help-Rendering-Left-Right-Eye-Separately-tp5743559p5743584.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
Going to try this way. I'm assuming that I'll have to iterate through a RendererCollection from the RenderWindow in order to get the ActiveCamera correct? Then for each Renderer set the camera->SetEyePosition.

VTK - Users mailing list wrote
You should be able to write a subclass of vtkWin32OpenGLRenderWindow
(or whatever **actual** vtkRenderWindow subclass gets instantiated for
your app) and then provide your own overrides of the methods
StereoUpdate, StereoMidpoint, and StereoRenderComplete.

In the StereoUpdate method, call the parent method first, and then
call camera->SetEyePosition to be at the left eye. In the
StereoMidpoint method, call the parent method first, and then call
camera->SetEyePosition to be at the right eye.

In the StereoRenderComplete method, call the parent method first, and
then call camera->SetEyePosition back to its pre-stereo rendering
values.

The trick with SetEyePosition calls is that they coordinates have to
be in **camera** space, not world space.


HTH,
David C.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
Just to clarify: renderWindow->GetRenderers(), Iterate through each and renderer->GetActiveCamera()->SetEyePosition(...)?

Teek wrote
Going to try this way. I'm assuming that I'll have to iterate through a RendererCollection from the RenderWindow in order to get the ActiveCamera correct? Then for each Renderer set the camera->SetEyePosition.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

VTK - Users mailing list
I guess so. I only have one 3D renderer in my case, so it's just one
camera in my case.

On Fri, Jun 9, 2017 at 4:15 PM, Teek <[hidden email]> wrote:

> Just to clarify: renderWindow->GetRenderers(), Iterate through each and
> renderer->GetActiveCamera()->SetEyePosition(...)?
>
>
> Teek wrote
>> Going to try this way. I'm assuming that I'll have to iterate through a
>> RendererCollection from the RenderWindow in order to get the ActiveCamera
>> correct? Then for each Renderer set the camera->SetEyePosition.
>
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/VTK-Stereo-Help-Rendering-Left-Right-Eye-Separately-tp5743559p5743613.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
In reply to this post by VTK - Users mailing list
Okay I'm not quite sure what you mean when you say the coordinates for camera space.
Would I be able to convert world coordinates to camera coordinates in any way?

I can't seem to find any reference to SetEyePosition in the archive of the mailing list either.
I've just been trying to set the camera position so I could see the cube source, however it seems that by default the camera locates itself at (0, 0, 0). Can't seem to figure out how to push it back to see the object using SetEyePosition.

Let me know if I misunderstood something.

Regards,
Teek

VTK - Users mailing list wrote
The trick with SetEyePosition calls is that they coordinates have to
be in **camera** space, not world space.


HTH,
David C.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

VTK - Users mailing list
Another thing to recognize is that VTK camera space and zSpace camera
space are aligned with each other, but possibly at different scales,
depending on the physical meaning of your VTK world coordinates. But
they share the same origin, and point in the same directions. So if
you have coords in zSpace camera coords, you can just scale them to
get corresponding VTK camera coordinates.

VTK camera space is at the same scale as VTK world coordinates, but
the origin of the camera space is at the camera itself, and the axes
are defined as: +x to the right, +y up, +z is the cross-product of
those two (+x cross +y).

The camera's position is expressed in VTK world coords, and
corresponds to the camera origin, so the position is the translation
between camera space and world space. The rotation is whatever it
takes to align the x, y, and z axes given the above definition, and
the camera's ViewUp and ViewNormal vectors (also expressed in world
coords).

There's a matrix in the camera class which does this transform
already. If I'm looking at and interpreting the source code correctly,
it's the ViewTransform, computed in this method:

https://github.com/Kitware/VTK/blob/635e45b/Rendering/Core/vtkCamera.cxx#L349

You could empirically check that by getting that transform (or its
inverse) and calling TransformPoint, and observing the results using
(0,0,0) and camera->GetPosition(), and/or TransformVector and the
ViewUp and ViewNormal vectors.


HTH,
David C.







On Tue, Jun 13, 2017 at 10:50 AM, Teek <[hidden email]> wrote:

> Okay I'm not quite sure what you mean when you say the coordinates for camera
> space.
> Would I be able to convert world coordinates to camera coordinates in any
> way?
>
> I can't seem to find any reference to SetEyePosition in the archive of the
> mailing list either.
> I've just been trying to set the camera position so I could see the cube
> source, however it seems that by default the camera locates itself at (0, 0,
> 0). Can't seem to figure out how to push it back to see the object using
> SetEyePosition.
>
> Let me know if I misunderstood something.
>
> Regards,
> Teek
>
>
> VTK - Users mailing list wrote
>> The trick with SetEyePosition calls is that they coordinates have to
>> be in **camera** space, not world space.
>>
>>
>> HTH,
>> David C.
>
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/VTK-Stereo-Help-Rendering-Left-Right-Eye-Separately-tp5743559p5743635.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: VTK Stereo - Help Rendering Left & Right Eye Separately

Teek
I actually just left out zSpace for now so I could understand how to use the SetEyePosition properly.
See Code

I essentially am just trying to create a cube in stereo and then use SetEyePosition to set the left and right camera views in stereo rendering. I'll probably incorporate zSpace once I can figure this out.
Thanks again for you help thus far.

So if the camera is also the origin in camera space, I'm confused as to how you can SetEyePosition (of the camera) using camera coords since it will always be the center. This also explains why if I create a camera and set the eye position, it seems to just be at the center of the cube.

Unless, you mean to say that the camera is originally at an arbitrary location which is defined as camera space. Then those coordinates are transformed into VTK world space coordinates.

--

I also tried:
camera->GetEyePosition(eyePosition);
cout << eyePosition[0] << ", " << eyePosition[1] << ", " << eyePosition[2] << endl;

renderer->SetActiveCamera(camera.GetPointer());
renderer->ResetCamera();

camera->GetEyePosition(eyePosition);
cout << eyePosition[0] << ", " << eyePosition[1] << ", " << eyePosition[2] << endl;


However it returns 0, 0, 0 for both even though the views are different before and after I reset the camera.

VTK - Users mailing list wrote
Another thing to recognize is that VTK camera space and zSpace camera
space are aligned with each other, but possibly at different scales,
depending on the physical meaning of your VTK world coordinates. But
they share the same origin, and point in the same directions. So if
you have coords in zSpace camera coords, you can just scale them to
get corresponding VTK camera coordinates.

VTK camera space is at the same scale as VTK world coordinates, but
the origin of the camera space is at the camera itself, and the axes
are defined as: +x to the right, +y up, +z is the cross-product of
those two (+x cross +y).

The camera's position is expressed in VTK world coords, and
corresponds to the camera origin, so the position is the translation
between camera space and world space. The rotation is whatever it
takes to align the x, y, and z axes given the above definition, and
the camera's ViewUp and ViewNormal vectors (also expressed in world
coords).

There's a matrix in the camera class which does this transform
already. If I'm looking at and interpreting the source code correctly,
it's the ViewTransform, computed in this method:

https://github.com/Kitware/VTK/blob/635e45b/Rendering/Core/vtkCamera.cxx#L349

You could empirically check that by getting that transform (or its
inverse) and calling TransformPoint, and observing the results using
(0,0,0) and camera->GetPosition(), and/or TransformVector and the
ViewUp and ViewNormal vectors.
12
Loading...