Arashi
Member
Hello everyone.
I've been working on my game Tech-X, fidgetting with water, trying to create better shaders for it when suddenly started getting black screen instead of the game.
I started to look into this problem, looking for bugs, but instead of bugs I found a very strange behaviour in draw event. I kept on going and found out, that if disable my shadow controller, screen does not turn to black field when pause menu is called any more.
So I started to look into obj_shadow_controller and found out that it does not work any more. That was a surprise, because recenly I worked only with brightly lit rooms, so I did not pay attention.
Here is essential parts of draw event
I create surfaces (nothing is wrong here)
Then I draw lights on sf_light like this: (works fine)
Then I create shadow and draw light over it. (fine too)
Finaly I draw shadow surface over application surface:
(I can see resulting surface in debugged Graphics tab, and I see what expect to see - half transparent grey field with holes made by lights in it)
And application surfaces stays unchanged! Nothing happens!
To test it further I replaced drawing shadow surface with drawing black rectangle over my room
Absolutley nothing! No black rectangle!
I loaded my backup from 3 months ago, where all shadows were fine. Now they are not.
For the first time I encountered this problem yesterday. So I suppose it might be related to GMS2 update.
And it goes not only with shadow controller.
When I was looking into black screen issue, I found out that afted I used draw_clear(c_black) in draw event of my pause menu object function any drawing on application surfaces stopped. But when I turn off shadow_controller pause menu works fine (exept that there are no shadows in pause menu).
So I'm kinda stuck and have no idea what to do.
Please give me advice.
I've been working on my game Tech-X, fidgetting with water, trying to create better shaders for it when suddenly started getting black screen instead of the game.
I started to look into this problem, looking for bugs, but instead of bugs I found a very strange behaviour in draw event. I kept on going and found out, that if disable my shadow controller, screen does not turn to black field when pause menu is called any more.
So I started to look into obj_shadow_controller and found out that it does not work any more. That was a surprise, because recenly I worked only with brightly lit rooms, so I did not pay attention.
Here is essential parts of draw event
I create surfaces (nothing is wrong here)
Code:
#region create surface, if there is no
if !surface_exists(sf_shadow)
{
sf_shadow = surface_create(obj_camera.width,obj_camera.height);
surface_set_target(sf_shadow);
draw_clear_alpha(c_black,0);
surface_reset_target();
}
if !surface_exists(sf_light)
{
sf_light = surface_create(obj_camera.width,obj_camera.height);
surface_set_target(sf_light);
draw_clear_alpha(c_black,0);
surface_reset_target();
}
#endregion
Code:
surface_set_target(sf_light);
draw_clear_alpha(c_black,0);
draw_set_blend_mode(bm_normal);
if instance_exists(obj_generic_room_light)
{
with obj_generic_room_light
{
draw_sprite_ext(light_sprite,light_sprite_image_index,w2x + x, h2y + y, light_x_scale, light_y_scale, 0, c_white, light_power);
}
}
Code:
//Draw light(s)
surface_set_target(sf_shadow);
draw_clear(col)
gpu_set_blendmode(bm_add);
draw_surface_ext(sf_light,0,0,1,1,0,c_white,light_power);
gpu_set_blendmode(bm_normal);
surface_reset_target();
(I can see resulting surface in debugged Graphics tab, and I see what expect to see - half transparent grey field with holes made by lights in it)
Code:
//draw light and shadow to screen
gpu_set_blendmode_ext(bm_dest_colour,bm_zero); //multiply blend mode
draw_surface(sf_shadow,x0,y0);
gpu_set_blendmode(bm_normal);
And application surfaces stays unchanged! Nothing happens!
To test it further I replaced drawing shadow surface with drawing black rectangle over my room
Code:
//draw light and shadow to screen
//gpu_set_blendmode_ext(bm_dest_colour,bm_zero); //multiply blend mode
//draw_surface(sf_shadow,x0,y0);
draw_set_color(c_black)
draw_rectangle(0,0,room_width,room_height,0)
//gpu_set_blendmode(bm_normal);
I loaded my backup from 3 months ago, where all shadows were fine. Now they are not.
For the first time I encountered this problem yesterday. So I suppose it might be related to GMS2 update.
And it goes not only with shadow controller.
When I was looking into black screen issue, I found out that afted I used draw_clear(c_black) in draw event of my pause menu object function any drawing on application surfaces stopped. But when I turn off shadow_controller pause menu works fine (exept that there are no shadows in pause menu).
So I'm kinda stuck and have no idea what to do.
Please give me advice.
Last edited: