trough rendering: 3/4-perspective triangular prism vessel - #6
Merged
Conversation
The 2D outlined funnel was mathematically right but visually bare —
thin stroke, no material, no depth, no rim, no base. It read as a
math diagram, not a vessel. This swap renders each ballot item as
a 3D triangular trough (V cross-section extruded perpendicular into
the page) viewed in 3/4 perspective. Users now see a thing-that-
holds-water — rim, walls, depth, water surface — without any change
to what the math is doing.
Why a prism, not a cone
-----------------------
A cone's volume scales with h³ → that would be cubic voting. A
triangular prism (the V cross-section extruded by a constant depth
D) keeps volume proportional to h² × D. With the math layer treating
D as 1, the QV identity `credits = votes²` is preserved exactly.
The 3D appearance is a rendering decision; the conservation math
is unchanged.
Implementation
--------------
Pure SVG. No Canvas, WebGL, or 3D libraries. Hand-authored paths
with a parallel projection from 3D (x, y, z) to 2D screen:
screen_x = x − z · sin(~18°) // back peeks LEFT of front
screen_y = y − z · sin(~9°) // back peeks UP of front
Yaw ~18° gives a clear right-side panel; pitch ~9° gives a clear
parallelogram for the rim and water surface (no flat lines).
Layered z-order (back to front):
1. Soft drop shadow (Gaussian blur of dark ellipse) + base footing
ellipse — grounds the trough on a surface.
2. Back-face V triangle — faint; peeks above the front rim.
3. Water body — V at the current display level. Drawn behind the
front wall so wall translucency tints the visible water.
4. Water surface — parallelogram from front-edge-of-water to
back-edge-of-water at level h, with a vertical gradient and a
thin lighter stroke along the front edge so it reads as a
liquid plane, not a polygon.
5. Right side panel — quadrilateral with a top-to-bottom gradient
(slightly darker than the front face) for depth.
6. Front face V — semi-translucent fill (water shows through),
stroked outline.
7. Top rim band — outer parallelogram with inner-rim cutout
(even-odd fill) ⇒ visible wall thickness at the rim. One of
the strongest "vessel" cues; the inner rim is parallel-shifted
by `wt` perpendicular to the wall (≈ 4.5 % of trough height).
Interaction, animation, ARIA, prop interface — all unchanged from
the 2D version. The water body and surface both run through the
existing `instantUpdate` / Framer Motion split: during a live hold
they render the rAF-driven `votes` prop frame-for-frame; outside a
hold, transitions get the same 0.18 s cubic-bezier settle as before.
Per-instance SVG ids (filter, gradients) keyed off `useId` so the
six funnels on the page don't collide.
Verified
--------
- Empty trough at 0 votes reads as a 3D vessel with rim, walls,
base, and shadow — no water visible (water polygons collapse to
degenerate paths, still valid for Framer Motion).
- Mid-fill at 4.5 votes / 20 credits: water body fills the apex
pyramid, surface plane parallelogram visible at level h, white
edge highlight along the front, and the right side panel partly
occludes water on the right (depth read).
- Full at the cap (10 votes / 100 credits): water reaches the rim
level, surface plane sits just under the rim band.
- Pool, conservation invariant, hold-to-pour, stream visual,
reduced-motion, keyboard parity — all unaffected.
- 29 tests passing, ESLint clean, typecheck clean, all three build
targets succeed, no console warnings during interaction.
What didn't change
------------------
- All math (`costForVotes`, `maxVotes`, `clampVotesAgainstBudget`,
conservation).
- All interaction (hold-to-pour, continuous values, no integer snap).
- The pool, the pour stream, the reservoir.
- The intro copy, the "How it works" explainer, the framing prompt,
the footer disclaimer, the default ballot.
- The word "funnel" throughout the codebase and UI strings — the
rendered form is funnel-like (V, narrow at the bottom, opening
at the top); we don't need to rename it just because the
cross-section is rectangular instead of circular.
jackhenderson12
added a commit
that referenced
this pull request
May 7, 2026
Revert PR #6: 3D trough rendering
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
The 2D outlined funnel was mathematically right but visually bare — thin stroke, no material, no depth, no rim, no base. It read as a math diagram, not a vessel. This swap renders each ballot item as a 3D triangular trough (V cross-section extruded perpendicular into the page) viewed in 3/4 perspective. Users now see a thing-that-holds-water — rim, walls, depth, water surface — without any change to what the math is doing.
Why a prism, not a cone
A cone's volume scales with h³ → that would be cubic voting. A triangular prism (the V cross-section extruded by a constant depth D) keeps volume proportional to h² × D. With the math layer treating D as 1, the QV identity
credits = votes²is preserved exactly. The 3D appearance is a rendering decision; the conservation math is unchanged.Implementation
Pure SVG. No Canvas, WebGL, or 3D libraries. Hand-authored paths with a parallel projection from 3D (x, y, z) to 2D screen:
Yaw ~18° gives a clear right-side panel; pitch ~9° gives a clear parallelogram for the rim and water surface (no flat lines).
Layered z-order (back to front):
wt≈ 4.5 % of trough height.Per-instance SVG ids (filter, gradients) keyed off
useIdso the six funnels don't collide.What's preserved
costForVotes,maxVotes,clampVotesAgainstBudget, conservation).instantUpdate/ Framer Motion split: during a live hold the water body and surface render the rAF-drivenvotesprop frame-for-frame; outside a hold, transitions get the same 0.18 s cubic-bezier settle as before.Verified
0.0 / 100 credits.tsc -b --noEmitclean, all three build targets succeed (SPA / lib / Web Component), no console warnings during interaction.Files changed
Just one:
src/components/Funnel.tsx. Component prop interface unchanged. Math layer unchanged. Reducer unchanged. PourControl, PourStream, CreditPool, LiquidQV, Intro, Explainer, PageChrome — all unchanged.Visual quick-tour
The screenshots aren't embedded in this PR body (GitHub doesn't accept binary uploads via
gh pr create). To see the new rendering, pull the branch andnpm run dev. From a fresh page:94.3 / 100 credits)Test plan
npm install && npm run devnpm test && npm run lint && npm run typecheck— greennpm run build:all && npm run preview— cleanDon't merge
Per the brief: hold for review.
🤖 Generated with Claude Code