• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

GMS 2 Lights Cutting into eachother

I just followed a tutorial on lights and finally got one that works with my system and current GMS. Great BYT for some reason my lights are cutting into each other. The gentleman in the video doesn't seem to have that issue as far as I can tell. I have double checked the code and cant find anything wrong. Im hoping someone here can show me how to fix.

Screen Shot 2020-07-14 at 1.56.03 PM.png

Here is the tutorial I followed to get here.

Below is my code...
CREATE
GML:
lighting_surface = -1;
DRAW
GML:
// if no surface exists, draw one
if (surface_exists(lighting_surface) == false) {
    lighting_surface = surface_create(room_width, room_height);   
}

surface_set_target(lighting_surface);    // set the surface
draw_clear_alpha(c_black, 0.33);        // darken the room

// create and blend the light
with(oLight) {
    
    var wob_am_x    = image_xscale + random_range(-wobble, wobble);
    var wob_am_y    = image_yscale + random_range(-wobble, wobble);
    
    // draw and cutout the sprite
    gpu_set_blendmode(bm_subtract);
    draw_sprite_ext(sprite_index, image_index, thisXY.x, thisXY.y, wob_am_x, wob_am_y, 0, c_white, 1);
    
    // color and intensity alterations in the room editor
    gpu_set_blendmode(bm_add);
    draw_sprite_ext(sprite_index, image_index, thisXY.x, thisXY.y, wob_am_x, wob_am_y, 0, color, intensity);
    
    gpu_set_blendmode(bm_normal); // reset blendmode
    
}

surface_reset_target(); // reset the surface

draw_surface(lighting_surface, 0 , 0); // draw the surface to screen
Inside of the light itself I only have 4 variables set up...
Color, intensity, wobble and thisXY
 

GMWolf

aka fel666
It looks like blending isn't being applied. Make sure you have blend mode enabled with the blendenable.
Also make sure.your light objects are not visible.

I understand from other posts you may be using views into a large room.
Creating a surface the size of you room will use a crazy large amount of Vram... You may run into issues there in the future.
 
Top