# Problem with vtkParallelRenderManger while using translucent cutplane

**URL:** https://discourse.vtk.org/t/problem-with-vtkparallelrendermanger-while-using-translucent-cutplane/5198
**Category:** Support
**Created:** [February 16, 2021, 7:07am UTC](https://discourse.vtk.org/t/problem-with-vtkparallelrendermanger-while-using-translucent-cutplane/5198 "2021-02-16T07:07:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![hari](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/h/cdc98d/32.png) [@hari](https://discourse.vtk.org/u/hari)
#### Post date: [February 16, 2021, 7:07am UTC](https://discourse.vtk.org/t/problem-with-vtkparallelrendermanger-while-using-translucent-cutplane/5198/1 "2021-02-16T07:07:33Z")

</div>

Hi All,

I am quite new to vtk and I am trying to do a volume rendering of a vtkImageDataset in parallel using vtkcompositeendermanger. I am following these two examples

[1] ([https://gitlab.kitware.com/vtk/vtk/-/blob/fdc214b9c2c6f911b66588fc898a932da0aa6755/Examples/ParallelProcessing/MPI/Python/ParallelCone.py](https://gitlab.kitware.com/vtk/vtk/-/blob/fdc214b9c2c6f911b66588fc898a932da0aa6755/Examples/ParallelProcessing/MPI/Python/ParallelCone.py))  
[2](https://gitlab.kitware.com/vtk/vtk/-/blob/fdc214b9c2c6f911b66588fc898a932da0aa6755/Examples/VolumeRendering/Python/PseudoVolumeRendering.py)

The second example above uses translucent cut planes to get pseudo volume rendering. I facing difficulties to implement this in parallel. When the cut planes are set to be opaque (alpha = 1) the rendering works fine. However, when the planes are made translucent I get empty windows on the head rank. I tried turning SetUseRGBA() option on. But, this did not help. I have attached my script below. Is this some issue with MPI communication? Any help would be appreciated

Thanks,  
Hari

rootdir = r"./"  
myrank = 0  
myrank = comm.Get\_rank()  
n\_ranks = contr.GetNumberOfProcesses()  
rd = RunData([‘T’,‘P’],[120.0,1.41837E+05/101325],rootdir,halo=True,comm=comm,topo=[4,1,1])  
alg = S3D\_source(rd,myrank,timestep=“all”)  
alg.Update()  
alg\_out = alg.GetOutputDataObject(0)  
alg\_out.GetPointData().SetActiveScalars(“T”)  
local\_range = alg\_out.GetScalarRange()  
gmin = comm.allreduce(local\_range[0],op=MPI.MIN)  
gmax = comm.allreduce(local\_range[1],op=MPI.MAX)  
local\_range = [gmin,gmax]

#create a color lookup table  
lut = vtk.vtkLookupTable()  
lut.SetHueRange(0.667, 0.0)  
lut.SetNumberOfColors(256)  
lut.SetAlphaRange(0.5,0.5)  
lut.Build()  
#create a color lookup table  
lut1 = vtk.vtkLookupTable()  
lut1.SetHueRange(0.667, 0.0)  
lut1.SetNumberOfColors(256)  
lut1.Build()  
#get a cutting plane  
plane = vtk.vtkPlane()  
local\_origin = rd.origin\_for\_processor(myrank,0,0)  
plane.SetOrigin(0,0,0)  
plane.SetNormal(0,0,1)  
#create a cutter to cut the data using the above plane  
cutter = vtk.vtkCutter()  
cutter.SetInputConnection(alg.GetOutputPort())  
cutter.SetCutFunction(plane)  
cutter.GenerateCutScalarsOff()  
cutter.SetSortByToSortByCell()  
#create mapper for the polydata from cutter  
cutterMapper = vtk.vtkPolyDataMapper()  
cutterMapper.SetInputConnection(cutter.GetOutputPort())  
cutterMapper.SetScalarRange(local\_range[0], local\_range[1])  
#choose which array to use for mapping to color  
cutterMapper.ScalarVisibilityOn()  
cutterMapper.SetScalarModeToUsePointFieldData()  
cutterMapper.SelectColorArray(“T”)  
cutterMapper.SetColorModeToMapScalars()  
cutterMapper.SetLookupTable(lut)

# 

```
cutactor = vtk.vtkActor()
cutactor.SetMapper(cutterMapper)

```

# 

```
iso = vtk.vtkContourFilter()
alg_out = alg.GetOutputDataObject(0)
alg_out.GetPointData().SetActiveScalars("T")
iso.SetInputData(alg_out)
iso.SetValue(0, 1850)
iso.SetValue(1, 1000)
normals = vtk.vtkPolyDataNormals()
normals.SetInputConnection(iso.GetOutputPort())
normals.SetFeatureAngle(45)
isoMapper = vtk.vtkPolyDataMapper()
isoMapper.SetInputConnection(normals.GetOutputPort())
isoMapper.ScalarVisibilityOn()
isoMapper.SetScalarModeToUsePointFieldData()
isoMapper.SelectColorArray("T")
isoMapper.SetScalarRange(local_range[0],local_range[1])
isoMapper.SetColorModeToMapScalars()
isoMapper.SetLookupTable(lut1)
isoActor = vtk.vtkActor()
isoActor.SetMapper(isoMapper)

```

#create colorbar  
prop = vtk.vtkTextProperty()  
prop.SetColor(0.0,0.0,0.0)  
prop.SetFontSize(1)  
cb = vtk.vtkScalarBarActor()  
cb.SetLookupTable(lut)  
cb.SetTitle(“T”)  
cb.SetPosition(0.8,0.2)  
cb.SetBarRatio(0.2)  
cb.SetHeight(0.7)  
cb.SetLabelTextProperty(prop)  
cb.SetTitleTextProperty(prop)

# 

```
ren = vtk.vtkRenderer()
ren.AddActor(cutactor)
#ren.AddActor(isoActor)
cutactor.VisibilityOn()
cutactor.RotateX(30)
isoActor.RotateX(30)
cutactor.RotateY(45)
isoActor.RotateY(45)
if(myrank == 0):
    ren.AddActor2D(cb)
ren.SetBackground(1.0, 1.0, 1.0)
ren.ResetCamera()
cam = ren.GetActiveCamera()
 
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(1920, 1080)

```

#now generate cut planes  
cutter.GenerateValues(100,-0.02,0.02)  
#lut.Build()

```
renWin.Render()
ren_manager = vtk.vtkCompositeRenderManager()
tsteps = rd.get_times()
ren_manager.SetController(contr)
ren_manager.SetRenderWindow(renWin)
ren_manager.SetUseRGBA(0)
tid = 0
if(myrank == 0):
    if(tid == 0):
        ren_manager.ResetAllCameras()
        cam.Zoom(1.5)
    renWin.Render()
    w2if = vtk.vtkWindowToImageFilter()
    w2if.SetInput(renWin)
    writer = vtk.vtkPNGWriter()
    writer.SetInputData(w2if.GetOutput())
    w2if.Update()
    filename = './figs/screenshot%d'%tid
    filename = filename + '.png'
    writer.SetFileName(filename)
    writer.Write() 
    for i in range(1,n_ranks):
        contr.TriggerRMI(i,contr.GetBreakRMITag())
else:
    ren_manager.InitializeRMIs()
    contr.ProcessRMIs()
    print("after process:",tid,myrank)

```

# 

```
contr.Finalize()
```
