Hi,<br><br>With the code below, i'm projecting the shadow from cone in the cube. But does not work, what am I doing wrong?<br><br>Regards,<br>Paulo<br><br><br><br>The code:<br><br><br>import vtk<br><br>ren = vtk.vtkRenderer()<br>
ren.SetBackground(0.1, 0.1, 0.4)<br><br>cube = vtk.vtkCubeSource()<br>cube.SetXLength(100)<br>cube.SetYLength(100)<br>cube.SetZLength(100)<br><br>cube_mapper = vtk.vtkPolyDataMapper()<br>cube_mapper.SetInput(cube.GetOutput())<br>
<br>cube_actor = vtk.vtkActor()<br>cube_actor.SetMapper(cube_mapper)<br><br>prop = cube_actor.GetProperty()<br>prop.ShadingOn() <br><br>ren.AddActor(cube_actor)<br>ren.ResetCamera()<br><br>cam = ren.GetActiveCamera()<br>
cam.GetPosition()<br>
cam.GetFocalPoint()<br><br><br>cilynder = vtk.vtkCylinderSource()<br>cilynder.SetRadius(5)<br>cilynder.SetCenter(0, 0, 0)<br>cilynder.SetHeight(600) <br><br>cilynder_mapper = vtk.vtkPolyDataMapper()<br>cilynder_mapper.SetInput(cilynder.GetOutput())<br>
<br>cilynder_actor = vtk.vtkActor()<br>cilynder_actor.SetMapper(cilynder_mapper)<br>cilynder_actor.SetPosition(cube_actor.GetPosition()[0], cube_actor.GetPosition()[1], cube_actor.GetPosition()[2] + 200)<br>cilynder_actor.GetProperty().SetColor(0, 0, 1) <br>
<br>ren.AddActor(cilynder_actor)<br><br><br>ren_win = vtk.vtkRenderWindow()<br>ren_win.AddRenderer(ren)<br>ren_win.SetSize(800, 600)<br><br>interactor = vtk.vtkRenderWindowInteractor()<br>interactor.SetRenderWindow(ren_win)<br>
interactor.Initialize()<br>interactor.Render()<br><br>light = ren.GetLights().GetItemAsObject(0)<br>light.SetLightTypeToSceneLight()<br>light.SetConeAngle(180)<br>light.SetPosition(cilynder_actor.GetPosition()[0], cilynder_actor.GetPosition()[1], cilynder_actor.GetPosition()[2] + 200)<br>
ren.AddLight(light)<br>interactor.Render()<br><br>interactor.Start()<br>