Skip to content

feat: Remote rendering 5.2b - Render mult-part datasets with per-part color and selection in ParaView mode - #225

Open
LKasianAnsys wants to merge 20 commits into
feat/5.2a-paraview-backend-supportfrom
feat/5.2b-paraview-multiblock-support
Open

LKasianAnsys wants to merge 20 commits into
feat/5.2a-paraview-backend-supportfrom
feat/5.2b-paraview-multiblock-support

Conversation

@LKasianAnsys

@LKasianAnsys LKasianAnsys commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Addresses #34

Summary

Allows PARAVIEW mode to render multi-part (composite) datasets such as .vtm and multiblock .vtkhdf. Each part supports visibility, opacity, solid colour, colour-by-variable and selection. Before this PR, open_source rejected composite input.
The final design is one composite representation per dataset. Each Visor part is a block inside it, written through ParaView's per-block properties (BlockSelectors, BlockOpacities, BlockColors, BlockLookupTables, …) by the block's selector. This mapping lives only in ParaviewRenderer. The scene graph, registry and part model are unchanged, and so are CLIENT and SERVER.

Separately, the camera now no longer renders twice per mouse move, and the rotation pivots at the centre of the data.

Problems found, and how they shaped the design

Most of this design came from problems found while testing against a real pvserver.

GPU texture limit (one representation per part crashed pvserver)

  • The first design for multiblock support gave each part its own representation in ParaView. On many_blocks.vtm (66 parts), pvserver logged Hardware does not support the number of textures defined and then crashed. The browser canvas went black or red.
  • The limit is in VTK, not ParaView. On this machine's Intel driver, at most 31 vtkCompositePolyDataMapper draws render in one frame. Pure VTK reproduces it: 31 actors render, 32 crash. CLIENT and SERVER use plain vtkPolyDataMapper, which has no limit, so only PARAVIEW is affected.
  • Fix: one composite representation per dataset, with each part as a block. 66 blocks, or 500, render cleanly.
  • Color maps hit the same limit in a probe: a 32nd separate map in one frame crashes pvserver. ParaView turns InterpolateScalarsBeforeMapping on by default, which gives each separate map its own color texture.
    • Fix: On each PARAVIEW representation, set InterpolateScalarsBeforeMapping = 0, so colors are mapped per vertex and textures are not used per map..
    • InterpolateScalarsBeforeMapping = 0 is VTK's default setting, used by CLIENT and SERVER mode, so now PARAVIEW mode now colors the same way.
    • Visor shares one range per variable, so parts colored by the same variable share one map, and the number of maps is the number of variables in use. Maps are reference-counted and deleted once no part uses them.

Colours didn't match the other modes

  • ParaView's default preset gave muted browns and oranges. Maps are now built from Visor's own lookup-table definition (LOOKUP_TABLE_HUE_RANGE), discretized the same way.
  • With InterpolateScalarsBeforeMapping off (see above), color interpolation across cells also matches CLIENT and SERVER modes. which have it off by default. (Before turning the setting off, in PARAVIEW mode, the color mapping looked different from the other modes.)

Selection and colour changes got slower with every selected part

  • simple.SelectBlocks takes one selector per call and renders after each one, so selection time grew quadratically. Selecting all 66 parts one at a time took 152 s. Colouring all 66 parts pushed 264 property writes.
  • Fixes:
    • Selection is written in one call.
    • BlockTable marks a property list as stale when a part changes, and ParaviewCapture calls flush_writes() before each render, so each list is written once per frame.
  • Results: selecting all 66 now takes ~3.5 s, and selecting a parent node takes 0.07 s from the renderer; the tree view panel still sends one update per part until PR 5.2d (feat: Remote rendering 5.2d - Batch visibility and selection requests from client #227).

Selection highlight is set to use wireframe

  • ParaView has no per-block ambient or diffuse lighting, so the SERVER-style tint can't be applied per block. ParaView's block selection is used instead.
  • That selection's default highlighted only vertices. Drawing faces instead z-fought with the surface underneath them.
  • Current state: a wireframe in Visor's selection blue. Whether to follow up to reimplement the surface highlight (e.g. by drawing selected blocks through a separate tinted extract) is left as a future decision.

Camera lag during drags

  • By default ParaView renders on pvserver for every mouse event, and those images are thrown away. A frame cost two pvserver renders (~39 ms, against ~19 ms in SERVER), and each queued mouse move added ~11 ms. Drags slowed themselves down.
  • Fix: EnableRenderOnInteraction = 0, so the capture's render is the only one per frame. Rendering stays on pvserver's GPU rather than moving into the pvpython sidecar.
  • trame-rca also re-rendered the unchanged scene once a drag stopped, to send a higher-quality still frame, and in PARAVIEW that render goes through pvserver.
    • Fix: ParaviewApp streams at one JPEG quality, 90, so there is no second pass.
    • Trade-off: frames during a drag are larger than SERVER's, which streams at 60.

Rotation pivoted around the world origin

  • Only the ParaView GUI updates CenterOfRotation. It now follows the camera's focal point after a reset, a camera write and each gesture, matching SERVER.

Making sure each part shows the right block

  • CompositeBlocks maps each local leaf to a pvserver selector.
  • It raises VisorAddDatasetError when sibling blocks share a name, because the selector would then be ambiguous.
  • Before showing a dataset, it checks each block's point count on pvserver against the local copy.

Changes to shared code (CLIENT/SERVER behaviour unchanged)

  • ServerApp streaming quality is now set through the class attributes INTERACTIVE_QUALITY and STILL_QUALITY, so ParaviewApp can override them. No changes to the actual values in SERVER mode, just a refactor.

Known limitations

Manual check (similar to the manual check for PR 5.2a, #223)

  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 multiblock dataset using the code below.
    viewer = get_paraview_visor_instance()
    viewer.start("tests/files/many_blocks/many_blocks.vtm")
    
  6. Open the viewer, move the camera, select parts 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.

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 feat/5.2a-paraview-backend-support November 16, 2026 20:44
@LKasianAnsys
LKasianAnsys added this pull request to stack #224 November 16, 2026 20:44
@github-actions github-actions Bot removed the documentation Improvements or additions to documentation label Nov 16, 2026
@LKasianAnsys LKasianAnsys changed the title feat: Remote rendering 5.2b - multiblock support in ParaView mode feat: Remote rendering 5.2b - Render mult-part datasets with per-part color and selection in ParaView mode Nov 16, 2026
@LKasianAnsys LKasianAnsys self-assigned this Nov 16, 2026
@LKasianAnsys
LKasianAnsys force-pushed the feat/5.2b-paraview-multiblock-support branch from b480b94 to 8f733c8 Compare November 17, 2026 14:17
@LKasianAnsys
LKasianAnsys removed this pull request from stack #224 November 17, 2026 16:25
@LKasianAnsys
LKasianAnsys added this pull request to stack #233 November 17, 2026 16:26
@LKasianAnsys
LKasianAnsys force-pushed the feat/5.2b-paraview-multiblock-support branch 2 times, most recently from 5d8926f to 5c1a718 Compare November 17, 2026 20:06
@LKasianAnsys
LKasianAnsys force-pushed the feat/5.2b-paraview-multiblock-support branch from 5c1a718 to 2f2e293 Compare November 17, 2026 20:24
@LKasianAnsys
LKasianAnsys marked this pull request as ready for review November 17, 2026 22:16

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 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