Hello! I was experimenting with Subviewports and encountered a bug.
I have a buy_pad which is Area3D that has MeshInstance3D and Subviewport in it.
The mesh has unique StandardMaterial3D. This material has an albedo as ViewportTexture which points to the said subviewport.
The problem is: after 7 such buy pads, the 8th does not display subviewport at all in-game. In editor though it is fully visible.
Another thing is I do not display 8 buy pads with 8 unique subviewports at the same time. All previous buy pads are queue_free()'d. It’s always the 8th one that has this bug in-game.
If player is far then it looks like a solid white square texture. If player is near it displays a bunch of letters:
“PICKUYORF
STMNBHGA
DBLZ23”
I assume it’s somehow related to Godot Engine’s memory limits or something like that (if I am saying this correctly). Is there any way to fix that problem?
I’m sorry to say but both of those are considered quite old by today’s standard. Especially your CPU.
EDIT: I will say though, if the bug happens at the same amount of subviewports on both devices, then it is most likely an issue with your implementation. But we can’t really see that so it’s likely nobody will be able to help you unless you share more details.
Thank you for an answer! The issue happens at the same amount of subviewports on both devices.
To be honest, I don’t know what more info to give. You could clarify what exact more info is needed.
Imagine there are 10 pads which are Area3D with MeshInstance3Ds in them. Each MeshInstance3D has SubViewport in it. Why? The SubViewport has Control nodes which have Label and ProgressBar.
Therefore the logic is if player is within the Area3D then something happens with the ProgressBar. It was made so player can visually see 2D nodes in 3D space.
In editor 10 pads and even more is rendered correctly and no issue ever appear.
But in-game at the 8th pad depending on the Camera3Ds proximity to that pad the issue appears:
If player is far away from 8th pad but it is visible near the border of the screen then 8th pad is rendered correctly.
If player is a little bit close then the 8th pad is rendered as full white texture.
If player is really close then the 8th pad is rendered as a bunch of letters I’ve presented in the screenshot above.
The thing is the 10 pads are not even visible to the Camera3D at the same time.
1th buy pad is used → 1th buy pad MeshInstance3D is queue_free()'d (therefore subviewport is completely removed) → 2nd buy pad appears visible → and so on.
My only theory is that it is somehow related to the fact that ViewportTexture requires it to be local_to_scene true.
I checked. None of them share same resources. It’s always the 8th pad. Even if I delete the bugged 8th one and replace it with the 9th pad (well the 9th would be called 8th by now but you got the point) then the issue will still happen.
W 0:00:00:296 DisplayServerWindows: Your video card drivers are known to have low quality OpenGL 3.3 support, switching to ANGLE.
<Source code C++>platform/windows/display_server_windows.cpp:7423 @ DisplayServerWindows()
I practically can’t switch to any other renderer on my PC. It’s always gonna be “Compatibility”.
BUT when I export .apk file for Android it uses gl_compatibility. I suppose Godot Engine does NOT use ANGLE for Android. It probably uses something else. The ANGLE is made to convert OpenGL ES API calls to something my pc would support (e.g. Vulkan or DirectX).
Though, I haven’t tried changing it to mobile for Android export… I guess this is something to experiment on.
I guess, I will try to create fresh new project and record video of the problem.
I am gonna go crazy. Creating fresh project and leaving all 10 pads gives no rendering issues when in-game.
Then I decided to test in-game my first project that had this issue. And guess what? THERE IS NO RENDERING BUGS NOW.
I don’t even know what is even this. Why there is no issue now?
I didn’t even close the first project that had this issue. (This means I did not reopen the project that have this rendering bug)
I just copy-pasted the project’s folder and launched another Godot Engine instance to edit it and clean it for recording purposes. Launched the clean game and there is no rendering issues.
Decided to l launch the first project that had this issue and there is no rendering issues either!
But why? I exported my first project as .apk for Android and it had this bug! As a matter of fact the image on the original post is literally from my phone.
What is going on. Playing my game on Android gives this rendering bug.
EDIT: This bug may occur when some of the materials and meshinstances are sharing same resources.