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

Sprite 'modulate' property affects siblings when Batching is enabled #48122

Closed
tsuinex opened this issue Apr 23, 2021 · 3 comments
Closed

Sprite 'modulate' property affects siblings when Batching is enabled #48122

tsuinex opened this issue Apr 23, 2021 · 3 comments

Comments

@tsuinex
Copy link

tsuinex commented Apr 23, 2021

Godot version:
3.3.stable.official

OS/device including version:
OpenGL ES 3.0 Renderer: AMD Radeon HD 8800M Series (VERDE, DRM 3.40.0, 5.11.10-1-MANJARO, LLVM 11.1.0)

Issue description:
I have an enemy sprite that turns red using the self_modulate property when it is hit. After upgrading to Godot 3.3, this red tint also sometimes applies to the player character, which is an unrelated node in the scene tree.

I expected the 'self_modulate' property to affect only the selected node (and its children in the case of the 'modulate' property).

Steps to reproduce:
I'm not certain whether all these steps are necessary, but:

  1. Create a 2D scene, add a TileMap node as a child, and populate it with some tiles.
  2. Create a sprite, set its 'modulate' or 'self_modulate' property to a distinct colour, and move this sprite beyond the top-left of the origin (0,0).
  3. Create another sprite, and give it a Light2D child with a texture. This sprite will now be tinted the same colour as the other sprite.

The problem also occurs when running the project, but is dependant on the positions of the sprites, so it doesn't trigger in the same situation. In my game, it happens on and off as I and the enemy move around, and flickers when I enable Flash Batching, which shows that it is an issue related to the new batching feature.

Minimal reproduction project:
modulate_bug.zip

@lawnjelly
Copy link
Member

It seems related to the light joining. When I set rendering/batching/lights/max_join_items to 0 it cures it. It also doesn't need to be a tilemap, I replaced it with a sprite and it still occurs.

It may be a case where I need to prevent light joining.

@lawnjelly
Copy link
Member

Got it, there's no need to prevent light joining which is good.

There's a bit where it reapplies the final_modulate for an item during the lighting pass. The only thing is, for joined items (non single items) we don't want to do this as the modulates are baked. I have it working, but want to check it a bit more before making a PR as the light passes isn't fresh in my mind.

@akien-mga
Copy link
Member

Fixed by #48151.

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