projectM-visualizer / projectm

projectM - Cross-platform Music Visualization Library. Open-source and Milkdrop-compatible.
https://discord.gg/mMrxAqaa3W
GNU Lesser General Public License v2.1
3.22k stars 364 forks source link

Improve line rendering on higher resolutions #682

Open kblaschke opened 1 year ago

kblaschke commented 1 year ago

Currently, projectM implements the exact same line rendering technique as Milkdrop. It renders either a single, 1px-wide line or four 1px-wide lines in a 2x2 raster for thick/bold lines. There are a few issues with the current implementation, from which Milkdrop also suffers:

Ideally, line width should scale smoothly with the rendering resolution, e.g. 1px width (or 2px for thick lines) at 1000px. such lines would then render 4px/8px wide on 4K resolutions, covering about the same percentage of image pixels overall.

One feasible approach would be implementing a technique suggested by this article, which will also work fine for OpenGL and WebGL. This will also take care of line joints and end caps to look nice, e.g. shapes can use miter joints while waveforms should ideally be rendered with round joints and end caps.