Skip to main content

[VNgen] Workaround: Alpha blending errors on character attachments

Lucas C

Lucas C

Developer

VNgen uses an advanced compositing system for animating characters with multiple layers, each of which can be individually animated. But sometimes, you may notice unwanted outlines around character layers. This is due to alpha blending errors caused by antialiased edges around sprites. Unfortunately, these errors are inherent to GameMaker Studio itself and cannot be fixed by VNgen at present. However, a few workarounds are available to reduce or eliminate the effect beyond visibility.

A typical alpha blending error when compositing antialiased sprites on characters

The Solution (For Now)#

1. Render source sprites as PNG-8 with hard-edged transparency.#

Many image editors (such as Adobe, Clip Studio, GIMP, etc.) export PNG files with semi-transparent pixels around the edges of opaque objects. While this creates a smoother appearance, it also adds semi-transparency to surrounding pixels when composited in GameMaker. For many sprites, a viable option is to simply render without antialiasing.

While the exact settings will vary from application to application, in general you should export with the following settings:

Format > PNG-8

Transparency > Matte OR Hard-edged

See here for an example using Adobe Photoshop Elements.

2. Use total transparency instead of solid backgrounds, where applicable.#

Though not required, VNgen is designed to use separate sprites for character bodies and faces. While it may be tempting to simply 'cut out' the face area for animation, you should instead keep the face background as part of the body sprite and only draw animated elements (such as the eyes and mouth) as a separate layer.

An example composite character using separate face elements with transparency

3. Extend solid backgrounds to 'push' errors out of the way.#

If transparent backgrounds and hard-edged transparency aren't an option, you can also try making the solid background bigger. While it won't eliminate unwanted transparent edges, it gives you control over where they appear. Try redirecting them to line up with transparent areas, or even hide below another sprite layer on top!

Still Open#

Hopefully you find these workarounds helpful. But of course, they are still workarounds, and should not be considered a final solution. XGASOFT will continue to investigate updates to GameMaker Studio and VNgen until such a solution is found.