enigma-dev / enigma-dev

The Extensible Non-Interpreted Game Maker Augmentation.
http://enigma-dev.org
341 stars 117 forks source link

Untriaged particle rendering bug #1180

Open JoshDreamland opened 6 years ago

JoshDreamland commented 6 years ago

I just noticed a post from late 2016 about an opacity difference between ENIGMA particles and Studio's equivalent.

ENIGMA: http://i.imgur.com/lL2SpaW.gifv GM: http://i.imgur.com/nqqH2l8.gifv

Note that ENIGMA's is much more washed-out. Seems to just be rendered at lower opacity.

The poster provided a link to a GMZ, but that link has long since expired. I suspect this won't be hard to reproduce, if we'll be able to do anything about it.

RobertBColton commented 6 years ago

The particle effects only ever rendered anything in OpenGL, never Direct3D, so that much I already knew did not work. forthevin opted to created layers for each graphics system, because when he first wrote them we only had a single graphics system.

The problem is likely blend modes: https://github.com/enigma-dev/enigma-dev/blob/6431f4cc8c8b3465eb59ee7e61ff3d0151fc993f/ENIGMAsystem/SHELL/Universal_System/Extensions/ParticleSystems/PS_particle_bridge_OpenGL1.h#L93

It would be possible to abstract his particle rendering code to use the GML functions (since he already uses them to draw the particles as sprites; just for some reason not the blend functions). That way the particles would work in all graphics systems. That however, may not be the most performant, but draw_sprite is batched (however it can't do any batching because he's using the gl function directly and not the blend mode function).

The fact that he's using the gl function might actually be the problem because when it gets changed it's not allowing draw_sprite to be flushed because the graphics system is not seeing any state change. Since the global batch is just hanging around full, it's likely getting flushed at a later time when the alpha has changed or something.

Please exercise caution when refactoring this extension.