Localized V2 rewrite for this language is in progress. Showing English-first content for now.
Science Workflow

Graphics and Rendering

Terminal-native scientific visuals plus real raster renders generated by the checked JIT artifact.

Back to Science Hub

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

A software-rasterized triangle with red, green, and blue interpolated corners on a dark background.
Triangle Raster

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
A perspective wireframe cube with red, green, and blue axis lines on a dark background.
Wireframe Cube

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
A 16 by 16 heatmap of uncertainty cells ranging from cool dark squares to bright warm squares.
Uncertainty Field

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
A causal graph with red intervention node X, blue observed nodes M and Y, and a gray latent node U connected by arrows.
Causal DAG

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
A tetrahedron wireframe showing a dim original pose, a bright rotated pose, and connecting guide lines on a dark background.
Quaternion Rotation

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 run output, 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

Octonion Multiplication Table

The crown jewel—a fully colorized 8D algebra visualization where the Fano plane structure becomes immediately visible through color patterns.

06_octonion_color_table.sio
╔══════════════════════════════════════════════════════════════════════════╗
           OCTONION MULTIPLICATION TABLE - Color Edition              
╚══════════════════════════════════════════════════════════════════════════╝

    ×  1    i    j    k    l   il   jl   kl
  ────┼────────────────────────────────────────────────
 11    i    j    k    l   il   jl   kl
 ii   -1    k   -j   il   -l  -kl   jl
 jj   -k   -1    i   jl   kl   -l  -il
 kk    j   -i   -1   kl  -jl   il   -l
 ll  -il  -jl  -kl  -1    i    j    k
ilil    l  -kl   jl  -i   -1   -k    j
jljl   kl    l  -il  -j    k   -1   -i
klkl  -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.

02_fmri_octonion_activation.sio
╔═══════════════════════════════════════════════════╗
     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.

phase3_showcase.sio - Rotating Cube
╔═══════════════════════════════════════════════════╗
          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.

phase5_showcase.sio - Particle Fountain
╔═══════════════════════════════════════════════════╗
       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.

phase5_showcase.sio - Fluid Dynamics
╔═══════════════════════════════════════════════════╗
         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.

phase6_showcase.sio - Bifurcation
╔═══════════════════════════════════════════════════╗
    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 pointperiod-2period-4chaos

Force-Directed Graph Layout

Social network visualization with Fruchterman-Reingold algorithm.

phase7_showcase.sio - Network Graph
╔═══════════════════════════════════════════════════╗
      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.

10_kalman_filter_color.sio
╔═══════════════════════════════════════════════════╗
      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.

08_climate_ensemble_color.sio
╔═══════════════════════════════════════════════════╗
    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

PhaseModulesCapabilities
Phase 1canvas, colors, drawing, textCore primitives, ANSI colors, shapes
Phase 2axes, scatter, line_plot, bar_chart, histogram, heatmap2D plotting
Phase 3projection, wireframe, scatter3d3D visualization
Phase 4input, interactive_plotZoom, pan, mouse/keyboard
Phase 5animation, particle_system, fluid_simAnimation, physics
Phase 6phase_diagram, bifurcation, poincare, streamlinesScientific charts
Phase 7graph, force_directed, tree_layout, graph_renderNetwork 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