Tony M
Member
Hi, I have successfully implemented a full screen wave shader that I adapted from here: https://marketplace.yoyogames.com/assets/261/free-shaders
The shader itself works quite well, but has unfortunately introduced an issue with my sprites. Sprites with semi transparent edges (anti-aliasing) now get rendered with a dark outline. Not sure if it has something to do with the full screen surface and the gpu blending.
Below shows my game using the shader and surface, you can see the black outline.
Next screen shows my images as the are suppose to appear (no black outline, semi alpha edges).
In my game, if I jump back to the original room, the black outline disappears but I get artifacts from the red block.
So its a strange problem that I am totally stuck with.
Here is the code from my Shader Controlling object:
Also, the GMS2 source code that demonstrates this specific issue can be found here:
https://github.com/sidfishgames/gms2_shader_issue
Any help is greatly appreciated.
The shader itself works quite well, but has unfortunately introduced an issue with my sprites. Sprites with semi transparent edges (anti-aliasing) now get rendered with a dark outline. Not sure if it has something to do with the full screen surface and the gpu blending.
Below shows my game using the shader and surface, you can see the black outline.
Next screen shows my images as the are suppose to appear (no black outline, semi alpha edges).
In my game, if I jump back to the original room, the black outline disappears but I get artifacts from the red block.
So its a strange problem that I am totally stuck with.
Here is the code from my Shader Controlling object:
Code:
// Create Event
uni_time = shader_get_uniform(shd_wave_horizontal,"time");
var_time_var = 0.0;
uni_wave_left = shader_get_uniform(shd_wave_horizontal,"wave_left");
var_wave_left = 0.0;
uni_wave_right = shader_get_uniform(shd_wave_horizontal,"wave_right");
var_wave_right = 0.0;
wave_triggered = false;
wave_thickness = 0.5;
wave_speed = 0.05;
surf = surface_create(camera_get_view_width(view_camera[0]), camera_get_view_height(view_camera[0]));
view_set_surface_id(0, surf);
Code:
// Step event
var_time_var+=0.04;
if keyboard_check_released(vk_space) {
wave_triggered = true;
var_wave_left = 0.0;
var_wave_right = 0.0;
}
if (wave_triggered) {
var_wave_right = clamp(var_wave_right + wave_speed, 0.0,1.0);
if (var_wave_right > wave_thickness) {
var_wave_left = clamp(var_wave_left + wave_speed, 0.0,1.0);
}
if (var_wave_left == 1.0) {
wave_triggered = false;
}
}
Code:
// Draw GUI event
draw_set_color(c_white);
if (wave_triggered) {
shader_set(shd_wave_horizontal);
shader_set_uniform_f(uni_time, var_time_var);
shader_set_uniform_f(uni_wave_left, var_wave_left);
shader_set_uniform_f(uni_wave_right, var_wave_right);
}
draw_surface(surf,0,0);
shader_reset();
https://github.com/sidfishgames/gms2_shader_issue
Any help is greatly appreciated.
Last edited: