Godot: Tile stretch mode doesn't work for TextureRect with image not multiple to 64x64 exported in HTML5 in GLES2 only [GLES2 batching]

Created on 14 Jul 2020  路  8Comments  路  Source: godotengine/godot

Godot version:
3.2.2-stable

OS/device including version:
Win10, NVidia Geforce 850M, GLES2 only!

Issue description:
TextureRect with a PNG with size not multiple of 64x64 pixels used as texture and set in tile mode isn't repeated when exported in HTML5 when project driver set to GLES2.
But it works ok for DEBUG version, Windows exported version and HTML5 version if driver set to GLES3.
tile-test-html

Steps to reproduce:
1) Create new project
2) Add a TextureRect in the scene
3) Set texture property with an image which size is not multiple of 64x64 pixels
4) Select Tile in Stretch Mode property
5) Scale the control up
6) Make sure GLES2 driver set in Project Settings/Rendering/Quality/Driver/Driver Name
7) Export project with HTML5 (Runnable) preset
8) Run exported version in any local server
9) Observe tiling doesn't work

Minimal reproduction project:
tile-test.zip

P.S. Possibly connected with Tile stretch mode doesn't work for TextureRect & TextureButton

bug html5 rendering

Most helpful comment

I've been able to reproduce it, had to figure out how to compile the html templates! :smile: Should make it much easier to fix.

All 8 comments

We had a similar bug not too long ago, #39766. For GLES2, try turning batching off and see if it still occurs. I'll see if I can reproduce it.

Yes! Turning off rendering/batching/options/use_batching solved the problem.

We had a similar bug not too long ago, #39766. For GLES2, try turning batching off and see if it still occurs. I'll see if I can reproduce it.

Yes! Turning off rendering/batching/options/use_batching solved the problem.

Well that helps pin it down, it still needs solving. :+1:

We may be relying on a default state that is different on HTML5. There is also a very unlikely, small possibility that this is a caching problem in the browser and it is using a version from before the earlier bug was fixed, so I'd like to reproduce it on my side (you may have been using beta templates before the 3.2.2 stable release, as this bug was only fixed 21 days ago).

Yes, I was using 3.2.2 beta html5 template for some time. But while trying to find exact conditions for the bug I tested a couple of dozens of parameters & images combinations in Chrome & Firefox. My main browser is Firefox and I use Chrome very rarely.

I've been able to reproduce it, had to figure out how to compile the html templates! :smile: Should make it much easier to fix.

Got it. It was quite simple bug, surprised no one had reported before (maybe it is because it doesn't occur with non-power of two textures).

  • On HTML5 it isn't detecting the ability to tile non power of 2 textures, so is setting FORCE_REPEAT
  • FORCE_REPEAT is a shader conditional, but it was set AFTER the shader was bound, so not having any effect

I've fixed it by setting the conditional before the shader bind. I just want to check whether it is ok to set GL_REPEAT there before the bind too (don't want to cause any regressions in the existing system). Will make a PR soon. :+1:

All fixed.

Incidentally, I'd suggest against tiling non power of 2 textures if the project may be run on mobile that doesn't support npot. The FORCE_REPEAT method could cause a large drop in performance on some hardware, as well as texture filtering type artifacts, due to drop in precision. I'll try and see if we can get this added to the docs somewhere.

Fixed by #40410

Was this page helpful?
0 / 5 - 0 ratings