Rendering multiple solids with only one Actor, yet retaining RGBA and Picking

Hi dear friends,

I’ve post an issue where I was facing bad overall framerate with a scene containing 500+ actors.

Thanks to many useful answers, I’ve changed my code to create each solid as a vtkPolydata, then merging them thanks to vtkAppendPolyData, and finally display them with a unique Actor.

Overral performance gain is spectacular, but obviously I’m losing several thing :

  • Per solid RGBA color.
  • Per solid picking.

The picking problem is quite simple to solve by using a vtkCellPicker associated with a lookup table between vtkPolydata’s cells and original solids.

The RGBA problem should have been easy to solve too, but I’m facing an issue :
To assign a different color to each of the vtkPolydata’s cells, I’m using

double argb[4] = { R, G, B, A }; //where R...A are in [0..255]
vtkNew<vtkUnsignedCharArray> vtkcolors;
for (int i=0; i<poly->GetNumberOfCells(); i++) vtkcolors->InsertTuple(i, argb);

In my scene I have opaque solids and transparent ones.
Displayed colors are OK, except that the whole Actor becomes transparent as soon as there is at least one transparent solid in the batch.
I would have expected cell’s transparency being OK according to scalar map …

My question :

  • Is it a normal behavior (i.e. an Actor is totally transparent or not)
  • Will have I to separate my solids into as many actors as I have Alpha value ?

Thanks !

Ok, my bad.
By using a vtkMultiBlockDataSet + vtkCompositePolyDataMapper, transparency issue has gone.