-
-
Notifications
You must be signed in to change notification settings - Fork 552
Open
Description
Is your feature request related to a problem? Please describe.
Currently vtk.js is used in panel projects (e.g. VTK and VTKInteractive). vtk.js is currently not actively maintained, which leads to the problem that some vtk features are not supported (e.g. Texture missing in pyvista plotter in Panel and Interaction with pyvista widgets). To remedy this, PyVista deprecated the use of vtk.js and made trame the standard. PyVista supports jupyter rendering with trame via the show method, which allows it to be rendered to the panel via ipywidget.
Code
Using Physically Based Rendering example.
import panel as pn
import pyvista as pv
from IPython.display import IFrame
from pyvista import examples
def handler(viewer, src, **kwargs):
return IFrame(src, "75%", "500px")
# Load the statue mesh
mesh = examples.download_nefertiti()
mesh.rotate_x(-90.0, inplace=True) # rotate to orient with the skybox
# Download skybox
cubemap = examples.download_sky_box_cube_map()
p = pv.Plotter(notebook=True)
p.add_actor(cubemap.to_skybox())
p.set_environment_texture(cubemap) # For reflecting the environment off the mesh
p.add_mesh(mesh, color="linen", pbr=True, metallic=0.8, roughness=0.1, diffuse=1)
# Define a nice camera perspective
cpos = [(-313.40, 66.09, 1000.61), (0.0, 0.0, 0.0), (0.018, 0.99, -0.06)]
iframe = p.show(
jupyter_backend="trame",
jupyter_kwargs=dict(handler=handler),
return_viewer=True,
cpos=cpos,
)
pn.extension()
pn.panel(iframe, width=2000).show()
Screencast.from.2023-05-03.16-09-10.webm
Describe the solution you'd like
Please document this example and encourage people to use trame.
Describe alternatives you've considered
None
Additional context
See the detail of discussion here.
Metadata
Metadata
Assignees
Labels
No labels