MantisBT - VTK
View Issue Details
0013549VTK(No Category)public2012-10-23 12:042015-08-18 09:30
Jose M. 
T.J. Corona 
normalminorhave not tried
closedwon't fix 
5.8.0 
 
TBD
incorrect functionality
0013549: vtkSmartVolumeMapper does not change color function in GPU mode
This issue is for VTK 5.10.0

Changing the vtkColorTransferFunction of a vtkSmartVolumeMapper object will have no effect after the first render, if render mode is GPU-based (which is the default)

I have attached a case test, where one vtkSmartVolumeMapper and two diferent color transfer functions are defined. There are 4 lines of code of interest, marked as TESTLINE1 .. TESTLINE4

  // Render composite. In default mode. For coverage.
  //TESTLINE1
  renWin->Render();
 
  //Change color function to green
  //TESTLINE2
  volumeProperty->SetColor(color2);

  //Change render to software mode
  //TESTLINE3
  volumeMapper->SetRequestedRenderModeToRayCast();
  renWin->Render();

  //Change render to default (GPU) mode
  //TESTLINE4
  volumeMapper->SetRequestedRenderModeToDefault();
  renWin->Render();


This example define a color transfer function in red values. The TESTLINE2 changes it to another color in green values. The expected result should be to see a sphere with green color, but the original red color is used.

Disabling TESTLINE1, so initial GPU render is avoided, will produce the correct behavior.

Disabling TESTLINE4 (so CPU raycast is used) will also produce correct behavior, even if TESTLINE1 is enabled.

So it seems that GPU based renderer is not changing the color transfer function after the first call to render().
Doing a explicit call to volume->UpdateTransferFunctions(ren1) does not help to solve the problem.
No tags attached.
cxx SmartVolumeMapper.cxx (4,886) 2012-10-23 12:04
https://www.vtk.org/Bug/file/9305/SmartVolumeMapper.cxx
Issue History
2012-10-23 12:04Jose M.New Issue
2012-10-23 12:04Jose M.File Added: SmartVolumeMapper.cxx
2012-10-23 13:16Jose M.Note Added: 0029491
2015-08-18 09:30T.J. CoronaNote Added: 0035011
2015-08-18 09:30T.J. CoronaStatusbacklog => closed
2015-08-18 09:30T.J. CoronaAssigned To => T.J. Corona
2015-08-18 09:30T.J. CoronaResolutionopen => won't fix

Notes
(0029491)
Jose M.   
2012-10-23 13:16   
I have found a workaround to this problem, by removing the volume from the renderer and then adding it again. In the case test I attached previously,
you can do it by adding the lines

  ren1->RemoveViewProp(volume);
  ren1->AddViewProp(volume);

after the color exchange done in TESTLINE2
(0035011)
T.J. Corona   
2015-08-18 09:30   
If this is still an issue in VTK6, please consider reopening this ticket.