r/FastLED • u/RubiCubix • Nov 21 '23
Discussion FastLED with native support for subpixel positioning
Hi,
I have been experimenting a bit with subpixel positioning on my Teensy 4.1 with a 64x64 led matrix after being inspired by this code by sutaburosu.
https://www.reddit.com/r/FastLED/comments/h7s96r/subpixel_positioning_wu_pixels/
So far I have only used it for some effects in particular and it works realy well. It gives a very nice smooth transition effect.
It would have been nice if this was natively supported by the FastLED library where you for instance could set the size of the "virtual" resolution as a parameter in the library so that the resolution that you work with in the code is higher in general.
So if I have a 64x64 LED Matrix I can configure the virtual resolution to be 10 times larger so that the virtual drawing area is 640x640.
By doing that you get 10 fractions between each pixel.
Are there any similar solutions already existing? Is there anything that prevents this from being made, some difficulties that I haven't thought about?
View all comments
2
u/RubiCubix Nov 22 '23 edited Nov 22 '23
Thanks for your quick and informative responses . It makes perfect sense when you lay it out like that. It's much more efficient to handle this for each particular graphics primitive then the whole drawing area. I have some programming experience but I am quite new to Teensy controllers and controlling rgbs but I find it very interesting and amusing to work with.
As you mention, FastLED does not provide any graphics primitives so maybe it would be more relevant to have this implemented in any of the libraries that provides these such as FastLED-GFX or similar. Maybe it could be relevant for the LEDSprites library by AaronLiddiment as well.
Currently I have a simple application with different 2D primitives moving around and I want to achieve smoother movements. What I have in mind is modified drawing methods for these primitives that takes for instance float values or maybe scaled integer values and then these modified drawing methods does the math to calculate what to write to the Frame-buffer.
I'll see what I can come up with for this particular application.
Thank you for informing me of the requirement to use gamma correction to properly handle supersampling. I'll look into that if I get time. And thank you for the examples, I am sure they will give me some inspiration.