Interactive rendering defaults for PyVista and Plotly (fixes #337) - #366
Open
SLT2k wants to merge 1 commit into
Open
Interactive rendering defaults for PyVista and Plotly (fixes #337)#366SLT2k wants to merge 1 commit into
SLT2k wants to merge 1 commit into
Conversation
…337) PyVista axes: - Replace fixed 9-point linspace ticks with a 1/2/5 nice-number locator (_nice_ticks): round labels, adaptive decimals, at most 8 ticks per axis. - Give the z axis intermediate ticks and drop its base tick, whose label collided with the y labels at the shared corner (span-relative threshold: STL float noise puts nominally flat ground fractionally below zero). - Draw z ticks/labels/title along a screen-level direction so they no longer read as kinks on the vertical axis line; centre all axis text on its anchor (the default left/bottom justification visibly offset labels from their ticks); hang x/y labels below their tick tips; merge the duplicated x/y origin labels into one label below the shared corner. - Move labels and titles clear of the axes and scale fonts with the trame still ratio so supersampled notebook frames keep their apparent text size. Rendering quality (PyVista): - 16-sample MSAA anti-aliasing with FXAA fallback, plus scene-scaled SSAO contact shading. - Stream notebook stills at 1.5x with JPEG quality 95: ratio-1 streaming is undersampled on displays with OS scaling above 100%. Ground/building classification: - Classify faces as ground within a 1 mm height tolerance instead of a strict z > 0 test: STL float noise scattered most ground triangles into the buildings group, painting the ground in the building colour and leaving mismatched halos around building bases in both backends. Vegetation: - plot_veg draws each vegetation point as an opaque voxel filling its grid cell (stretched z spacings included) instead of size-2, opacity-0.2 points that vanished against the geometry; colour and opacity are now keyword arguments. - New plot_veg_outline: the same vegetation voxels over the outline-style base, the most readable vegetation view on fine meshes. Wireframes and lines: - Full-wireframe overlays render thin and semi-transparent in PyVista so fine meshes no longer merge into a solid black mass; LineSet gains an opacity field and optional Plotly-specific width/opacity overrides, since Plotly WebGL lines rasterize too differently for shared values (Plotly keeps its original bold opaque lines). - The PyVista mesh path now honours MeshPrimitive.opacity (previously Plotly-only). Plotly: - Bake directional Lambert shading into per-face colours: plotly.js does not apply its lighting model to Mesh3d facecolor arrays, so uniformly coloured meshes rendered as unshaded silhouettes. - Draw explicit axis lines (Plotly 3-D axes draw none by default, leaving the z axis invisible) with outside ticks for label standoff. API hardening: - UDBase.plot_veg/plot_trees/plot_veg_outline forward keyword arguments to the visualization facade; plot_trees(backend=...) previously raised TypeError. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses every point in #337 (default rendering configuration tuning for interactive
plots), plus several rendering defects found while testing on a campus case (19k faces,
9,000 vegetation points) and a denser 800 m neighbourhood case (72k faces).
PyVista axes
linspace: round ticklabels with adaptive decimals, at most 8 per axis.
with the y labels at the shared corner). The exclusion is span-relative because STL
float noise puts nominally flat ground fractionally below zero.
-xprojects diagonally under the default camera, and diagonal tick stubs read as kinks
on the (exactly vertical) z-axis line.
justification visibly offset labels from their ticks, worst on the x axis); x/y
labels hang below their tick tips; the duplicated x/y "0" labels merge into a
single label below the shared origin corner.
ratio so supersampled notebook frames keep their apparent text size.
Rendering quality (PyVista)
support) and scene-scaled SSAO contact shading.
undersampled on any display with OS scaling above 100%.
Ground/building classification (both backends)
z > 0test. STL float noise scattered most ground triangles into the buildingsgroup, painting the ground in the building colour and leaving mismatched halos
around building bases.
Vegetation
plot_vegdraws each vegetation point as an opaque voxel filling its grid cell(stretched z spacings included), replacing size-2, opacity-0.2 dots that were
invisible against the geometry;
colorandopacityare keyword arguments.plot_veg_outline(UDVis method +sim.plot_veg_outlinewrapper): the samevegetation voxels over the outline-style base - the most readable vegetation view
on fine meshes. Reuses the outline scene and vegetation loading via shared helpers
rather than duplicating them.
Wireframes and lines
meshes no longer merge into a solid black mass.
LineSetgains anopacityfield plus optional Plotly-specific width/opacity overrides: Plotly's WebGL
lines rasterize too differently for shared values, so Plotly keeps its original
bold opaque look.
MeshPrimitive.opacity(previouslyPlotly-only).
Plotly
apply its lighting model to
Mesh3dfacecolor arrays, so uniformly colouredmeshes rendered as unshaded silhouettes.
invisible) with outside ticks long enough to keep labels clear of the plotted
field.
API hardening
UDBase.plot_veg/plot_trees/plot_veg_outlineforward keyword arguments tothe visualization facade;
plot_trees(backend=...)previously raisedTypeError.Testing
tools/python/tests/test_udbase_vis.py: 44 tests including 15 new ones (ticklocator, z-tick policy, voxel mesh geometry incl. watertightness, Plotly axis
contract, alias forwarding, plot_veg_outline render path); PyVista render paths
exercised off-screen on both backends.
unittest discoverovertools/python/testsmatches the clean-masterbaseline locally (the only reds are pre-existing Windows-environment View3D
config tests, identical without this change).
widget, the native desktop window, and the browser (Plotly), including a case
without vegetation for the graceful-degradation paths.
Fixes #337
🤖 Generated with [Claude Code]