GameMaker Set transparency on Shader through blend mode?

S

Stratos.la

Guest
Hey guys so i have made a sonar type radar on my player object by creating a surface and using blend modes through layers. im happy with it but as i have it its just set to black and i dont want that. i have a fog shader at the moment for testing purposes ( i had bought this through the marketplace a few months ago) but i cant get it to work :/

controler
Code:
if instance_exists(o_player)
{
light_layer = layer_get_id("Lights");
light_surface = surface_create(1920,1080);
layer_script_begin ( light_layer,lights_begin);
layer_script_end(light_layer,lights_end);
}
scripts for start and end

Code:
if (event_type == ev_draw ) and (event_number == 0 )
{
    if (!surface_exists(iLight.light_surface))
    {
        iLight.light_surface = surface_create(1920,1080);
    }
 
    surface_set_target(iLight.light_surface);
    draw_clear_alpha(c_black, 1.0);
    gpu_set_blendmode(bm_add);
}
Code:
if (event_type == ev_draw) and (event_number == 0 )
{
    surface_reset_target();
    gpu_set_blendmode(bm_normal);
    surface_set_target(application_surface);
    gpu_set_blendmode_ext(bm_dest_color,bm_zero);
    draw_surface(iLight.light_surface, 0,0);
    gpu_set_blendmode(bm_normal);
    surface_reset_target();
 
}

i dont know if the shaders code is necessary since i'll probably end up making one of my own after some studying but basicaly it shoud work even with that one.
 
Last edited by a moderator:
S

Stratos.la

Guest
sorry it took so long to reply. well i kinda changed the whole shader thing since its too much for me at the moment and created the fog with particles. i the red circle i have a sprite well a white circle basicaly that i need to became a window through the fog. it was what i was trying to do with the shaders before but thought it would be easier with particles since i have some experience with them.
this is with the fog particle. the red circle is where my test player is located
1.jpg
and this is with the code i had posted.
1.jpg

basicaly that window i have in the black background i would like to have it with the fog particles!

i tried it with setting a step event on my circle object to destroy the particles but yup it destroys everything! i kinda get the idea that i need it to destroy only parts its touching and then the fog particle will regenerate after the circle leaves that spot but all i can do is imagine at the moment and none of my codes work

wow i keep editing my post! sorry. well now i thought of having the fog start around my character and fill the room so wherever my character goes it should have that said window. am i thinking it right? and yea i think im spamming my own post. sorry
 
Last edited by a moderator:
Top