Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird graphical glitches caused by 2d batching #48981

Closed
MightyPrinny opened this issue May 22, 2021 · 2 comments
Closed

Weird graphical glitches caused by 2d batching #48981

MightyPrinny opened this issue May 22, 2021 · 2 comments

Comments

@MightyPrinny
Copy link
Contributor

MightyPrinny commented May 22, 2021

Godot version:
3.3.1 Mono

OS/device including version:
MXLinux 19/Debian 10 64bits, GLES2

Issue description:
I'm not sure what's going on exaclty, but I was able to replicate part of the glitches I was seeing in a project,

glitch.mp4

Here things are disappearing, I was also seeing things being drawn at an offset in a project.

Steps to reproduce:
In the reproduction project I had to use different zindex, a script with custom 2d drawing and a grid lines shader.
It might be worth noting that the draw code uses global coordinates.

func _draw():
	if(texture == null):
		return;
	#global_position = referencePosition;
	draw_set_transform(-global_position,0,Vector2.ONE);
	
	var dir:Vector2 = (global_position-Vector2(0,16)-referencePosition).normalized();
	for i in range(length):
		draw_texture(texture,referencePosition+Vector2(-8,16)+i*16*dir);

Minimal reproduction project:
DrawGlitch.zip

@MightyPrinny MightyPrinny changed the title Weird graphical glitches caused by batching Weird graphical glitches caused by 2d batching May 22, 2021
@Calinou Calinou added this to the 3.4 milestone May 22, 2021
@lawnjelly
Copy link
Member

lawnjelly commented May 23, 2021

Am just taking a look.

Turned out to be due to a state getting stale in the batching and not being updated. It was probably a very rare bug but nice to have fixed, it was probably only working in most cases by chance.

Given that the test project is quite complex, it is possible there is more than 1 bug. I spent some time isolating and identifying this one, and the test project seems to be working ok for me now. Let me know if you spot any other problems in the project once the fix is merged.

@akien-mga
Copy link
Member

Fixed by #48992.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants