GDevelop
GDevelop copied to clipboard
Additive rendering Bug with Tilemap Objects
Describe the bug
Whenever an additive rendering object is created, the tilemap object on screen somehow inherit that additive rendering and gets all white.
To Reproduce
Steps to reproduce the behavior:
- Setup an tilemap object
- Create an particle with additive rendering checked or an light object
- Preview the scene
- See error
Video below:
https://www.youtube.com/watch?v=zCPcB9C_EjA&ab_channel=IttaloOrniloXD
Could you share your project's files please ?
It's definitely a bug. The logic is pretty simple.
Looks very much like a bug. I wonder if it's a bug in pixi-tilemap or pixi-particles.
The Tilemap object have no support for blendMode.
Thanks for reporting the problem @IttaloXD ! I've managed to reproduce it well with your game example.
I've tried digging a bit. It seems to be indeed coming from the Particle Emitter.
This is where the blendMode
is defined and the Object is added to a Container. https://github.com/4ian/GDevelop/blob/master/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.ts#L200-L210
The only related issue I could find in the ParticleEmitter repository was this one https://github.com/pixijs/particle-emitter/issues/59 The author mentions a weird behaviour if the object is put on something transparent. I've tried moving the object around the scene, to be on top of other elements, but the result doesn't change much.
However I've noticed that changing the layer background color changes the "bug color" appearing on the scene. So the problem must be linked to the fact that the effect gets affected by the Container it's in. (I've tried adding another Container around, but same problem)
Weirdly, if I continuously create the object (and not on a "key press event" for instance, the problem doesn't appear)
I've also tried playing around with cacheAsBitmap
but I'm not sure this is relevant here.
Thanks for checking!
However I've noticed that changing the layer background color changes the "bug color" appearing on the scene.
This might be because the tilemap inherits the "additive" rendering, and so the final color of it depends on the background color of the scene?
I wonder if it's not that much of a particle emitter problem, but more pixi-tilemap that would not properly reset the WebGL state (or whatever state) that is used for rendering the tiles...
Weirdly, if I continuously create the object (and not on a "key press event" for instance, the problem doesn't appear)
Ah, that's even weirder, though this could be a rendering state toggling/set back to its proper value for the tilemap rendering?
Upgrading the Pixi tile map extension to 3.2.2 doesn't fix the issue.
- https://github.com/4ian/GDevelop/pull/4212