Skip to content

feat: Remote rendering 5.2a - ParaView backend support - #223

Open
LKasianAnsys wants to merge 9 commits into
maint/move-streamed-render-protocolsfrom
feat/5.2a-paraview-backend-support
Open

LKasianAnsys wants to merge 9 commits into
maint/move-streamed-render-protocolsfrom
feat/5.2a-paraview-backend-support

Conversation

@LKasianAnsys

@LKasianAnsys LKasianAnsys commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Addresses #34

Summary

Adds initial backend support for a new server-side rendering mode, PARAVIEW, in VISOR. A PARAVIEW Visor session connects to a running pvserver, renders through ParaView proxies, and streams frames to the browser through the same trame-rca path as SERVER mode. ParaView ships its own VTK and Python versions, so PARAVIEW mode runs in ParaView's environment, not Visors (as there would be version clashes).

This PR adds initial support for single-part (non-composite) datasets such as .vtp and .vtu. VisorVTKParaview can be constructed directly in pvpython with a pvserver session you've already connected, but nothing creates it through the Visor layer yet. Visor(rendering_mode=PARAVIEW) doesn't create it, and neither does /initialize or visor-cli server init. The request model and CLI accept the PARAVIEW mode and pvserver address, but nothing reads them yet. PR 5.2b adds multiblock support. PR 5.2c connects PARAVIEW mode through the Visor class, the HTTP service and the CLI.

Changes

1. New PARAVIEW mode and its settings

  • RenderingMode.PARAVIEW (wire value "paraview")
  • PvServerAddress holds a host and a port. .visor settings gives the default pvesrver host and port, plus the pvpython and venv paths that the API launch will need later.
  • InitProps and the CLI (--pvserver-host, --pvserver-port) accept a pvserver address for each session. They reject one unless hte mode is PARAVIEW.
  • New errors: PvServerConnectionError, ParaviewSessionError, ParaviewNotConfiguredError and UnsupportedInModeError

2. Rendering through pvserver

  • ParaviewSession / PvSimpleSession is the only code that imports paraview. It wraps the few paraview.simple calls Visor uses, and it imports ParaView only when constructed, so the rest of Visor still imports in .venv. It sets RemoteRenderThreshold to 0 so every frame renders on pvserver.
  • ParaviewRenderer implements IRenderer: visibility, opacity, diffuse colour, selection tint, colour by variable (a separate colour map for each part), camera, projection and edges. Like ServerRenderer, it never renders on the calling thread. It only requests frames.
  • ParaviewCapture is a trame-rca area. It renders the ParaView view so that pvserver composites the frame before it's captured.

3. Scene and app

  • VisorParaviewScene reads each dataset locally for the scene graph and also opens the same file on pvserver. For each part, it checks that the point counts match, so a mismatch raises an error instead of showing the wrong geometry.
  • ParaviewApp is ServerApp reporting PARAVIEW mode. VisorVTKParaview wires them together with a session that the caller has already connected.
  • Frontend: 'paraview' is a known mode and uses the same streamed (server) path.

4. Docs

  • getting_started/paraview_mode.rst (marked Beta) covers setting up .pvenv, the matching pydantic versions in .venv, and launching pvserver on Windows and Linux.

Known limitations (planned for later PRs)

  • Composite datasets (.vtm, multiblock) are refused with UnsupportedInModeError.
  • API/CLI launch: /initialize with PARAVIEW still fails. Running the session in a pvpython child process comes next.
  • Not supported yet: picking, cross-section, bounding box, geometry highlight and update_variables. They log a warning or raise UnsupportedInModeError.
  • Input must be a file: pvserver can only open files, so in-memory datasets are refused.
  • Single client: pvserver runs without --multi-clients, so it accepts one client and exits when that client disconnects.

Manual test

  1. Install ParaView 6.2
  2. Follow the instructions in this doc to set up a .pvenv that ParaView's environment will use.
  3. Run pvserver on port 11111 as follows
    "C:\Program Files\ParaView 6.2.0\bin\pvserver.exe" --server-port=11111 --force-offscreen-rendering
    
  4. Start a pvpython shell as follows:
    "C:\Program Files\ParaView 6.2.0\bin\pvpython.exe" --venv .pvenv
    
  5. In the Python shell, start a VisorVTKParaview instance with a single-part dataset using the code below.
    viewer = get_paraview_visor_instance()
    viewer.start("tests/files/plate.vtp")
    
  6. Open the viewer, move the camera, select the object in the tree view, color by a variable, change the opacity.
  7. Run APIs such as viewer.add_dataset() and viewer.remove_dataset() on the viewer. Note there is only support for non-composite datasets in this PR.

Python code for creating a VisorVTKParaview instance

from ansys.visor.viewer.app.paraview.visor_vtk_paraview import VisorVTKParaview
from ansys.visor.viewer.core.pvserver_address import PvserverAddress
from ansys.visor.viewer.renderer.paraview_session import PvSimpleSession

VISOR_URL = "http://localhost:8081"
PVSERVER_HOST = "localhost"
PVSERVER_PORT = 11111

def get_paraview_visor_instance() -> VisorVTKParaview:
    """Return a VisorVTKParaview instance for testing."""
    address = PvserverAddress(host=PVSERVER_HOST, port=PVSERVER_PORT)
    session = PvSimpleSession(address)
    print(f"connected to pvserver {address}")

    viewer = VisorVTKParaview(
        url=VISOR_URL,
        standalone=True,
        dark_mode=False,
        trame_log_dir=None,
        pvserver=address,
        session=session,
    )
    return viewer

@github-actions github-actions Bot added documentation Improvements or additions to documentation test Work associated with testing added enhancement New feature or request labels Nov 16, 2026
@LKasianAnsys
LKasianAnsys changed the base branch from main to fix/add-gl-context-lock-for-server-mode November 16, 2026 19:20
@LKasianAnsys
LKasianAnsys added this pull request to stack #224 November 16, 2026 19:30
@LKasianAnsys LKasianAnsys self-assigned this Nov 16, 2026
Base automatically changed from fix/add-gl-context-lock-for-server-mode to main November 17, 2026 14:17
@LKasianAnsys
LKasianAnsys force-pushed the feat/5.2a-paraview-backend-support branch from 4b1e165 to e175e4f Compare November 17, 2026 14:17
@LKasianAnsys
LKasianAnsys force-pushed the feat/5.2a-paraview-backend-support branch from e175e4f to 263cb97 Compare November 17, 2026 16:21
@LKasianAnsys
LKasianAnsys removed this pull request from stack #224 November 17, 2026 16:25
@LKasianAnsys
LKasianAnsys changed the base branch from main to maint/move-streamed-render-protocols November 17, 2026 16:26
@LKasianAnsys
LKasianAnsys added this pull request to stack #233 November 17, 2026 16:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

added documentation Improvements or additions to documentation enhancement New feature or request test Work associated with testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants