VTK Examples - Examples to demonstrate VTK background gradients

The the following gradient background modes are demonstrated:

  • Vertical
  • Horizontal
  • Radial Farthest Side
  • Radial Farthest Corner

in:

Note that the viewports are also bordered, I have added a function to do this in the code - it may be useful. In this case the borders delineate each viewport so that you can see more clearly the background shading.

for more information please see: New in VTK 9.3: Radial Gradient Background

Many thanks to @jaswantp and to @cory.quammen for a great addition to VTK!

1 Like

Wow. @amaclean that front view looks amazing. Nice touch with the borders!

Thanks, the tricky thing with the borders was to make sure common borders are drawn only once.

There are a few more tricky things around borders that I don’t see that are addressed in the example.

  1. If you set the point positions exactly at the boundary then they border lines may not show up at all. A workaround that we have found is to nudge the point coordinates a little bit towards the center of the view. However, if you move the points too much and the border as thing then there can be a gap between edge of the view and the border. We now use 0.0002 coordinate instead of of 0.0 and 0.9998 instead of 1.0, which seems to work well, but overall this approach for drawing borders feels a bit hacky.

  2. 2D actors and annotations may appear in front of the border. You need to pay attention to z order (e.g., tune coincident topology parameters), or actor order, or use renderer layers to make sure that content that is supposed to appear inside/below the border does not appear above it.

@lassoan Thanks for the comments, much appreciated.

1 Like