There can be various reasons why the aberration effect isn't showing up. Make sure that the "separate texture page" option is enabled for the sprite you're applying the shader to and noise sprite. You can find this setting in the sprite editor, on the left side under the "texture settings" tab. Also, in the noise sprite, the last row controls the aberration. If it's completely black, there will be no aberration; if it's white, the aberration will appear. Additionally, in the fnc_glitch_config
function, there's an optional aberration modifier. If it's set to zero, there will be no aberration either, but that's unlikely to be the issue. If you're using the noise5
sprite from the demo, it's most likely related to the "separate texture page" setting.
As for the issue where the effect in noise5
doesn't match the sprite, if I understood you correctly, here's the explanation: the pre-made noise sprites are designed to demonstrate different capabilities of the shader. Specifically, noise5
is semi-transparent, and transparency controls the distortion strength. In noise5
, as you might notice, the black pixels are half-transparent, while the white ones are 25% transparent. This results in the distortion shifting the image by exactly half a pixel or a quarter a pixel, respectively.
The same principle applies to the aberration. If you look at the last row of noise5
, it's almost entirely gray—exactly halfway between black and white—which means the aberration will shift by half a pixel as well. If you want everything to shift precisely by whole pixels, avoid using transparency for distortion and keep the last row fully white for aberration.
If this isn't the issue you were referring to, then it's likely that you're passing the wrong sprite width and sprite height values to the fnc_glitch_config
function. These should be the dimensions of the sprite you're applying the shader to, and it's better to use sprite_get_width(sprite_index)
and sprite_get_height(sprite_index)
to retrieve these values. If you scale your object, the standard sprite_width
and sprite_height
change proportionally with the object, which would result in incorrect data being passed to the shader.
If you have any more questions, feel free to ask—I'm happy to help! :)