Kitware/trame

Altered rendering behavior in client mode

lmonroe opened this issue · 4 comments

Hello,

I have some python/pyvista code that uses spheres and also makes a point cloud, rendering the points as spheres. The issues I have seen are:

  1. pl.add_mesh seems not to handle specular at all, so this call:
    pl.add_mesh(pv.Sphere(), color='white', point_size=4, smooth_shading=True, specular=0.3, metallic=1, roughness=0, line_width=1.5)
    gives a blinding white sphere.
  2. the points in the point cloud are not rendered as spheres, instead as flat squares.

To Reproduce

Run the code below, in a Jupyter notebook.
I just reinstalled my entire environment so things should be up to date.

Code

import pyvista as pv
# use backend 'trame' not 'client' if you want the possibility of remote remdering, with the dataset left on the server.
pv.set_jupyter_backend('trame')
# pv.set_jupyter_backend('client')
pl = pv.Plotter()
# trame client rendering does not handle specularity. Must use "specular=0" or no specular parameter.
pl.add_mesh(pv.Sphere(), color='white', point_size=4, smooth_shading=True, specular=0.3, metallic=1, roughness=0, line_width=1.5)
point_list_cart = [[1.1,0,0],[0,1.1,0],[0,0,1.1], [0,0,0]]
num_points = len(point_list_cart)
point_cloud_list = [[] for i in range(num_points)]
point_cloud_list = pv.PolyData(point_list_cart)
pl.add_mesh(point_cloud_list, color='red', point_size=200, render_points_as_spheres=True)
# trame client rendering does not handle points as spheres. Defaults to flat squares.
# pl.add_mesh(point_cloud_list, color='red', point_size=200, render_points_as_spheres=False)
pl.show()

Expected behavior

I expect to see a white sphere and three smaller red points rendered as spheres. This works in remote mode on my standalone machine (although the resolution is nasty and gives a fuzzy effect). This does not work in client mode. The code I've attached just uses trame, and switching back and forth between modes in the widget shows the issue.

Screenshots

Doesn't upload unfortunately ...

Platform:

Device:

  • Desktop
  • XX Mobile

OS:

  • Windows
  • XX MacOS
  • Linux
  • Android
  • iOS

Browsers Affected:

  • Chrome
  • XX Firefox
  • Microsoft Edge
  • Safari
  • Opera
  • Brave
  • IE 11

So the PBR rendering is only supported with WebGPU on the vtk.js side and we are currently only exposing the WebGL backend of vtk.js.

The WebGPU backend of vtk.js needs more work to become the default.

So far, the only solution (for now) is to do remote rendering.

Thanks for reporting back such issue and providing a code sample to reproduce.

No worries, feel free to ping me on my email directly as I still don't see the picture on that issue.

sebastien.jourdain@kitware.com

So with PyVista you can access the remote rendering settings of trame by using pv.global_theme.trame.*

In this case, you can inflate the resolution by 2 to leverage the HiDPI screen by doing the following

pv.global_theme.trame.still_ratio = 2
pv.global_theme.trame.interactive_ratio = 2