netpyoung / unity.webp

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

Normal Webp extinsion not working!!! #7

Closed Turkm closed 6 years ago

Turkm commented 6 years ago

hi, thank you for sharing i downloaded your example and worked like charm and i noticed the images in your example with (byte) extension, but when i converted some images (cwebp input.png -q 80 -o output.webp), it dosnt recognize these files when i replaced them with yours in the example, SO WHAT THE RIGHT WAY TO CONVERT THE IMAGES???

netpyoung commented 6 years ago

Could i get your cwebp version and input.png, output.webp ? so I will test later.

MahmoudYaser1 commented 6 years ago

i am having the same issue .....

netpyoung commented 6 years ago

currently unity just few extensions support for TextAsset

https://docs.unity3d.com/Manual/class-TextAsset.html

@Turkm @dekemega

Is that solving your problem?

Turkm commented 6 years ago

hi, im using the one from downloads repository: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html the one i used is: libwebp-1.0.0-windows-x64 and the command for converting: cwebp input.png -q 80 -o output.webp and this the testing image: anne_boleyn_climbing_rose_by_lilipilyspirit-d4zfyhk

sorry pushed the wrong button so i reopen it

Turkm commented 6 years ago

@netpyoung, sorry i didnt get what the relationship with text asset:

For example put a jpeg file into the Resources folder and change the extension to .bytes, then use the following script code to read the data at runtime:

//Load texture from disk TextAsset bindata= Resources.Load("Texture") as TextAsset; Texture2D tex = new Texture2D(1,1); tex.LoadImage(bindata.bytes);

where is converting to webp files type and the compression thing, or did i mess something?

netpyoung commented 6 years ago

I tested from your image. so I got follow error

UnityException: LoadRawTextureData: not enough data provided (will result in overread).
UnityEngine.Texture2D.LoadRawTextureData (System.Byte[] data) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/TextureBindings.gen.cs:380)
WebP.Texture2DExt.CreateTexture2DFromWebP (System.Byte[] lData, System.Boolean lMipmaps, System.Boolean lLinear, WebP.Error& lError, WebP.Texture2DExt+ScalingFunction scalingFunction) (at Assets/unity.webp/Texture2DExt.cs:195)
Example.LoadWebp (UnityEngine.UI.RawImage image) (at Assets/example/Example.cs:22)
Example.Start () (at Assets/example/Example.cs:14)
UnityException: LoadRawTextureData: not enough data provided (will result in overread).

and I try turn off mimap on that image, like that so I can see image. Could you try false on mipmaps

https://github.com/netpyoung/unity.webp/blob/master/unity_project/Assets/example/Example.cs#L22

Texture2D texture = Texture2DExt.CreateTexture2DFromWebP(bytes, lMipmaps: false, lLinear: true, lError: out lError);
Turkm commented 6 years ago

thank you, now its work perfectly 💯