<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Dear vtkusers,</p>
    <p>I encountered a weird problem when using more than one positional
      light source in vtk. I am pretty sure that it worked with vtk 7.1
      but it stopped working with vtk 8.0.0 and 8.0.1. An example in
      python is given below. The scene contains a plane which should be
      illuminated by two spot lights. However, only one spotlight is
      rendered. It seems that this is always the first spotlight that is
      added to the renderer. Is there any workaround for this problem?</p>
    <p>Many thanks<br>
      Oliver</p>
    <p><br>
    </p>
    <pre style="background-color:#ffffff;color:#000000;font-family:'Source Code Pro';font-size:10,5pt;"><span style="color:#0000dd;">import </span>vtk

<span style="color:#808080;"># create a rendering window and renderer
</span>renderer = vtk.vtkRenderer()
render_window = vtk.vtkRenderWindow()
render_window.AddRenderer(renderer)

<span style="color:#808080;"># create a renderwindowinteractor
</span>iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(render_window)

<span style="color:#808080;"># create a plane and add it to the renderer
</span>rectangle_source = vtk.vtkPlaneSource()
rectangle_source.SetOrigin(-<span style="color:#0000dd;">5.0</span>, <span style="color:#0000dd;">0.0</span>, <span style="color:#0000dd;">5.0</span>)
rectangle_source.SetPoint1(<span style="color:#0000dd;">5.0</span>, <span style="color:#0000dd;">0.0</span>, <span style="color:#0000dd;">5.0</span>)
rectangle_source.SetPoint2(-<span style="color:#0000dd;">5.0</span>, <span style="color:#0000dd;">0.0</span>, -<span style="color:#0000dd;">5.0</span>)
rectangle_source.SetResolution(<span style="color:#0000dd;">100</span>, <span style="color:#0000dd;">100</span>)
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(rectangle_source.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
renderer.AddActor(actor)

<span style="color:#808080;"># set camera view
</span>renderer.ResetCamera()
camera = renderer.GetActiveCamera()
camera.Azimuth(<span style="color:#0000dd;">40.0</span>)
camera.Elevation(<span style="color:#0000dd;">30.0</span>)

<span style="color:#808080;"># create a green light
</span>light_green = vtk.vtkLight()
light_green.SetPositional(<span style="color:#0000dd;">1</span>)
light_green.SetPosition(-<span style="color:#0000dd;">4.0</span>, <span style="color:#0000dd;">4.0</span>, -<span style="color:#0000dd;">1.0</span>)
light_green.SetColor(<span style="color:#0000dd;">0.0</span>, <span style="color:#0000dd;">1.0</span>, <span style="color:#0000dd;">0.0</span>)
light_green.SetIntensity(<span style="color:#0000dd;">0.5</span>)

<span style="color:#808080;"># create a pink ligh
</span>light_pink = vtk.vtkLight()
light_pink.SetPositional(<span style="color:#0000dd;">1</span>)
light_pink.SetPosition(<span style="color:#0000dd;">4.0</span>, <span style="color:#0000dd;">5.0</span>, <span style="color:#0000dd;">1.0</span>)
light_pink.SetColor(<span style="color:#0000dd;">1.0</span>, <span style="color:#0000dd;">0.0</span>, <span style="color:#0000dd;">1.0</span>)
light_pink.SetIntensity(<span style="color:#0000dd;">0.6</span>)

<span style="color:#808080;"># add lights to the renderer
</span><span style="color:#808080;">#
</span><span style="color:#808080;"># This is interesting in vtk 8.0.0 and 8.0.1:
</span><span style="color:#808080;"># Only the pink light spot is visible. If the two statements are swapped,
</span><span style="color:#808080;"># only the green light is visible. It seems that always only the first
</span><span style="color:#808080;"># light can be active.
</span>renderer.AddLight(light_pink)
renderer.AddLight(light_green)

<span style="color:#808080;"># define a background for better visibility
</span>renderer.SetBackground(<span style="color:#0000dd;">0.2</span>, <span style="color:#0000dd;">0.2</span>, <span style="color:#0000dd;">0.5</span>)
renderer.SetBackground2(<span style="color:#0000dd;">0.4</span>, <span style="color:#0000dd;">0.4</span>, <span style="color:#0000dd;">1.0</span>)
renderer.SetGradientBackground(<span style="color:#0000dd;">True</span>)

<span style="color:#808080;"># enable interactor
</span>iren.Initialize()
render_window.Render()
iren.Start()
</pre>
    <pre class="moz-signature" cols="72">
</pre>
  </body>
</html>