Hello,
Consider this example:
import vtk
cubeSource = vtk.vtkCubeSource()
cubeMapper = vtk.vtkPolyDataMapper()
cubeMapper.SetInputConnection(cubeSource.GetOutputPort())
emissiveSource = vtk.vtkImageCanvasSource2D()
emissiveSource.SetScalarTypeToUnsignedChar()
emissiveSource.SetNumberOfScalarComponents(3)
emissiveSource.SetExtent(0, 1, 0, 1, 0, 0)
emissiveSource.SetDrawColor(255, 255, 255)
emissiveSource.FillBox(0, 1, 0, 1)
emissiveTexture = vtk.vtkTexture()
emissiveTexture.SetUseSRGBColorSpace(True)
emissiveTexture.SetInputConnection(emissiveSource.GetOutputPort())
cubeActor = vtk.vtkActor()
cubeActor.SetMapper(cubeMapper)
cubeActor.GetProperty().SetInterpolationToPBR()
cubeActor.GetProperty().SetEmissiveTexture(emissiveTexture)
cubeActor.GetProperty().SetEmissiveFactor(1.0, 0.0, 0.0)
cubeActor.SetPosition(-0.55, 0.0, 0.0)
sphereSource = vtk.vtkSphereSource()
sphereMapper = vtk.vtkPolyDataMapper()
sphereMapper.SetInputConnection(sphereSource.GetOutputPort())
sphereActor = vtk.vtkActor()
sphereActor.SetPosition(0.55, 0.0, 0.0)
sphereActor.GetProperty().SetInterpolationToPBR()
sphereActor.SetMapper(sphereMapper)
renderer = vtk.vtkRenderer()
renderer.AddActor(cubeActor)
renderer.AddActor(sphereActor)
window = vtk.vtkRenderWindow()
window.AddRenderer(renderer)
interactor = vtk.vtkRenderWindowInteractor()
interactor.SetRenderWindow(window)
interactor.Start()
Is there any way to have the emissive cube light up the sphere (give it a red tint), or must I turn to OSPRay for this?