ryan
ryan

Reputation: 21

How can I show the 3D render with stereo?

I just learned how to create 3D images with PyVista, but I got a problem when I wanted to show the image with stereo rendering. Here's the error code: vtkRenderWindow.cxx:267 WARN| vtkWin32OpenGLRenderWindow (0000018518100300): Adjusting stereo mode on a window that does not support stereo type CrystalEyes is not possible.

And here's my code

import pyvista as pv
pl = pv.Plotter()
_ = pl.add_mesh(pv.Cube())
pl.enable_stereo_render()
pl.show()

Maybe it's just a basic model rendered in 3D, but I cannot find the solution.

Upvotes: 2

Views: 256

Answers (1)

What you are calling an error is actually a warning:

vtkRenderWindow.cxx:267 WARN| vtkWin32OpenGLRenderWindow (0000018518100300): Adjusting stereo mode on a window that does not support stereo type CrystalEyes is not possible.

Note the "WARN" at the start, and the orange (rather than red) colour in case your shell can render that. Unless you are seeing issues with stereo rendering you can ignore this warning.

To elaborate on this a bit, it's not clear to me why you see the warning (I don't see it on my linux system with current PyVista and VTK). In PyVista calling enable_stereo_render() calls

ren_win.StereoRenderOn()
ren_win.SetStereoTypeToAnaglyph()

on the render window attached to the Plotter. It could happen that enabling stereo mode before choosing anaglyph type raises that warning, but vtkRenderWindow's default stereo type seems to be red-blue. This line of code in VTK seems to have been there for the past 27 years, although it's possible that some subclass changes the default to something else. There's also this vtkusers mailing list email from 2013 that mentions this warning appearing when someone accidentally enables stereo render, so it's plausible that the default stereo type (sometimes) ends up being Crystal Eyes.

You should only worry if your render doesn't end up with anaglyph stereo as designed. Here's what it should look like:

screenshot of scene showing red-green tinting at the edges of the cube

Note the green-red tinting around the edges of the cube, most prominently closest to the camera.

I've opened a pull request to replace the order of the two method calls, so that by the time we switch on stereo render it's guaranteed to go for anaglyph type.

Upvotes: 3

Related Questions