Implement bilateral filter by SkRuntimeEffect?

64 views
Skip to first unread message

Jerry Zhuang

unread,
Dec 24, 2020, 10:19:41 PM12/24/20
to skia-discuss
Hi guys,
I'm new to skia,and I'm curious about can I implement bilateral filter by using SkRuntimeEffect?
Thanks

Dave M

unread,
Dec 28, 2021, 9:58:10 PM12/28/21
to skia-discuss

i have same question

Brian Osman

unread,
Dec 29, 2021, 10:02:08 AM12/29/21
to skia-d...@googlegroups.com
Certainly. I grabbed the source code for a color-weighted bilateral filter from https://www.shadertoy.com/view/4dfGDH, then tweaked it very slightly to adjust to SkSL's syntax: https://shaders.skia.org/?id=87f4222b2d153782ed322e4058a67ee00a7f442fceb753169090a4fb6b3e7c10

That has the same behavior as the shadertoy version - you can click and drag the mouse to "wipe" the effect on or off. Note that this particular shader is fairly expensive - the original shadertoy has links to a version with the kernel pre-computed, which is much faster. In any case - it's doing 226 texture samples, so it's always going to be somewhat slow. Additionally, when I tested it locally with the CPU backend, it crashes. I haven't been able to debug that yet - but I'm sure we're hitting some limit while JIT'ing the shader (given the size of the program).

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/8945f97a-a100-47ea-b7c5-f6f43fd16896n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages