Graphics and Rendering
Sounio currently has two real graphics families in this repo snapshot:
terminal-native scientific displays under examples/graphics/ and software-rasterized image output under examples/render/.
The raster previews below are generated from the exact stdout of the checked JIT artifact, then committed as SVG assets for the website.
This page now ships five real raster previews rather than two isolated samples.
Real Raster Output
This example is a real barycentric rasterizer. The public page image is generated from the compiler output, not a hand-drawn mockup.
Source: examples/render/triangle_basic.sio
artifacts/omega/souc-bin/souc-linux-x86_64-jit run examples/render/triangle_basic.sio > triangle_basic.ppm This example projects a rotated cube, shades edges by depth, and emits a portable PPM frame directly from Sounio code.
Source: examples/render/cube_wireframe.sio
artifacts/omega/souc-bin/souc-linux-x86_64-jit run examples/render/cube_wireframe.sio > cube_wireframe.ppm This preview turns type-directed uncertainty into a real epistemic field: value runs across x, epsilon runs across y, and brightness falls as uncertainty rises.
Source: examples/render/uncertainty_field.sio
artifacts/omega/souc-bin/souc-linux-x86_64-jit run examples/render/uncertainty_field.sio > uncertainty_field.ppm This render encodes a front-door style diagram directly in pixels, including do(X)-style intervention coloring and an explicit latent confounder.
Source: examples/render/causal_dag.sio
artifacts/omega/souc-bin/souc-linux-x86_64-jit run examples/render/causal_dag.sio > causal_dag.ppm This scene rotates a tetrahedron with quaternion math, projects both poses into screen space, and overlays correspondence lines between original and rotated vertices.
Source: examples/render/quaternion_rotation.sio
artifacts/omega/souc-bin/souc-linux-x86_64-jit run examples/render/quaternion_rotation.sio > quaternion_rotation.ppm Why This Graphics Stack?
- Real compiler output: The raster section above is generated from checked
souc runoutput, not screenshots - Portable output formats: Terminal demos use Unicode/ANSI; raster demos emit plain PPM
- No windowing dependency: No X11, OpenGL, or GUI toolkit is required for the current examples
- SSH-friendly: Terminal and file-based rendering both work on remote systems
Terminal Gallery
Octonion Multiplication Table
The crown jewel—a fully colorized 8D algebra visualization where the Fano plane structure becomes immediately visible through color patterns.
╔══════════════════════════════════════════════════════════════════════════╗ ║ OCTONION MULTIPLICATION TABLE - Color Edition ║ ╚══════════════════════════════════════════════════════════════════════════╝ × │ 1 i j k l il jl kl ────┼──────────────────────────────────────────────── 1 │ 1 i j k l il jl kl i │ i -1 k -j il -l -kl jl j │ j -k -1 i jl kl -l -il k │ k j -i -1 kl -jl il -l l │ l -il -jl -kl -1 i j k il │ il l -kl jl -i -1 -k j jl │ jl kl l -il -j k -1 -i kl │ kl -jl il l -k -j i -1 Legend: 1=real ijk=quaternion liljlkl=octonion dim=negative
fMRI Brain Activation Heatmap
32×32 brain slice visualization with gradient intensity using Unicode block characters.
╔═══════════════════════════════════════════════════╗ ║ fMRI BRAIN ACTIVATION - Slice z=32 ║ ╚═══════════════════════════════════════════════════╝ Anterior ░░░░░░░░░░░░░░░░░░░ ░░░░░░▒▒▒▒▒▒▒▒░░░░░░░░ ░░░░▒▒▒████████▒▒▒░░░░ ░░░▒▒████████████████▒▒░░░ ░░░▒▒████████████████████▒▒░░░ L ░░▒▒███████░░░░███████▒▒░░ R ░░▒▒███████░░░░░░███████▒▒░░ ░░▒▒████████░░████████▒▒░░ ░░░▒▒████████████████▒▒░░░ ░░░░▒▒▒████████▒▒▒░░░░ ░░░░░░▒▒▒▒▒▒▒▒░░░░░░░░ ░░░░░░░░░░░░░░░░░░░ Posterior Intensity: ░=0.0 ▒=0.3 █=0.6 █=1.0 Regions: Visual Motor Frontal
3D Wireframe Cube
Rotating cube with isometric projection and axis indicators.
╔═══════════════════════════════════════════════════╗ ║ 3D WIREFRAME CUBE - Frame 42 ║ ╚═══════════════════════════════════════════════════╝ Y │ ┌───────────┐ ╱│ ╱│ ╱ │ ╱ │ ╱ │ ╱ │ ┌───────────┐ │ │ │ │ │ │ └───────│───┘ │ ╱ │ ╱ │ ╱ │ ╱ │╱ │╱ └───────────┘──────X ╱ Z Projection: Isometric (30°) Axes: X=red Y=green Z=blue
Particle System Animation
Physics-based particle fountain with gravity and drag forces.
╔═══════════════════════════════════════════════════╗ ║ PARTICLE FOUNTAIN - Frame 120 ║ ╚═══════════════════════════════════════════════════╝ ★ ★ ★ · · · ★ ★ · · · ○ · · ○ · · ○ ○ ○ ○ · │ · · │ · · │ · ════════════════════█════════════════════ Particles: 847 active Physics: gravity=0.1, drag=0.99, wind=0.02 Lifetime: ★=new ·=mid ·=old
Fluid Dynamics (Navier-Stokes)
Smoke simulation based on Jos Stam’s “Stable Fluids” algorithm.
╔═══════════════════════════════════════════════════╗ ║ FLUID DYNAMICS - Smoke Rising ║ ╚═══════════════════════════════════════════════════╝ ░░░░░░ ░░░░▒▒░░░░ ░░▒▒▓▓▒▒░░░░ ░░░▒▒██▓▓▒▒░░░░ ░░░░▒▒▓▓██▓▓▒▒░░░░░ ░░▒▒▓▓████▓▓▒▒░░ ░░▒▒████▒▒░░ ▒▒████▒▒ ▓▓██▓▓ ████ ████ ▓▓▓▓ ░██░ ▀▀ ═══════════════════════════════════════════ Algorithm: Stable Fluids (Stam 1999) Grid: 64×64, viscosity=0.0001
Bifurcation Diagram
Logistic map showing period-doubling cascade to chaos.
╔═══════════════════════════════════════════════════╗ ║ LOGISTIC MAP BIFURCATION - Period Doubling ║ ╚═══════════════════════════════════════════════════╝ x↑ 1│ ░░░░░░░░░░░░ │ ░░▒▒▒▒▒▒▒▒░░ │ ░░▒▒████████▒▒ │ ▒▒▒▒████████▒▒░ │ ▒▒▒▒ ████████ │ ▒▒▒▒ ████████ │ ▒▒▒▒ ██ ██ │ ░░░ █ █ │ ░░░░ │ ░░░░ │ ░░░░ 0│░░░░░ └──────────────────────────────────────────────→r 2.5 3.0 3.5 4.0 x_{n+1} = r × x_n × (1 - x_n) Shows: fixed point → period-2 → period-4 → chaos
Force-Directed Graph Layout
Social network visualization with Fruchterman-Reingold algorithm.
╔═══════════════════════════════════════════════════╗ ║ FORCE-DIRECTED GRAPH - Social Network ║ ╚═══════════════════════════════════════════════════╝ (Bob)─────────(Eve) │╲ ╱│ │ ╲ ╱ │ │ ╲ ╱ │ │ ╲ ╱ │ │ ╲ ╱ │ │ ╲ ╱ │ │ ╲ ╱ │ (Alice)───(Carol) │ ╱ ╲ │ │ ╱ ╲ │ │ ╱ ╲ │ │ ╱ ╲ │ │ ╱ ╲ │ │ ╱ ╲ │ │╱ ╲│ (Dave)─────────(Frank) Nodes: 6 Edges: 12 Algorithm: Fruchterman-Reingold Temperature: 0.05 (converged)
Kalman Filter Uncertainty
Sequential Bayesian belief updates with color-coded confidence levels.
╔═══════════════════════════════════════════════════╗ ║ KALMAN FILTER - Sensor Fusion ║ ╚═══════════════════════════════════════════════════╝ Uncertainty Reduction Through Sensor Fusion: Prior (σ=10.0m): ████████████████████████████████████████ HIGH After GPS (σ=4.5m): ██████████████████ MEDIUM After IMU (σ=0.5m): ██ LOW After Lidar (σ=0.1m): ▏ VERY LOW Precision Growth (1/σ²): Prior: ▏ +GPS: █ +IMU: ████████ +Lidar: ████████████████████████████████ Total uncertainty reduction: 99% Precision gain: 10,405×
Climate Ensemble Projections
Multi-model climate projections with structural uncertainty visualization.
╔═══════════════════════════════════════════════════╗ ║ CMIP6 CLIMATE PROJECTIONS - SSP2-4.5 ║ ╚═══════════════════════════════════════════════════╝ Global Mean Temperature Change (2100 vs 1850-1900): GFDL-ESM4: ██████████████████│ 1.8°C ± 0.2 HadGEM3: █████████████████████│ 2.1°C ± 0.3 MIROC6: ███████████████████│ 1.9°C ± 0.25 IPSL-CM6A: ███████████████████████│ 2.3°C ± 0.4 MPI-ESM: ████████████████████│ 2.0°C ± 0.1 ├─────────────────────────────────┤ 0 1.5°C 3.0°C Ensemble Mean: ████████████████████│ 2.02°C ± 0.18 ⚠ Paris 1.5°C target: 12% probability of staying below ⚠ Paris 2.0°C target: 47% probability of staying below
Running the Examples
SOUC_BIN=artifacts/omega/souc-bin/souc-linux-x86_64-jit
# Raster renders (PPM on stdout)
"$SOUC_BIN" run examples/render/triangle_basic.sio > triangle_basic.ppm
"$SOUC_BIN" run examples/render/cube_wireframe.sio > cube_wireframe.ppm
# Scientific visualizations
"$SOUC_BIN" run examples/visual/06_octonion_color_table.sio
"$SOUC_BIN" run examples/visual/10_kalman_filter_color.sio
"$SOUC_BIN" run examples/visual/12_animated_diffusion.sio
# Graphics library demos
"$SOUC_BIN" run examples/graphics/demos/phase3_showcase.sio # 3D
"$SOUC_BIN" run examples/graphics/demos/phase5_showcase.sio # Animation
"$SOUC_BIN" run examples/graphics/demos/phase7_showcase.sio # Networks
# Refresh the website raster previews from exact compiler output
npm --prefix website run generate:render-assets
Library Structure
| Phase | Modules | Capabilities |
|---|---|---|
| Phase 1 | canvas, colors, drawing, text | Core primitives, ANSI colors, shapes |
| Phase 2 | axes, scatter, line_plot, bar_chart, histogram, heatmap | 2D plotting |
| Phase 3 | projection, wireframe, scatter3d | 3D visualization |
| Phase 4 | input, interactive_plot | Zoom, pan, mouse/keyboard |
| Phase 5 | animation, particle_system, fluid_sim | Animation, physics |
| Phase 6 | phase_diagram, bifurcation, poincare, streamlines | Scientific charts |
| Phase 7 | graph, force_directed, tree_layout, graph_render | Network visualization |
Get Started
# Run one of the phase showcases
artifacts/omega/souc-bin/souc-linux-x86_64-jit run examples/graphics/demos/phase1_showcase.sio