netpyoung / unity.webp

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

Animated WebP parse error on MacOS Editor and Android #18

Closed shunia closed 4 years ago

shunia commented 4 years ago

Using the same code as example2 shows to parse the webp bytes, when running, errors occur like this:

Plugins: Couldn't open Assets/unity.webp/Plugins/x64/webpdemux.bundle, error: 
dlopen(Assets/unity.webp/Plugins/x64/webpdemux.bundle, 2): 
Library not loaded: /Users/pyoung/deleteme/unity.webp/libwebp/.lib/lib/libwebp.7.dylib
  Referenced from: /Users/huangqingfeng/Documents/code/skillz/unity/Assets/unity.webp/Plugins/x64/webpdemux.bundle
  Reason: image not found

Though I find these dylib files under project's lib folder, how can I link them correctly to the .bundle file?

Great job and please keep up the working, but please help with this! Thanks a lot!

netpyoung commented 4 years ago

Thank you for your feedback.

I didn't check carefully. Sorry.. Anyway I think it is caused by miss leading load path on macOs. It seems can be change using install_name_tool.

But I don't have mac machine now.. So Could you try fix that?

Or there is buildscript.

If you have rake command, type rake update_library_macos It build webp library.

shunia commented 4 years ago

Thanks for your reply.

Yes, I build the whole macOS library as you did in the Rakefile and it works (Though I removed the --prefix config for my own convenience, and have some rename work to do), but I don't know if it will work on other machine.

But then I caught by some new problems:

  1. The animated webp images are rendered upside down (I used the same code copied from example2, and I didn't check those webp images without animation), I tried many files include the one you provided and all renders the same, so I have to set images' scaleY into -1 to make them render correct, I might go deep in this problem later to check if it's my own problem;
  2. When building for Android application, unity fails to build with errors as some of the Android library files are conflicted with assembly files in the x64 folder, so I deleted the conflicted ones from the x64 folder (the dlls which are set for the Android platform, so only one dll for linux left);
  3. After doing that, builds passed, but caught Android runtime error shows DllNotFoundException: webpdemux, without detailed information to dive into. Though I checked that all so files under unity.webp/Plugins/Android folder are correctly recognized by Unity with different cpu architecture;

So, the third problem stuck me from going on and I'm coming for help, any suggestions?

shunia commented 4 years ago

Android runtime errors:

D/Unity: Unable to lookup library path for 'webpdemux', native render plugin support disabled.
E/Unity: Unable to find webpdemux
E/Unity: DllNotFoundException: webpdemux
        at (wrapper managed-to-native) WebP.Extern.libwebpdemux.WebPAnimDecoderOptionsInitInternal(WebP.Extern.WebPAnimDecoderOptions&,int)
      at WebP.Extern.libwebpdemux.WebPAnimDecoderOptionsInit (WebP.Extern.WebPAnimDecoderOptions& data) [0x00001] in /Users/huangqingfeng/Documents/code/skillz/unity/Assets/Plugins/unity.webp/libwebpdemux.cs:73 

So library file inside Unity: image

netpyoung commented 4 years ago

I don't know if it will work on other machine. Yes it will not be able to other machine.. It needs to change find path.

  1. Um. I didn't know well that but could you upload your image for testing?
  2. Oh I will check that.
  3. That's interesting, I will try to build my machine as soon as I back to home

On Fri, 13 Mar 2020, 13:23 shunia, notifications@github.com wrote:

Android runtime errors:

D/Unity: Unable to lookup library path for 'webpdemux', native render plugin support disabled. E/Unity: Unable to find webpdemux E/Unity: DllNotFoundException: webpdemux at (wrapper managed-to-native) WebP.Extern.libwebpdemux.WebPAnimDecoderOptionsInitInternal(WebP.Extern.WebPAnimDecoderOptions&,int) at WebP.Extern.libwebpdemux.WebPAnimDecoderOptionsInit (WebP.Extern.WebPAnimDecoderOptions& data) [0x00001] in /Users/huangqingfeng/Documents/code/skillz/unity/Assets/Plugins/unity.webp/libwebpdemux.cs:73

So library file inside Unity: [image: image] https://user-images.githubusercontent.com/779430/76589569-70453300-6525-11ea-9b78-720b5fb54189.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/netpyoung/unity.webp/issues/18#issuecomment-598541274, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACR2EO6HYSGTVBTGK6SG4TRHGYNRANCNFSM4LGGCSGA .

shunia commented 4 years ago

Since most of them are project assets and might have copyright issues, I uploaded only one file that looks not so copyright related, sorry for that.

test.webp.zip

Debug info of this file:

Debug.LogWarning($"{anim_info.frame_count} {anim_info.canvas_width}/{anim_info.canvas_height}");

output:
236 200/200
shunia commented 4 years ago

Update: WebP files without animation renders correctly, no upside down.

netpyoung commented 4 years ago

@shunia

And I added some code to flip y axis. Could you check that?

shunia commented 4 years ago

It renders correctly now!

shunia commented 4 years ago

But still got no lucky on Android, please help for this!

shunia commented 4 years ago

I'm gonna close this one because only one problem left to resolve and want to focus on it, so I will create a new one!