Display strange lines(dashed) when I zoom in

Hello,

I have met one strange problem, I have the rendererd image in display area, when I zoom in with mouse, it gradually display some strange lines, more zoomed-in(closer), more clearer the dashed lines. But I have not set anything for such strange lines. I don’t know where these lines came from.

I attached some screenshots in this thread, please somebody help me diagnose from these images.

If you need the implementation code, I can add some c++ codes later.

the first image - very far.

the second image - zoomed in a little bit. We can see some waves(or lines) now.

the third image - zoomed in again.

the fourth image - zoomed in more.

the fifth image - zoomed in to be very close.

I don’t know why this happens. Can you analyze possible reasons based on these different images?

Thanks a lot.

Can you share you data ?

Are you using Parallel Projection or Perspective View? If Parallel Projection, there is a lot of existing discussion and workarounds, etc.

How to share with you? Upload under this thread ?

vtk_write_multiblock.7z (1.1 MB) @mwestphal

Yes, we are using parallel projection.

This is what I searched on parallel projection view issue, seems similar with what I met now.

If you switch off parallel projection, what does it look like?

I used like this:

camera->SetParallelProjection(false)

Looks like those lines are disappeared.

screenshot:

But If I still want to use parallel on, how need I fix the issue?

Use the shader replacement code as the workaround ?

Thanks.

This effect seems strange to me, because there isn’t anything inherently different about the precision of parallel vs. perspective transformations. It makes me wonder if the problem is actually VTK’s interaction code rather than the shader code. Let me briefly explain:

When VTK implements perspective zoom by bringing the camera closer to the focal point, the geometry remains close to the “sweet spot” of the depth range, i.e. close to the camera.

But, if I’m not mistaken, the parallel projection zoom is implemented by simply narrowing the field of view in X and Y, but Z (i.e. the positions of the near and far clipping planes) is left unchanged. So when you zoom in really tight, the orthographic “box” for the projection becomes very long in the depth direction compared to the X, Y directions. This is not what we want. Ideally, when we zoom we want the near and far clipping planes to come closer together as the FOV becomes narrower. This should keep us from losing precision in the transformation to view coordinates.

There is a caveat, though: if we bring the near & far clipping planes closer to the focal point, then any geometry that isn’t close to the focal point (in the depth direction) will be clipped away.

I believe this is a known problem with data that does not supply surface normals. The normals are estimated in the shader and as you zoom in the normals estimated near the boundaries of polygons are off.

A workaround is to compute cell normals on your dataset. If they are available, then the shader will use them instead of coming up with a bad normal estimation.