Nick der mit hut
Member
Hi,
I'm using this quick and simple lighting system:
Most important code is:
Draw Event:
Camera position and so on all works fine but the thing is that there are borders when two light sources/ circles cross each other:
Red and White light sources
The creator of this lighting system answered to a comment with the same problem that this can be fixed by
This works but it removes all color from the light sources.
How would I go about fixing this without losing the color of the light?
Thank you
I'm using this quick and simple lighting system:
Most important code is:
Draw Event:
GML:
///@desc Draw Lighting Surface
if (!surface_exists(l_surface))
{
l_surface = surface_create(RES_W,RES_H);
}
surface_set_target(l_surface);
draw_clear_alpha(c_black, darkness);
if (darkness >= 0.05)
with (oLightCutout)
{
var wobble_amount_x = image_xscale + random_range(-wobble, wobble)
var wobble_amount_y = image_yscale + random_range(-wobble, wobble)
gpu_set_blendmode(bm_subtract);
draw_sprite_ext(sprite_index, image_index, x - camera_get_view_x(view_camera[0]), y-camera_get_view_y(view_camera[0]) , wobble_amount_x, wobble_amount_y, image_angle, c_white, 1);
gpu_set_blendmode(bm_add);
draw_sprite_ext(sprite_index, image_index,x - camera_get_view_x(view_camera[0]), y-camera_get_view_y(view_camera[0]), wobble_amount_x, wobble_amount_y, image_angle, color, intensity);
gpu_set_blendmode(bm_normal);
}
surface_reset_target();
draw_surface(l_surface, camera_get_view_x(view_camera[0]), camera_get_view_y(view_camera[0]));
Red and White light sources
The creator of this lighting system answered to a comment with the same problem that this can be fixed by
gpu_set_blendmode(bm_src_color);
instead of gpu_set_blendmode(bm_add);
This works but it removes all color from the light sources.
How would I go about fixing this without losing the color of the light?
Thank you