Skip to content

Resolve "(viz): incorrect blending of transfer functions pieces"

Description

The blending of pieces has been modified to be weighted by the ratio between the opacity and the maximum opacity of a value. This gives the best result when mixing pieces and is conservative when only one piece is present.

Also, a trapeze piece is now always clamped, which is more consistent with the wanted behaviour.

During testing, it was also noticed that extra points added for clamping were a source of random inconsistencies. We finally chose to remove this merging step and now the transfer function is sampled directly from its pieces. This removes the needs of extra points when using clamping, which simplifies globally the problem.

Last, the upload of the transfer function was pretty slow. Instead of always uploading 32768 values (max size) in the 1D texture, we only upload the range of values in the window, plus extra points for boundaries. This really speeds up the upload. Here are for instance the results for the liver function plus 2 ramps and one trapeze:

Debug Release
Before 50ms 5ms
After 1.2ms 0,3ms

Closes #891 (closed)

How to test it?

  • Run SightViewer
  • Open an image
  • Play with the transfer function
Edited by Flavien BRIDAULT

Merge request reports