Emissive actor light up other actor with PBR?

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()

bild

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?

FYI @Lfx_Paul

I am pretty sure it is not possible because the emissivity is just a texture on the surface. So you may have to use OSPRay.

Interestingly emissivity does not change when you change the light source so it is inherent to the cube in this case. E.g. add this after creating the renderer. You get a cyan light on the sphere but the colour of the cube is unchanged.

light = vtk.vtkLight()
light.SetColor(0,1,1)
renderer.AddLight(light)

Alright, thanks @amaclean.

Do you know if there are any plans to add support for area lights to VTK’s own renderer?

I am not the best person to answer this , however, to my knowledge, I don’t know of any plans.

1 Like