Texture becomes blur and pixelated after many onResume

Started by kkl, September 02, 2014, 03:42:20 PM

Previous topic - Next topic

kkl

Hi egon,

I have this issue where the texture becoming more blur and pixelated each time the live wallpaper resumes from pause. It takes many times till the effect is obvious. The texture is in 512x512, mipmap, and compression enabled ( setTextureCompression(true) ).

Can it be the texture is compressed over and over again till it loses the quality?

EgonOlsen

No. The raw pixel data of a texture remains untouched. Do you have screen shots for comparison?

kkl

I roughly take the same portion of the screen for comparison. But you can see the pixelated area in lost.jpg whereas the other one is fine.


EgonOlsen

That looks strange. More like some diagonal pixel rubbish introduced by something rather than a compression artifact (which it actually can't be, because, as said, raw pixel data remains untouched).
Can you try to reproduce this with a higher frequency texture (i.e. more differences in colors). It's hard to tell anything from "blue with slightly darker blue on top of it"...

kkl

Hi Egon,

I think I found the root cause. I'm translating the texture matrix for that object. When the translation values gets bigger, the texture starts to get pixelated.

The attachment shows the pixelated and fine textures respectively (with distinct colored texture).

Is it common that texture may be get distorted when texture matrix values are too big for the shader to handle?

kkl

is it a good idea to control the limit values of texture matrix? I wanted to check the texture matrix translation if it exceed certain value then reset it back to 0, but it seems like the matrix returns new object of translation in getTranslation() and there is no clear translation method. Is it possible if we can get translation from matrix by object pointing (e.g. getTranslation(SimpleVector)) and clear translation method?

EgonOlsen

I see...it's an accuracy issue of the hardware then. Mobile devices tend to have awful texture accuracy ranging from pretty good (Adreno) to really poor (Tegra). Limiting the translation values sounds like a good idea. I can add the getTranslation(SimpleVector)-method. Instead of a clearTranslation, the setIdentity() should do it, shouldn't it? Or are you rotating the matrix as well?


kkl

Hi egon,

Thanks for the new jar.

So far I'm just translating the matrix, no rotation yet. But it'd be a great feature in the future to clear only translation without affecting the rotation. BTW, if rotation values get bigger, possible that it will distort the texture too? and may be even object rotation matrix and translation? Should we limit all the values as well?

EgonOlsen

No, rotations shouldn't have this effect. And object transformations are no issue as long as you don't reach the borders of floats.

kkl

It should be alright then. Thanks alot for your help, egon.

kkl

Hi egon,

I realized some parts of my code are using scalarMul for texture matrix. I think I might need clearTranslation instead. Is it ok if you could include the method in jpct-ae? In addition, the jpct-ae.jar does not include the virtualizer performance fix. Could you tag along the fix with the jar as well? Thank you so much and sry for any inconvenience. 

EgonOlsen


kkl


EgonOlsen

Nothing has changed regarding that change in this jar. Whatever i did back then, it's still in this jar too.