How to prevent blur for creating a glow on layers above it?
-
The blur effect is applied to the entire size of the panel, and affects both the layers underneath the panel (this is expected), but also creates a glow around layers that are on top of it.
Is there any way to prevent the top layers from being effected? I created a minimal snippet to demonstrate this:
HiseSnippet 1694.3oc2X07bSbCEe2jrLDCoSfBSK2To8fYJMwa9.B8igk3DSyzDhmXWnLbHHuqrslrVxrq1.FFlR6MN0oG5s9mACG3Tt0q8Ofdn+IzysGZeZkWuZscBIY3iP2Cdr9Iom98z6o26IUNf6RBC4AFliWsSahg4IspzgIZVrIlxLVYICy2yZMbnfDfTPK1oMNLj3YXZN50k.liOlQ72ec0Ew9XlKIExv3lbpKYUZKpHEsry2P88Kg8HUoszF8bNq3xYE497HfOiZUvnM1cKbCxMvxgMhkg4wV1iJ3AUDXAIzvbrE4dcpzjeelZ72jFRq4SjMrMp.BRAWh66IYrD0nXSpuW4D8Nzvvzpb5tvnpcgyXsF0i1COc2Xx3NPoyPe+vbjrzazLzyVmdEzn2PnjoFkFSQoSYUwMf1Vj1ijOmvZEFXbpigsccpnFqwH+hoUQNLBlXpV3sHkBfF8lQ9EJT3hn4KT3BewD4lHGr4GJPaiCPK5GErb85DWA5qPIyuAQTj2pMmAMxe9zgbd4rSaNUHQTF1tDaviDTFIe8HlqfxY4abgIx8HzD4PvWiopQZPYqh6PBxKBhHRgn5nANJLjhYRQle9BSArCgld5oQk8wcP2hJZhp1jFhJfpxQ1EJjLOBySINondr7mjUFwY2fKHqyxegbOJ234dbNT+cUu9P6Sp6AbeeoTGR2R+2f8Zh4YQspQBtHrq5C5Xx.AiZVOEqc2SQ2Q1UYJzFHmsBiJVuMgsat2Fcsev+91UVBKvR2qtXv3ZSBDTIELWhrMbVU4rMt0RjvsD71fT6YzMLyIh6chtthqhqQ7MndxwKsVAfu2C5cddm63zI8v8BN2m5IZl1afSSBsQyz3B6TyoNPqJzGpES31NBxCDIwDF+X+w4d1+JwoBRKE5LR3jvMRAnhVH0f53HegbCnmBbxrJPYLqqBbRqTOXMc.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pBcMg.qWv0Yb1f3SfxzRg9DmUoLBN.1mHGx8B6C7a2NT60GZonKRFC.8t6SUL5+qeph8+oOHD3Qaq3GXAghmAEaJQucrkuIxq+lXMZgcC3a5pdje4g9iGi.5Mq6CVtlrMx1H9g+k2zsvTELZAoK1z0U5u9YP1mgOmYNDyY1Cwbl6PLm4ODy4RGh4b4CwbVXOmiLS80hfKYq74AfxKqtdso16bY7eTHuwUM
Thanks!
-
@tomekslesicki The blur function has always been a bit finicky to use.
Strangely, it works if you draw outside the layer though.HiseSnippet 1772.3oc2X07bSbCEe2jrLDCoCPgokahzdvLMSh27AeTZG1DmXZl5P7DafxvzAT1U1VSVKY1Ua.CCSo8Fm5z68OCFNvobqW6e.8P+SnmaOz9zpc8p0N.gL7Qn9Ph0OI87u2G58dR0B3tjvPdfg43M50kXXdTq58Xh1kaioLiUW1v7irVCGJHAHEzR85hCCIdFllidEIf43iYD+4ut7RXeLykjAYXbcN0kTk1gJxPq47sTe+JXORCZGsUOuyptbVYtOOB3ynVkL5hc2B2hbUrbYiXYXdnU7nBdPcAVPBMLGaItWu5s42ioV+0ogzM8IxA1F0AAofqv88jLVhZTtM02qVpdGZXXZUKyJLpxJbRq0ndz93YViiEOAJaG51CyQxSuQyQOac5URid6BkL0nzXJJcbq5tAzthrYj74HVqx.mSSLX10ohZsFiblQrJygUvDS2AuEoR.Ln+NJdgRklBsPoRm8RSTXhBfwOTf1FGfVxOJXklMItBzWiR2eKhnLuSWNCFTbxrkLob2YCmNjHpAlKwF7HAkQJ1Lh4JnbVwVmchBODMQAD7o0zaRZQYUw8HAEEAQDoPTSzBGEFRwLoHKtPooA1gPyLyLnZ93dnaPEsQMZSCQkPM3H6RkR2Gg4oD2YuTLRBLPmJbIiWLfh8mbJz4iEY1rp.thp+ENc.wq+rdA36snOsEi30fbePFarxhUqdSzUWuAZopWaiMVYYPf2pzTys.XHisl1KT56mBMoKXj.IEaadj7OoVADmcUtfrNq3YK7vBiW3QEPCNUyl65bR+P.22W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n363RhVJyPAqEYX+dgD0iZjL7Aj7OuxRQPSgCbalcbpE.2UjbuASz9AaWBmRoIGwRlAN9s3hsImxJMiL5JDFIPFx7x5U322quFW287qwstq.nPi.LKrKOjXqK4Ala17MsHhX4WtBJ2pjpWEP8r0KrlBNqNHb5Hmvfw4jzZTsKM+mWVUtrNAzFu0CcAkUZ6xU8LxOjDmXvVeiYvypC+M3.uAqWOXz1X6snsWwCSdnCbOL4G.W4MWWdimxQUG1q.cB6yAjzBVwWjOEM+wo03Ld21bFMmidCBjEnUKRt3mcUgVTHv5MbcRmMH9DnMsLnO2oJkQvAfchrOsE1u1ui7t5u9TKEcQxb.nObephQ+e8SUr2O8Ao.OX6E+DKHU7rnXWI58iu7cQc82E+FcvtA7a6pdje4g9CGi.5MK4AKWSNFYaD+v+5FyNPIia65lWTCswY2uabt86Fme+twE1ua7b62Md986FuvqdixJ5KFAWFWc1.5ro1Jpqgap8dXF+Gn4evZB
-
@ustk Yeah I also wouldn't rely on that function. I added add for a project where I needed blur, but the performance was so subpar that I had to remove it again.
The problem is that the blurring is being done on the CPU which is ridiculously slower than the GPU. There's a long discussion on the JUCE forum about a better blur class, but it's also not satisfyingly good.
-
@Christoph-Hart what about this ? https://github.com/FigBug/Gin
Namely the Stack Blur.
-
@aaronventure spline would be nice too....
-
@Lindon even found mentions of this on the juce forum by Mike from reFX
https://forum.juce.com/t/faster-blur-glassmorphism-ui/43086/7
Spline would be kickass, yeah.
-
@aaronventure I've added the gin stack blur at some point (it's already using this algorithm in the Graphics functions), however it's still ridiculously slow because it has to do graphics operations on a CPU and this is 1970 style hardware usage.
https://forum.juce.com/t/faster-blur-glassmorphism-ui/43086/7
I've went through the thread a few months ago and was close to port it over into HISE (I also sometimes get the urge of making blurry stuff), but I wasn't too convinced that the overhead justifies the performance gain (it's still being calculated on the CPU and this makes it easily a factor 100 slowdown compared to GPU based blur algorithms).
EDIT: this is the module I was talking about:
https://github.com/sudara/melatonin_blur
From revisiting the page, it might be actually worth it trying out how it performs...