GMS 2 precise collision transperancy threshold


if you rise the threshold on the transperancy, in precise collision checking, does that ease the burden on collision checking?


Forum Staff
"ease the burden" as in "increase performance"? You could test this easily and accurately by using the profiler while having two instances, one with a higher threshold, check for collisions.
The threshold just determines how much alpha a pixel needs to have before it is considered a "solid" pixel.

If you have semi-transparent pixels, raising the threshold above a certain amount will cause them to not be included in the sprite mask. Which means less pixels need to be checked when a collision of the bounding boxes is detected.

If you only have pixels that are either fully transparent (alpha = 0) or fully solid ( alpha = 1) then changing the threshold will not make any difference.

If you have a bunch of pixels in your sprite that have, for example, and alpha of 0.5, and you raise the threshold above that value, they will not be included in the mask, which will give faster collision checking in theory. You can visually check this by watching the collision mask preview window for your sprite as you change the threshold value. If there are semi-transparent pixels, you can see the mask shape and size change when you alter the threshold.

So in theory, altering the threshold could yield performance benefits. It's definitely worth testing however, as @TsukaYuriko said, to see how it affects your game.

You can read a detailed description in this blog article:

It's from 2013 but I believe its still relevant.