I am trying to do a simple silhouette effect based on the Dynamic Rendering Masks example here:
https://www.yoyogames.com/blog/430/dynamic-rendering-masks
This works exactly as I expect except for one thing: I cannot set the alpha to anything other than 1 in the final draw action. If I change alpha blending anywhere else, it either doesn't draw at all or it draws everything with a 1 for alpha.
Essentially, when a player character is behind a wall, it should use the wall as a mask to draw the player's silhouette on top of the wall.
The code should disable alpha blending, draw a rectangle across the whole screen with alpha values set to 0, then re-enable alpha, draw the wall to set 1s where the tiles are, then finally draw the silhouette. This should, and does, only draw where the character is, but I can't seem to figure out how to get the tileset to draw the silhouette at a partially blended mode. I tried setting alpha to .5 and .1, no luck.
Here's the code.
As above:
Desired Result:
https://www.yoyogames.com/blog/430/dynamic-rendering-masks
This works exactly as I expect except for one thing: I cannot set the alpha to anything other than 1 in the final draw action. If I change alpha blending anywhere else, it either doesn't draw at all or it draws everything with a 1 for alpha.
Essentially, when a player character is behind a wall, it should use the wall as a mask to draw the player's silhouette on top of the wall.
The code should disable alpha blending, draw a rectangle across the whole screen with alpha values set to 0, then re-enable alpha, draw the wall to set 1s where the tiles are, then finally draw the silhouette. This should, and does, only draw where the character is, but I can't seem to figure out how to get the tileset to draw the silhouette at a partially blended mode. I tried setting alpha to .5 and .1, no luck.
Here's the code.
Code:
//step 1
gpu_set_blendenable(false)
gpu_set_colorwriteenable(false,false,false,true);
draw_set_alpha(0);
draw_rectangle(0,0, room_width,room_height, false);
//step 2
draw_set_alpha(1)
draw_tilemap(tilemap,0,0)
gpu_set_blendenable(true);
gpu_set_colorwriteenable(true,true,true,true);
//step 3
gpu_set_blendmode_ext(bm_dest_alpha,bm_inv_dest_alpha);
gpu_set_alphatestenable(true);
draw_sprite_part_ext(sprite_index,image_index,0,0,16,16,x,y,1,1,c_black,.2)
//step 4
gpu_set_alphatestenable(false);
gpu_set_alphatestenable(false);
gpu_set_blendmode(bm_normal);
Desired Result:
Last edited: