Hi,
I’m using a vtkLookupTable to make some label semi-transparent in a vtkpolydata, with label data in a point data array. But the the transparency is not rendered correctly when camera turned to certain angle.
I uploaded a video to show the issue: vtk-js_label_transparency_issue.mov - Google Drive
In the video, when the camera is above the model, the label supposed to be transparent is only darkened but not transparent. When the camera moves below the model, it start to render the transparency correctly.
Here’s my code generating the lookup table. Where labelRGBA
is a map from labels to RGBA arrays.
function CreateLabelLUT(labelRGBA) {
const numberOfColors = labelRGBA.size;
const tableBuffer = new Uint8Array(4 * numberOfColors);
const range = GetLabelRange(labelRGBA);
const lut = vtkLookupTable.newInstance();
lut.setIndexedLookup(true);
lut.setRange(range[0], range[1]);
lut.setNumberOfColors(numberOfColors);
// make sure label number is mapped to the table
for (let i = 0; i < numberOfColors; i++) {
lut.setAnnotation(i, i);
}
let offset = 0;
for (const [key, value] of labelRGBA) {
for (let i = 0; i < 4; i++)
tableBuffer[offset++] = value[i] * 255;
}
const table = vtkDataArray.newInstance({
numberOfComponents: 4,
size: 4 * numberOfColors,
dataType: 'Uint8Array',
name: "LabelLUT",
values: tableBuffer,
});
lut.setTable(table);
return lut;
}
Is it a bug? Or is there anything I could change in the LUT configuration?