Inquiry about Animated Blurring Effects and Optimization Techniques in Skia

38 views
Skip to first unread message

Syuhai Chen

unread,
Jul 3, 2024, 8:33:57 AMJul 3
to skia-discuss

Hi everyone,

I hope this message finds you well. I'm currently working on a project that involves applying animated blurring effects using Skia, and I'm curious about the underlying techniques and optimizations Skia uses to achieve smooth and efficient animations.

Specifically, I have the following questions:

  1. Animated Blurring Techniques:

    • What are the recommended methods for implementing animated blur effects in Skia?
    • Are there specific examples or best practices for achieving smooth transitions during blur animations?
  2. Optimization Tricks:

    • What optimization strategies does Skia employ to speed up the rendering of animated blur effects?
    • Are there particular algorithms or hardware acceleration techniques that Skia leverages to enhance performance during animations?
  3. Performance Considerations:

    • How does Skia handle resource management and caching when dealing with frequent updates to blurred images?
    • Are there any guidelines or common pitfalls to avoid to maintain high performance and responsiveness in animations?

Any insights, code examples, or references to relevant documentation would be greatly appreciated. Thank you for your time and assistance!

Best regards,

Syuhai

John Stiles

unread,
Jul 3, 2024, 9:11:24 AMJul 3
to skia-d...@googlegroups.com
Skia isn't an animation system; it renders 2D graphics.

Users can achieve animated effects by drawing their own 2D shapes on a frame-by-frame basis, and presenting the drawn frames, but Skia natively doesn't think in terms of objects which statically exist or change over time. It just draws individual shapes, and the user is responsible for managing the scene graph. 


--
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/07b7e87b-97d8-47e5-b9d1-a0d98072cffcn%40googlegroups.com.

Ian Waters

unread,
Jul 3, 2024, 10:08:17 AMJul 3
to skia-discuss
I’ll add Skia’s built in blur really struggles when animated (especially on thin shapes), as shown here https://fiddle.skia.org/c/49d573ac77c3145bd45b7bb9d8d3fde6 

So if you can, roll your own 2 pass blur with SkSL and you’ll have something much more stable (though less performant).

Syuhai Chen

unread,
Jul 3, 2024, 10:21:42 AMJul 3
to skia-discuss
Hi John and Water, Thank you both for your insightful responses. They are really helpful!

Best regards, Syuhai

John Stiles

unread,
Jul 3, 2024, 10:29:46 AMJul 3
to skia-d...@googlegroups.com
For what it's worth, you can't necessarily trust Fiddle's GPU view for tiny details like this. The "GPU" view isn't a perfect pixel match of what a real GPU would do, because the servers running Fiddle don't have real GPUs. They use Swiftshader instead, and this can lead to subtle differences. This is particularly noticeable for antialiasing, where Swiftshader sometimes shows unantialiased results but a real GPU works properly.

--
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.
Reply all
Reply to author
Forward
0 new messages