GDevelop icon indicating copy to clipboard operation
GDevelop copied to clipboard

Additive rendering Bug with Tilemap Objects

Open IttaloXD opened this issue 3 years ago • 8 comments

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:

  1. Setup an tilemap object
  2. Create an particle with additive rendering checked or an light object
  3. Preview the scene
  4. See error

Video below:

https://www.youtube.com/watch?v=zCPcB9C_EjA&ab_channel=IttaloOrniloXD

Source forum

IttaloXD avatar Jul 01 '21 20:07 IttaloXD

Could you share your project's files please ?

Oxey405 avatar Jul 05 '21 09:07 Oxey405

game.zip

IttaloXD avatar Jul 08 '21 19:07 IttaloXD

It's definitely a bug. The logic is pretty simple.

IttaloXD avatar Jul 08 '21 19:07 IttaloXD

Looks very much like a bug. I wonder if it's a bug in pixi-tilemap or pixi-particles.

4ian avatar Jul 08 '21 20:07 4ian

The Tilemap object have no support for blendMode.

Bouh avatar Jul 09 '21 19:07 Bouh

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.

ClementPasteau avatar Sep 07 '21 16:09 ClementPasteau

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?

4ian avatar Sep 07 '21 16:09 4ian

Upgrading the Pixi tile map extension to 3.2.2 doesn't fix the issue.

  • https://github.com/4ian/GDevelop/pull/4212

D8H avatar Aug 18 '22 19:08 D8H