Multiple colorized sphere objects mapping

Hello,

I am going to map the colorized point cloud to the sphere object (with multiple spheres) and generate a viewpoint-invariance object. The problem is that when I change the viewpoint close to the object the colorized point cloud become blur. My goal is to capture the image and keep the same color distribution with virtual camera from different viewpoint (close to far). One possible solution I am trying is to render each point cloud as sphere and assign the color to this sphere. My code is not working and I checked for multiple times and nothing works. Thanks.

shot_4

This is my code. Thanks.

VTK_DATA_ROOT = vtkGetDataRoot()

# Load the data for point cloud and colorized vectors
nc = vtk.vtkNamedColors()
test = BTL_GL.BTL_GL()
pcd, pc, pc_color, MeshGrid, img_color = test.GL_NonFlat()

# The sphere model
sphere = vtk.vtkSphereSource()
sphere.SetPhiResolution(5)
sphere.SetThetaResolution(5)
sphere.SetRadius(0.0025 * 2)

# The sphere object is vtkSphereSource
print("The sphere object is ", sphere)

# Add the points to object
Points = vtk.vtkPoints()

# Add the color array to the object
Colors = vtk.vtkUnsignedCharArray()
Colors.SetNumberOfComponents(3)
Colors.SetName(“Colors”)
Colors.InsertNextTuple3(255, 0, 0)

# vtkUnsignedCharArray –
print("The color object is ", Colors)

for i in range(len(pc)):
Points.InsertNextPoint(pc[i, 0], pc[i, 1], pc[i, 2])
Colors.InsertNextTuple3(pc_color[i, 0] / 255, pc_color[i, 1] / 255, pc_color[i, 2] / 255)

# Design the polydata object
polydata = vtk.vtkPolyData()
polydata.SetPoints(Points)

# Check the sphere object
sphere.GetOutput().GetCellData().SetScalars(Colors)
sphere.Update()

appendData = vtk.vtkAppendPolyData()
appendData.AddInputConnection(sphere.GetOutputPort())
appendData.Update()

# Design the mapper
point_mapper = vtk.vtkGlyph3DMapper()
point_mapper.SetInputData(polydata)
point_mapper.SetSourceConnection(appendData.GetOutputPort())
point_mapper.SetScalarModeToUseCellData()

# Set background color
actor = vtk.vtkActor()
actor.SetMapper(point_mapper)
actor.GetProperty().LightingOff()
actor.GetProperty().BackfaceCullingOn()

ren = vtk.vtkRenderer()
ren.SetBackground(.2, .3, .4)
ren.AddActor(actor)

renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)

# Interactor
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renWin)

# Begin Interaction
renWin.Render()
renderWindowInteractor.Start()

Sorry, I answered here: