netpyoung / unity.webp

:art: WebP made easy for Unity3d
https://netpyoung.github.io/unity.webp/
MIT License
237 stars 28 forks source link

Broken examples for animated webp #56

Closed Razhagal closed 8 months ago

Razhagal commented 1 year ago

Hello, We've been using the plugin for static webp images for a while now and it works great but we want to expand to using animated ones with as little overhead as possible. There are few examples for animated webp images but 2 of them are broken. For instance "example3.wip" with 3 implementations of animations only 1 works correctly. Now I know it says "wip" but its been a while now. First sample flips the texture of every frame so it looks correct but this is terrible for performance if you have to do it for multiple webp images at time. Second sample uses WebPDecoderOptions.flip but the frames get a bit blurred and it doesn't look good. Not sure what is wrong with it. Third sample uses entirely different approach using the WebPIterator to get each frames but it is by far the most broken example. It seems each frame has different dimensions and possibly missing data because the finished textures are missing parts of them. Will attach a screen in the end. I tried doing some research on that and tried to implement my own solution based on the WebPIterator and source code tips but the end result is the same as sample 3. It seems the whole approach with it doesn't work correctly and I'm not sure if I'm missing something.

On the following screen are Examples 1, 2 and 3 starting from top left to bottom right. I know that Example 1 works correctly but having to manually flip each frame of an image is not a good solution when aiming for performance and any help how to fix/make the other two examples work correctly will be greatly appreciated.

Screenshot 2023-02-03 173154

netpyoung commented 11 months ago

that scene is test scene. 1, 2, 3 also are result of test.

as you said 1 is work well but performance issue It can eazy to solve by flip shader. There is some option on webp api so I tried some options on 2, 3 but It doesn't work well. so I just put it on.

netpyoung commented 8 months ago