Skip to content

[ Bounty ] Convert 2D Bar Graph to 3D Bar Graph with Perspective Projection (fixes #1) - #8

Open
lannerwsf wants to merge 2 commits into
devlup-labs:mainfrom
lannerwsf:feature/3d-bar-visualization
Open

[ Bounty ] Convert 2D Bar Graph to 3D Bar Graph with Perspective Projection (fixes #1)#8
lannerwsf wants to merge 2 commits into
devlup-labs:mainfrom
lannerwsf:feature/3d-bar-visualization

Conversation

@lannerwsf

Copy link
Copy Markdown

Summary

This PR converts the existing 2D Bar Graph visualization into a 3D Bar Graph visualization with perspective projection, addressing Issue #1.

Key Features

  1. 3D Bars: Each bar is a full 3D box (8 vertices, 12 triangles = 6 faces), rendered with depth testing
  2. Perspective Projection: 45° FOV perspective matrix from framebuffer aspect ratio
  3. Orbiting Camera: Automatic orbit around the scene for full 3D viewing
  4. Time on Z-Axis: Last 64 FFT frames stored in history buffer, shifting along negative Z-axis
  5. Age-Based Dimming: Older bars progressively dimmed for depth cue
  6. HSV-Based Coloring: Dynamic color mapping with age-factor

Concept

  • X-axis: frequency bands
  • Y-axis: amplitude of each frequency
  • Z-axis: time evolution

Files Changed

File Change
src/visualizations/BarVisualization3D.h New
src/visualizations/BarVisualization3D.cpp New — full implementation
src/visualizations/vertexShader3D.glsl New — 3D vertex shader with MVP
src/main.cpp Modified — option 5
src/Makefile Modified — added new source

Closes #1

lannerwsf and others added 2 commits May 20, 2026 18:35
Implements the 'Add Audio Variables' feature request (devlup-labs#2):

- Compute band loudness from FFT magnitudes:
  - Bass: 20–250 Hz
  - Mid: 250–4000 Hz
  - Treble: 4000 Hz – Nyquist
- Add EMA-smoothed (attenuated) variants: bassAtt, midAtt, trebleAtt
- Expose all six values through FFTProcessor and AudioProcessor APIs
- Smoothing factor of 0.15 for natural decay response

Reference: projectM implementation pattern for band energy extraction.
…lup-labs#1)

Convert the 2D bar graph into a 3D bar graph visualization with:
- Perspective projection and orbiting camera for depth perception
- X-axis: frequency bands, Y-axis: amplitude, Z-axis: time evolution
- 3D bar boxes (6 faces, 12 triangles per bar) with depth testing
- FFT history buffer stores up to 64 frames along the Z-axis
- Automatic camera orbit for full 3D viewing experience
- Age-based dimming on older bars for depth cue
- New visualization option devlup-labs#5 in main menu
- Dedicated 3D vertex shader with MVP matrix uniforms

Files:
- src/visualizations/BarVisualization3D.h/.cpp
- src/visualizations/vertexShader3D.glsl
- src/main.cpp (added option 5)
- src/Makefile (added new source)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Convert the 2D Bar Graph visualization into 3D Bar Graph visualization.

1 participant