The issue can be illustrated with the VTK example HighlightSelection and the standard sample data file called cow.vtp (let me know if you would like me to attach copies here). As an alternative to the cow, you can use any test case that has a concave region. In the example below, we will use a region behind the cow’s left front hoof.
Reminder: Press ‘r’ to do a rectangle selection. Then press ‘r’ again so you can rotate the view, etc.
I made the following two changes, which are just changes in settings:
After the line this->SelectedActor->GetProperty()->SetPointSize(5);
I added this->SelectedActor->GetProperty()->SetLineWidth(5);
After the line renderWindow->Render();
I added renderer->GetActiveCamera()->ParallelProjectionOn();
(Of course this requires #include <vtkCamera.h>)
Here are some sample images. I turned the cow upside-down, and we are looking at the back of the left front “foot” (important cow terminology: Hoof, Pastern, Dew Claw).
I have used green color to mark a highlighted edge, which is fine (but perhaps a little bit thin) in this screenshot:
As we rotate, the edge becomes thinner, as shown here:
If you rotate a bit more, the edge disappears.
My goal is to understand what changes are needed in
https://examples.vtk.org/site/Cxx/Picking/HighlightSelection/
in order to get the same results as in ParaView.
The main issue is that the highlighted edges become thin and disappear as you rotate the view.
The other goal we would like is that the highlighted edges remain at full brightness (not affected by lack of illumination) as we rotate the view.
Here is an example, viewing the cow using ParaView, showing that ParaView is successful for both goals (if you set the view to Surface With Edges (the blue edges in the image)):
In principle the answers are in the ParaView source code, but it is very complicated. The VTK examples are much easier to understand.
Regarding the two goals for HighlightSelection.cxx that I mentioned in the previous post,
- Selected edges should not get thin and disappear when rotating.
- We would like all the selected edges to have full brightness.
I have resolved the second issue. It was simply a matter of adding this line:
this->SelectedActor->GetProperty()->LightingOff();
after the other lines that contain this->SelectedActor->GetProperty()
The results are shown in this animation (we see that Problem number 1 is still there for the edge in the concave region):
I have found a solution, which can be demonstrated by making small changes in the VTK example HighlightSelection. Rather than post the details here, I have explained the major ideas in a related post at:
https://discourse.paraview.org/t/issues-with-line-width-depending-on-camera-view-for-parallel-projection/15852/4
I found a better solution. It is simply to use:
this->SelectedActor->GetProperty()->SetRepresentationToWireframe();
this->SelectedActor->GetProperty()->LightingOff();
this->SelectedActor->GetProperty()->SetRenderLinesAsTubes(true);
Here is a quote from the documentation for SetRenderLinesAsTubes(): “The width of the line in pixels is controlled by the LineWidth attribute. May not be supported on every platform and the implementation may be half tubes, or something only tube like in appearance.”