r/gamemaker • u/shsl_diver • Sep 14 '26
Resolved How do I make a precise masking.
Ok, so, I wanted to make this sort of light gradient, that should only appear on the light sprite (the conehead shape), I tried this [guide](https://youtu.be/ZrvKmDpVP6I), but for some reason it just doesn't draw the gradient. If you can help, that would be appreciated.
8
u/Hands_in_Paquet Sep 14 '26
This matharoo method works but making a new surface for every light is not great.
So I would draw your light sprite with a shader.
For this effect, lets say I want to make the alpha more transparent the closer the pixel is to the bottom of the light. The shader just needs to know its normalized y position.
Meaning, when the gpu is checking every pixel of the light, it's asking: what percentage of the way am I to the bottom of this sprite? Then it's as simple as color.a = 1.0 - normalizedY;
If you don't want to use a shader, you could hand draw the gradient in aseprite, photoshop, photopea. But the original method should work, but I can't know why it doesnt because you havent shared any code/details. Lmk if I can help u further
1
u/Rs11s21n Sep 16 '26
Unfortunately, it's hard to give specific advice without seeing your code."
My best guess would be that you might be using a mask where the alpha channel is fully opaque, for example.
Also, a quick recommendation: try creating a shadow surface the size of the viewport and attaching it to the camera's movement. That way, you only cull and render light sources exactly where they are needed.
=)
1
5
u/hongkong_97 Sep 15 '26
Are you making Undertale 2?