LookingGlassVTKModule icon indicating copy to clipboard operation
LookingGlassVTKModule copied to clipboard

Rendered Quilt looks broken on the Looking Glass Portrait

Open geforce25 opened this issue 4 years ago • 5 comments
trafficstars

I built this module successfully against VTK 9.0.1. I tried running the provided dragon example in C++ and the Python sample code presented here: https://blog.kitware.com/create-holographic-scenes-using-vtk-python/ but in both cases the rendered output on the Looking Glass Portrait display is not correct. I noticed that all the VTK examples showcased on the web are being run on older Looking Glass devices, so I presume the issue is that the code in this repo is not accounting for the display size or the calibration parameters of the new form factor correctly when it generates the quilt.

Video of the main C++ example from the HoloPlay SDK being rendered correctly

https://www.dropbox.com/s/9gow13fs8xcwy5c/holoplay_studio_sdk_example_v00.mov?dl=0

Video of the example TestDragon project rendered incorrectly on the Looking Glass Portrait

https://www.dropbox.com/s/97jw971skxll2b6/vtk_looking_glass_dragon_example_v00.mov?dl=0

Video of the sample Python code rendered incorrectly on the Looking Glass Portrait

https://www.dropbox.com/s/fpuo5t36cpklf8p/looking_glass_vtk_python_example_v00.mov?dl=0

geforce25 avatar Jun 06 '21 08:06 geforce25

Yes, I believe the LG folks said that with the newly released device we have to make some changes to our code. I'm not sure where we are in making those changes but I suspect they will be simple once we dig into it.

martinken avatar Jun 07 '21 13:06 martinken

With more experimentation I found that the included example called TestLookingGlassPass actually works correctly on the Looking Glass Portrait!

In other words, instantiating the render window with

vtkOpenGLRenderWindow* renderWindow =
	vtkLookingGlassInterface::CreateLookingGlassRenderWindow( 0 );

does not work.

However, setting up the rendering pipeline with multiple passes as follows works correctly

renderWindow->SetMultiSamples( 8 );

vtkNew< vtkRenderStepsPass > basicPasses;

vtkNew< vtkLookingGlassPass > lookingGlassPass;
lookingGlassPass->GetInterface()->Initialize();
lookingGlassPass->SetDelegatePass( basicPasses );

int width, height;
lookingGlassPass->GetInterface()->GetDisplaySize( width, height );

renderWindow->SetSize( width, height );
int x, y;
lookingGlassPass->GetInterface()->GetDisplayPosition( x, y );
renderWindow->SetPosition( x, y );
renderWindow->BordersOff();

vtkOpenGLRenderer* glrenderer = vtkOpenGLRenderer::SafeDownCast( renderer );
glrenderer->SetPass( lookingGlassPass );

I also verified that the multi-pass pipeline works correctly in Python.

To dig a little deeper, I implemented the same simple scene twice, once with the single-pass rendering approach and once with the multi-pass rendering approach. What I found is that the internal instance of vtkLookingGlassInterface is populated with the same exact data. Here are the relevant data members collected from the Visual Studio debugger

DeviceIndex	0	int
UseClippingLimits	false	bool
FarClippingLimit	1.2000000000000000	double
NearClippingLimit	0.80000000000000004	double
DisplayPosition	0x00000177f48e25b8 {3840, 104}	int[2]
DisplaySize	0x00000177f48e25c0 {1536, 2048}	int[2]
ViewAngle	40.000000000000000	double
QuiltSize	0x00000177f48e25d0 {4096, 4096}	int[2]
QuiltTiles	0x00000177f48e25d8 {5, 9}	int[2]
RenderSize	0x00000177f48e25e0 {819, 455}	int[2]
NumberOfTiles	45	int
QuiltQuality	1	int

The values (except for the addresses of course) are identical in both cases.

I then rendered the quilt itself in both cases and as you can see in this GIF comparison, they are slightly off from each other https://www.dropbox.com/s/twcwxaibfd0c3zw/test_looking_glass_portrait_reference_scene_quilt_comparison_v00.gif?dl=0 The differences are very minor, so I don't if know if they are sufficient to cause the type of broken image that I've been seeing.

So far the conclusion is that the problem is either is some slight differences in the rendering of the quilt, or the problem may be later in the pipeline where VTK actually draws the final light field that is displayed on the device.

Video of the sample project TestLookingGlassPass rendering correctly on the Looking Glass Portrait

https://www.dropbox.com/s/k4e7r3awb5w91ld/vtk_looking_glass_multi_pass_example_v00.mov?dl=0

Video of the reference scene rendered correctly with a multi-pass pipeline

https://www.dropbox.com/s/bh43ha4gghs7bh9/vtk_looking_glass_portrait_reference_scene_multi_pass_v00.mov?dl=0

Video of the reference scene rendered incorrectly with a single-pass pipeline

https://www.dropbox.com/s/n9y9ddm25b2i49s/vtk_looking_glass_portrait_reference_scene_single_pass_v00.mov?dl=0

geforce25 avatar Jun 08 '21 07:06 geforce25

renderWindow->SetMultiSamples( 8 );

I use this example too, but it does not work too. The function "vtkRegressionTestImageThreshold(renderWindow, 15)" always return vtkRegressionTester::NOT_RUN. And the screen of LG always shows empty.

guyuezuntinggithub avatar Aug 10 '21 03:08 guyuezuntinggithub

@geforce25 I had the same issue, can you check that #23 fixes it please?

LucasGandel avatar Aug 25 '21 17:08 LucasGandel

I believe this should be fixed now in master via #33.

psavery avatar Jul 12 '22 16:07 psavery