Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTK - vtkFollower don't follow the camera in Panel #1412

Closed
GilShoshan94 opened this issue Jun 15, 2020 · 4 comments · Fixed by #1451
Closed

VTK - vtkFollower don't follow the camera in Panel #1412

GilShoshan94 opened this issue Jun 15, 2020 · 4 comments · Fixed by #1451
Labels
type: enhancement Minor feature or improvement to an existing feature

Comments

@GilShoshan94
Copy link

Hi,

I tried to use a vtkFollower object, I set it to the active camera then I passed the vtkRenderWindow to Panel, the object is render in the dashboard, but is not following the camera.
I guess a new camera is created in the process (and don't tell the vtkFollower object to follow it) ?

vtkFollower :
"vtkFollower is a subclass of vtkActor that always follows its specified camera. More specifically it will not change its position or scale, but it will continually update its orientation so that it is right side up and facing the camera."

ALL software version info

  • OS: Windows 10 Pro (64-bit) version 1909
  • Python: 3.8.3
  • Chrome: Version 83.0.4103.97 (Official Build) (64-bit)
  • Panel: 0.9.5
  • Bokeh: 2.0.1

Description of expected behavior and the observed behavior

Expected behavior:

The vtkFollower (the label/text "Origin" in the example) follow the camera and face it always.

Observed behavior:

The vtkFollower (the label/text "Origin" in the example) is render as a fix actor and does not follow the camera .

Complete, minimal, self-contained example code that reproduces the issue

# fmt: off
## The 3 followings line are a temp solution until I upgrate to bokeh 2.0.2 (now it 2.0.1) and won't be necessary later
from bokeh.settings import settings  # noqa isort:skip
settings.resources = 'cdn'  # noqa isort:skip
settings.resources = 'inline'  # noqa isort:skip
# fmt: on
import panel as pn
import vtk

# Create the arrow and the associated mapper and actor.
arrow = vtk.vtkArrowSource()
arrowMapper = vtk.vtkPolyDataMapper()
arrowMapper.SetInputConnection(arrow.GetOutputPort())
arrowActor = vtk.vtkActor()
arrowActor.SetMapper(arrowMapper)

# Create the 3D text and the associated mapper and follower (a type of actor).  
# Position the text so it is displayed over the origin of the arrow.
atext = vtk.vtkVectorText()
atext.SetText("Origin")
textMapper = vtk.vtkPolyDataMapper()
textMapper.SetInputConnection(atext.GetOutputPort())
textActor = vtk.vtkFollower()
textActor.SetMapper(textMapper)
textActor.SetScale(0.2, 0.2, 0.2)
textActor.AddPosition(0, 0, 0)

# Create the Renderer, RenderWindow, and RenderWindowInteractor.
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)

# Add the actors to the renderer.
renderer.AddActor(arrowActor)
renderer.AddActor(textActor)
renderer.GetActiveCamera().SetPosition(4, 0, 0)

# Set the camera of the follower.
textActor.SetCamera(renderer.GetActiveCamera())


# Test Panel
dash = pn.pane.VTK(renderWindow)
dash.show()

# Test VTK
# interactor = vtk.vtkRenderWindowInteractor()
# interactor.SetRenderWindow(renderWindow)
# renderWindow.Render()
# interactor.Start()

Screenshots or screencasts of the bug in action

In Panel

image

In VTK

image

@xavArtley
Copy link
Collaborator

xavArtley commented Jun 15, 2020

Interesting, I didn't expected something will be displayed since I never thought of supporting this.
However in the next panel version vtkFollower will be clearly not supported:
image

To support this there must be an equivalent in vtk.js.
I'll open a feature request there

@xavArtley xavArtley added type: bug Something isn't correct or isn't working type: enhancement Minor feature or improvement to an existing feature and removed type: bug Something isn't correct or isn't working labels Jun 15, 2020
@GilShoshan94
Copy link
Author

@xavArtley Thank you.
I think it's a good feature to have since it's very useful for labeling in the 3d space.

@xavArtley
Copy link
Collaborator

@jourdain do you think a vtkFollower would be a good feature request for vtkjs?

@jourdain
Copy link

Yes please do on the bug tracker. Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants