Invalid shadow shape affected by the aspect ratio of the window

I’ve compiled and executed the Shadow example(https://examples.vtk.org/site/Cxx/Rendering/Shadows/).

However, Shadows were correct only when the window aspect ratio is 1.
The window size can be adjusted at Shadows.cxx:58 renderWindow->SetSize(640, 480);.

I set the window size to 400x400 and got correct shadows.
400x400

However, to 1600x400, the shadows became elliptical and invalid black regions were created.

Both images are created from the same source code except for the window size settings (Shadows.cxx:58).

How can I avoid this problem?

See also #5057.

I’d love to see what can be done about this as well.

I found a workaround.

Just set the window size to square first, call vtkRenderWindow::Render(), and then resize vtkRenderWindow to the desired size.

It’s not clean, but it works.