i’m trying to do a render of a unstructured grid by setting the camera before interactor. When i render just the unstructured grid alll works fine but when i try to set a custom camera at a given possition it gives an empty window. What i’m doing is:
actor = vtk.vtkActor() renderer = vtk.vtkRenderer() renderWindow = vtk.vtkRenderWindow() renderWindowInteractor = vtk.vtkRenderWindowInteractor() camera = vtk.vtkCamera() # set actor mapper which is a DataSetMapper actor.SetMapper(mapper) # set actor on renderer renderer.AddActor(actor) # set renderer on window renderWindow.AddRenderer(renderer) # set window in interactor renderWindowInteractor.SetRenderWindow(renderWindow) # additional configurations renderer.SetBackground(0, 0, 0) # black renderWindow.SetSize(600, 600) # camera configuration # using same coordinates that the default active camera gives for this actor. camera.SetPosition(570320.4375, 7343062.5, 155036.19074423693) # set camera on renderer # if i dont set this, the render will work correctly renderer.SetActiveCamera(camera) # render initialize and start renderWindow.Render() renderWindowInteractor.Initialize() renderWindowInteractor.Start()
i could think that the object is too big to render correctly but using default camera works fine then when i set a “custom” camera with same coordinates it doesnt work, any idea on what’s happening?