Hi, I have a series of cross-sectional images of a 3D object composed of two materials (green and purple) with a geometric shape etched on it.
I use “volume rendering” to render it, but when I rotate the object, it has many ripples and circles on the surface. I want a smooth & pure-colored surface. would you give me some suggestions? Thank you.!
Here’s a sample image: rendering|566x500
Maybe volume.GetMapper().SetUseJittering(True)
helps?
The ripples are caused by sharp transitions in opacity. In your sample image, it looks like you are using a synthetic image where the transition from transparent to opaque is a step function. You will get better results if you apply a mild blur to your synthetic volume.
Volume rendering uses a finite sample spacing, so in order to avoid those ripple artifacts, you must ensure that the highest spatial frequencies in the image are below the Nyquist frequency of the sampling.
Thanks, I’ll try it if I could use vtkGPUVolumeRayCastMapper.
Thank you for pointing out the root cause. Blurring helps, but not quite perfect.
If blurring helps, then you can further improve the result by supersampling the volume with a high-quality interpolator. This will, of course, be much more resource-intensive.
#include "vtkImageSincInterpolator.h"
#include "vtkImageResample.h"
auto interpolator = vtkSmartPointer<vtkImageSincInterpolator>::New();
interpolator->SetWindowFunctionToKaiser();
// optional: use the interpolator to apply a brick wall bandpass filter
interpolator->SetBlurFactors(2.0, 2.0, 2.0);
auto resample = vtkSmartPointer<vtkImageResample>::New();
resample->SetInputConnection(...);
resample->SetInterpolator(interpolator);
resample->SetMagnificationFactors(2.0, 2.0, 2.0);
resample->Update();
Another approach would be to generate meshes using some threshold to distinguish the two materials, and to render them with some transparency. Then you would probably have some smoother results …
Yes, they indeed reduce ripples, the downside is that they also make the image more blurry… and the ripples cannot be elimiated thoroughly, that’s why I said not quite perfect.
I’ve considered this way. The difficulty is, that there may be millions of geometries etched on the actual object (just one for this example). Reconstructing meshes and keeping the geometies clear is a problem.
Volume rendering uses a finite sample spacing, so in order to avoid those ripple artifacts, you must ensure that the highest spatial frequencies in the image are below the Nyquist frequency of the sampling.
I highly suggest some documentation on this fact in the beginner examples or on volumetric rendering, or something that will communicate this to beginner users of VTK. I’ve been wondering about these ripples for about a year now, and your statement makes a lot of sense now.
@008 Would you mind sharing a sample vtkImageData that produces the ripples? There are a lot of parameters in the volume mapper can be adjusted based on the volume properties.
Mapper->UseJitteringOn();
This will help you get rid of the wood-grain.
There are actually two separate issues: Moire pattern on the surface and staircase. You can reduce both - see details here: