Incorrect rendering with volume mappers
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
Hi,
Below is a Python script file that demonstrates a funny problem that two MayaVi users encountered with VTK's volume mappers.
A gzipped data file is available at: http://vvikram.com/~prabhu/tmp/volumeBug.vtk.gz
The data file is a structured points dataset. There is one large region of constant color and in this region there are spurious black regions. This occurs with both the RayCast and Texture mappers.
The Python script should run with VTK-Python (no dependencies are required including Tk).
The script itself is also available here: http://vvikram.com/~prabhu/tmp/v.py
prabhu
#!/usr/bin/env python
import vtk
RAYCAST = 1
r = vtk.vtkStructuredPointsReader() r.SetFileName('volumeBug.vtk')
vm = None if RAYCAST: cf = vtk.vtkVolumeRayCastCompositeFunction() vm = vtk.vtkVolumeRayCastMapper() vm.SetVolumeRayCastFunction(cf) else: vm = vtk.vtkVolumeTextureMapper2D() vm.SetInput(r.GetOutput())
otf = vtk.vtkPiecewiseFunction() otf.AddPoint(0, 0.2) otf.AddPoint(255, 0.2)
ctf = vtk.vtkColorTransferFunction() ctf.AddRGBPoint(0.0, 1.0, 0.0, 0.0) ctf.AddRGBPoint(255.0, 1.0, 0.0, 0.0)
vp = vtk.vtkVolumeProperty() vp.SetColor(ctf) vp.SetScalarOpacity(otf) vp.ShadeOn() vp.SetInterpolationTypeToLinear()
v = vtk.vtkVolume() v.SetMapper(vm) v.SetProperty(vp)
ren = vtk.vtkRenderer() ren.AddVolume(v) ren.SetBackground(0.9, 0.9, 0.9)
rw = vtk.vtkRenderWindow() rw.AddRenderer(ren) rw.SetSize(600, 600)
rwi = vtk.vtkRenderWindowInteractor() rwi.SetRenderWindow(rw) rwi.Initialize() rw.Render() rwi.Start()