Problem with volume

Hi everyone, I’ve met a strange problem with the volume when I started a new project with the newest version of vtk(27.4.4, tried 27.4.2 too), the situation is, when I ran my app in an old computer which had a graphic card of GTX1650, I found the frame drops to be very low and the volume got blured.

I notice this because on my other app which has a version of 25.11.0, the same component behaves as expected, to prove this, I downgrade the vtk.js in current app to 25.11.0, the frame recovers and the blur will not happen.

Is there any idea of this? The new version has more fixes and features so I prefer to use new, but if with this situation I’ll have to use the older one.

Thanks in advance.

Are you rendering the same volume? If so, look at the calculated sample distance. To really compare the two versions, set the same sample distance and maximumsamplesperray on both versions. I don’t think any of the new changes would introduce significant performance issues.

Hi Sankhesh,

I’m sure it is the same volume, as I mentioned, I did the test through downgrading the version in the same app from 27+ to 25.11.0, it’s not significant in the broswers on our new computers but the older ones with lower hardware configuration will behave obviously.

The project structure is very simple:

  • A vtkGenericRenderWindow at full screen size (resized to fix the window)
  • A vtkVolume to with a vtkVolumeMapper as mapper, with a vtkImageData read from itk-wasm for a series of dicom (about 255MB) as input data, maximumSamplesPerRay is set to 2500 and sampleDistance 0.25
  • A vtkColorTransferFunction and a vtkPiecewiseFunction to map the data to display bone

This would only happen after the ColorTransferFunction and PiecewiseFunction is applied, the newer version of vtk will cause a high gpu usage, on our GTX1650, v25.11.0 takes about 40% while rotating the volume or call a render(), and v27+ will take about 90% or more.

If you can not reproduce this I can provide a sandibox, but will need a computer with lower configuration to see the problem.


Hi @Xoz,

Do you have shading enabled? Is there a difference in performance without shading?
If you have the ability to test against different vtk-js versions, could you identify which version introduces the performance drop?


Hi @sankhesh,

The shading is not enabled(if you are referrig to the property-shade) for my test before.

On the pc for test, the frame keeps about 25 (shown in the vtkFPSMonitor) when shading is disabled and jumps from 15-45 when shading is enabled.

In my tests this starts from the version 26.1.2, before this (26.1.1 or older) the frame keeps at 50+ while shading is disabled.


Hi @sankhesh ,

Is there any idea of this? Besides, I found the volume got blured when I place another polyData actor inside the same window, and the polyData actor will also be without anti-aliased as one of my topic mentioned, see, is there any way to enable the fxaa to get the lines smooth, and avoid the blur on the volume when doing rotating?

Thank you. That is useful info. My guess is that the older machine has a graphics driver bug. The newer versions of vtk-js use texStorage to upload data to the GPU which is a relatively newer API. Which OS, browser, graphics card, graphics driver are you running this on? Do you see the same issues when you switch to a different setup?

Hi @sankhesh,

They were running on newest Chrome(113+) on Windows 10, graphic cards are GTX1650 and RTX3060, driver version is, date 8/7/2022, both setup have the same issue, the older(GTX1650) behaves much obviously, the frame on RTX3060 will drop from 50 to about 25 with the newer vtk.js.

I’ve made another CPR demo running with native webgl api with a shader which had a uniform sampler3D that used a texStorage3D on both setup, the 2d texture texStorage should be supported.

I just have these 2 setups running, my macbook pro is too old that the graphic card can not work with volume rendering smoothly, other setups are not tried yet.

For the volume rendering issue I turned the AutoAdjustSampleDistances on mapper to false, the blur will not show, but the lines are still shown with aliasing, is there anyway to turn it off? This will not happen when there is just the polyData without the volume.

I am not sure why antialiasing of polygonal geometry intermixed with volumes is broken. As for volume rendering, I am seeing the exact opposite in that with the new texStorage, I’ve been getting a good frame rate. I can try to create a code sandbox so we can iterate over it but am quite busy at the moment.

Hi @sankhesh,

I created a sandbox sandbox-vtk-antialiasing, if you have spare time, you can check this.

If you rotate to some certain angle, you will see the aliasing:

If you click the switch button to hide the volume, you will see the difference:


Thank you for the sandbox @Xoz. I’ll be able to look into the issue next week.