shoreline icon indicating copy to clipboard operation
shoreline copied to clipboard

FR: transparency support

Open noerw opened this issue 3 years ago • 9 comments

The framebuffer does not apply transparency correctly. It seems alpha values other than 0 are ignored?

See this comparison between shoreline (top) and pixelnuke (bottom) with similar inputs:

Screenshot from 2021-01-01 05-11-23 Screenshot from 2021-01-01 05-08-55

Thanks for this amazingly fast toy <3

noerw avatar Jan 01 '21 12:01 noerw

Yes, there is no full transparency support. However, at the time of implementation that was a contious decision to keep performance as high as possible. I could implement full transparency support as an optional feature, that needs to be enabled/disabled at compile time though. Would that be fine with you?

TobleMiner avatar Jan 01 '21 12:01 TobleMiner

Yeah, that sounds perfect! I just looked at the code, it'll be interesting to see the performance difference

noerw avatar Jan 01 '21 12:01 noerw

Please have a look at https://github.com/TobleMiner/shoreline/tree/feature-alpha-blending

I'm not sure whether or not that is waht exactly you are looking for. Please let me know if it's ok or not.

TobleMiner avatar Jan 01 '21 16:01 TobleMiner

I've just updated the branch again. Now transparent colors can also be composed ontop of one another

TobleMiner avatar Jan 01 '21 17:01 TobleMiner

Thanks, that was quick!

Looks good so far. Just a minor thing: There is some flickering going on now on some pixels, when no data is coming in: Peek 2021-01-02 04-53 First thought was that this might be because of -Ofast / -ffast-math, but compiling without this option gives the same results. If you think it's related to specific input data, I can test with other inputs. edit: or is this #2?

Regarding performance: a standard build with SDL frontend peaks at 6.2 Gb/s on my laptop. With ALPHA_BLENDING it peaks at 5.4 Gb/s., so ~12% perf is lost.

noerw avatar Jan 02 '21 04:01 noerw

Cool! The flickering is interesting. Right now I'm not entirely sure where it is coming from. Would you mind providing me with the picture you are using for testing? That could make replicating the issue a lot easier.

I'm pretty sure it is not #2, that should be strictly a performance thing. The issue you are seeing might also be related to the coalescing mechanism though.

TobleMiner avatar Jan 03 '21 12:01 TobleMiner

to reproduce:

git clone https://github.com/speckij/hochwasser -b new-rgbsplit
cd hochwasser
go build .
wget https://nroo.de/pixelflut/pro_aktion.png
(sleep 0.2; echo 'rgbsplit' ) | ./hochwasser -image pro_aktion.png -order shuffle

noerw avatar Jan 03 '21 13:01 noerw

Sorry for the delay. 5a0bcb966801c690d6f6852bc08f7f4bb9d1c3da should address the flickering you were seeing

TobleMiner avatar Jan 05 '21 10:01 TobleMiner

Just came back to this; your last commit fixed the flickering :) Thanks

noerw avatar Apr 25 '21 20:04 noerw