# Black areas/flickering in my Android app (solved)

**URL:** <https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781>\
**Category:** Questions\
**Created:** [April 25, 2022, 4:42pm UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781 "2022-04-25T16:42:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon95708182](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon95708182](https://forum.defold.com/u/anon95708182)\
**Post date:** [April 25, 2022, 4:42pm UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/1 "2022-04-25T16:42:02Z")

</div>

I am in the process of testing my 3D app on various devices and with bundles of various compression levels.  
Everything runs fine and smoothly on Windows, Linux. In the Android Studio Emulator, I tested with several devices and several API levels, everything is fine.  
The app runs without stuttering as well on my old Samsung Galaxy Tab S 700, but I get black flickering and black areas like this one:

 ![blackstuff](https://forum-defold-uploads.b-cdn.net/original/3X/0/6/061529a21896baae2e741a76dac5731df5a14f15.png)  
Logcat reports no warnings or errors.  
Has anyone here experienced a similar issue?  
Sorry, forgot to add:  
both the frames and the skirting boards in the image are a few centimetres away from the walls.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2022, 6:36am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/2 "2022-04-26T06:36:31Z")

</div>

Do you get any info in the logcat (the Android logs)?

---

<div class="post-metadata">

**Author:** ![anon95708182](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon95708182](https://forum.defold.com/u/anon95708182)\
**Post date:** [April 26, 2022, 7:04am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/3 "2022-04-26T07:04:16Z")

</div>

Hello @Mathias_Westerdahl, thank you for your reply.  
No, logcat seems fine:  
Errors:

```lua
2022-04-26 08:47:25.569 9899-9899/? E/Zygote: v2
2022-04-26 08:47:25.574 9899-9899/? W/SELinux: Function: selinux_compare_spd_ram, index[1], priority [2], priority version is VE=SEPF_SECMOBILE_6.0.1_0035
2022-04-26 08:47:25.574 9899-9899/? W/SELinux: SELinux: seapp_context_lookup: seinfo=default, level=s0:c512,c768, pkgname=com.example.todo 
2022-04-26 08:47:25.784 9899-9899/com.example.todo W/ActivityThread: Application com.example.todo can be debugged on port 8100...
2022-04-26 08:47:25.854 9899-9899/com.example.todo W/ResourceType: Failure getting entry for 0x01080a97 (t=7 e=2711) (error -75)
2022-04-26 08:47:26.059 9899-9917/com.example.todo E/defold: ERROR:DLIB: ../src/dlib/socket.cpp( 289 ): SOCKET: Unknown result code 92
2022-04-26 08:47:26.064 9899-9917/com.example.todo E/defold: ERROR:DLIB: ../src/dlib/socket.cpp( 289 ): SOCKET: Unknown result code 92
2022-04-26 08:47:26.064 9899-9917/com.example.todo E/defold: ERROR:DLIB: ../src/dlib/socket.cpp( 289 ): SOCKET: Unknown result code 92
2022-04-26 08:47:26.064 9899-9917/com.example.todo E/defold: ERROR:DLIB: ../src/dlib/socket.cpp( 289 ): SOCKET: Unknown result code 92
2022-04-26 08:47:26.064 9899-9917/com.example.todo E/defold: ERROR:DLIB: Unable to create socket for ssdp
2022-04-26 08:47:26.064 9899-9917/com.example.todo W/defold: WARNING:ENGINE: Unable to create ssdp service (-1)
2022-04-26 08:47:27.889 9899-9917/com.example.todo E/defold.sound: App is missing the READ_PHONE_STATE permission. Audio will continue while phone call is active.

```

Info adds transcoding info like this one here:

```lua
2022-04-26 08:47:46.339 9899-9917/com.example.todo I/defold: INFO:GRAPHICS: Transcoding: /assets/uvs/bildportrait.texturec from 12 to 0 (TEXTURE_FORMAT_RGB_ETC1 -> cTFETC1_RGB)

```

Apart from the above, Verbose/Debug report input events:

```lua
2022-04-26 08:52:41.999 9899-9915/com.example.todo V/threaded_app: New input event: type=2

```

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2022, 7:07am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/4 "2022-04-26T07:07:40Z")

</div>

Hmm, it’s already `TEXTURE_FORMAT_RGB_ETC1` when it’s compressed?  
What do you compress the texture to in your texture profile?

I suggest using `BASIS_UASTC` as the texture compression.

---

<div class="post-metadata">

**Author:** ![anon95708182](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon95708182](https://forum.defold.com/u/anon95708182)\
**Post date:** [April 26, 2022, 7:12am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/5 "2022-04-26T07:12:11Z")

</div>

I get the flickering with all sorts of compression levels. Give me a sec, I’ll install the basis\_uastc bundle and get the logs.

---

<div class="post-metadata">

**Author:** ![anon95708182](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon95708182](https://forum.defold.com/u/anon95708182)\
**Post date:** [April 26, 2022, 8:19am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/6 "2022-04-26T08:19:12Z")

</div>

Right, I am back. Took a bit, I had deleted the bundles I made yesterday 🙄  
I installed a basis\_uastc bundle and then tried a default one.  
Logcat does not complain. Error is the same as above, the transcoding bits are gone and input events are reported.  
I think, the transcoding came from the fact that I forgot to remove the build folder after bundling with etc1 when I bundled right away again with basis\_uastc.  
Anyway:  
these are the settings I used:

 ![Screenshot 2022-04-26 at 09.28.25](https://forum-defold-uploads.b-cdn.net/original/3X/5/5/55c7ef45c6f926fc127524ead84187592eb9ddf5.png)  
 ![Screenshot 2022-04-26 at 09.30.20](https://forum-defold-uploads.b-cdn.net/original/3X/d/1/d17013c2d6c0ab3d38b9d4b7ba07cf3d5fc1a4f7.png)  
for the test with basis:  
 ![Screenshot 2022-04-26 at 09.18.49](https://forum-defold-uploads.b-cdn.net/original/3X/d/2/d265522ca422fd05c72b7d163985b16b83dfd7e9.png)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2022, 8:24am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/7 "2022-04-26T08:24:40Z")

</div>

And it works if you don’t use texture compression?

What size is the atlas in question?

---

<div class="post-metadata">

**Author:** ![anon95708182](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon95708182](https://forum.defold.com/u/anon95708182)\
**Post date:** [April 26, 2022, 8:31am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/8 "2022-04-26T08:31:33Z")

</div>

Sadly, same situation with a default bundle.  
There is only one atlas with a tiny image (320x320 px) used as a background for a gui box node.  
The rest of the images are uvs that are added as a texture to my models:

 ![Screenshot 2022-04-26 at 10.27.15](https://forum-defold-uploads.b-cdn.net/original/3X/3/5/35073578c8e64e55b8ff8f93c94a271eef381efd.png)

 ![Screenshot 2022-04-26 at 10.28.19](https://forum-defold-uploads.b-cdn.net/original/3X/d/f/df5a41337913af0ea27dc4f6c76e8bf0143630e1.png)

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2022, 8:46am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/9 "2022-04-26T08:46:51Z")

</div>

Ok, so the model uses a .png directly.  
What format is that .png? Indexed? RGB?  
What size is it?

---

<div class="post-metadata">

**Author:** ![anon95708182](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon95708182](https://forum.defold.com/u/anon95708182)\
**Post date:** [April 26, 2022, 8:52am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/10 "2022-04-26T08:52:40Z")

</div>

I consulted the GIMP:

 ![Screenshot 2022-04-26 at 10.48.41](https://forum-defold-uploads.b-cdn.net/original/3X/2/5/25fde1d2de4b4494d0000e2fcda1d8ead920be19.png)  
The images are all of the same size, 1024x1024, rgb, 8 bit, png.

> [@Mathias\_Westerdahl](#):
>
> Ok, so the model uses a .png directly.

Ah, so it could use an atlas as well?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2022, 8:54am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/11 "2022-04-26T08:54:50Z")

</div>

> [@anon95708182](#):
>
> Ah, so it could use an atlas as well?

No.  
But for some reason I thought we were talking about atlases 🙂

---

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [April 26, 2022, 8:56am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/12 "2022-04-26T08:56:43Z")

</div>

> [@anon95708182](#):
>
> both the frames and the skirting boards in the image are a few centimetres away from the walls.

Looks like z fighting to me. Can you replicate this in a sample project?

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2022, 9:10am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/13 "2022-04-26T09:10:21Z")

</div>

I’m not sure I understand the info for that image.  
Size in memory should be 1024_1024_3 = 3mb ? (or 4 if rgba)

What if you run this:

```lua
$ file ./assets/uvs/bildaoeforst.png

```

---

<div class="post-metadata">

**Author:** ![anon95708182](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon95708182](https://forum.defold.com/u/anon95708182)\
**Post date:** [April 26, 2022, 9:13am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/14 "2022-04-26T09:13:03Z")

</div>

> [@Mathias\_Westerdahl](#):
>
> But for some reason I thought we were talking about atlases

😄

> [@totebo](#):
>
> Looks like z fighting to me.

To me, too. Curiously, it only is a problem on my android device.  
I run into a bit of a conundrum: Paintings tend to hang on walls, I can’t move them too far away without the whole thing looking odd. And I can’t leave noticable gaps between walls and stairs, doors and skirting board etc. either.

> [@Mathias\_Westerdahl](#):
>
> I’m not sure I understand the info for that image.

See, I don’t understand anything about them 😀 Will try the command.

This is what comes back:  
bildaoeforst.png: PNG image data, 1024 x 1024, 8-bit/color RGB, non-interlaced

---

<div class="post-metadata">

**Author:** ![anon95708182](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon95708182](https://forum.defold.com/u/anon95708182)\
**Post date:** [April 26, 2022, 9:27am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/15 "2022-04-26T09:27:01Z")

</div>

> [@totebo](#):
>
> Can you replicate this in a sample project?

Just dug out a much smaller prototype I had made: same thing.

---

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [April 26, 2022, 9:30am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/16 "2022-04-26T09:30:50Z")

</div>

One thing that helped my project is to change the camera “range”; I use Rendercam and set the “near z” to the biggest value I can get away with and “far z” to the smallest. This didn’t completely fix the issues I was having, but ended up being completely acceptable.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [April 26, 2022, 9:33am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/17 "2022-04-26T09:33:32Z")

</div>

That looks like a proper rgb texture then.

Then I don’t know what to look for.  
I suggest you create a minimal repro project that you can share with us in order to test it out.

---

<div class="post-metadata">

**Author:** ![anon95708182](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon95708182](https://forum.defold.com/u/anon95708182)\
**Post date:** [April 26, 2022, 9:39am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/18 "2022-04-26T09:39:05Z")

</div>

> [@totebo](#):
>
> One thing that helped my project is to change the camera “range”; I use Rendercam and set the “near z” to the biggest value I can get away with and “far z” to the smallest. This didn’t completely fix the issues I was having, but ended up being completely acceptable.

Thank you @totebo, I will try this out immediately.

> [@Mathias\_Westerdahl](#):
>
> I suggest you create a minimal repro project that you can share with us in order to test it out.

I’ll do that and it is very kind of you to offer to have a look.  
Will be back soonish.

---

<div class="post-metadata">

**Author:** ![anon95708182](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon95708182](https://forum.defold.com/u/anon95708182)\
**Post date:** [April 26, 2022, 10:20am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/19 "2022-04-26T10:20:28Z")

</div>

@totebo, may I ask you what near z and far z I might want to try for a large model of 100x100m?

---

<div class="post-metadata">

**Author:** ![totebo](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/totebo/32/36087_2.png) [@totebo](https://forum.defold.com/u/totebo)\
**Post date:** [April 26, 2022, 11:51am UTC](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781/20 "2022-04-26T11:51:22Z")

</div>

It depends entirely on your game; how far the camera is from the object and what cutoff points are acceptable.

My game is fairly extreme in that you see quite far in the distance. I’ve set the near to 300 and far to 100000 I think.

[Next page](https://forum.defold.com/t/black-areas-flickering-in-my-android-app-solved/70781.md?page=2)
