G
GhostRacCooN
Guest
Hi, I'm making a game that is top down with a slightly tilted view and I'm having some trouble with blood splatter. Basically since walls that are towards the camera are "in shadow" I need to detect and spawn darker blood there to keep the perspective. I've set up the collision and I can detect when I hit one of these top walls but I'm having trouble blending the blood surface with the wall surface.
Here is the code:
//Draw the walls
surface_set_target(wallmask);
var tileMap = layer_tilemap_get_id(layer_get_id("Layer_Walls"));
draw_tilemap(tileMap,0,0);
surface_reset_target();
draw_surface(wallmask, 0, 0);
surface_set_target(bloodsurface);
gpu_set_blendmode(bm_subtract);
draw_set_color(c_black);
draw_surface(wallmask, 0, 0);
gpu_set_blendmode(bm_normal);
surface_reset_target();
draw_surface(bloodsurface, 0, 0);
Basically my idea was to draw the Walls to a surface, leaving the floor and other areas black. Then draw the blood splatter on top of that and subtract wherever there are black tiles. But I can only seem to get the opposite effect. Ive also tried using gpu_set_colorwriteenable and gpu_set_blendmode_ext but I think I'm misunderstanding the documentation.
Here's the results, first rendering the wallsurface and then when I try to blend the blood surface onto it:
So yeah, I want the opposite effect, blood on the walls but not on the floor so I can keep the perspective look later on.
I'm sure this is really easy but I've been trying for some days now and I just cant figure it out. Any help would be appreciated.
Here is the code:
//Draw the walls
surface_set_target(wallmask);
var tileMap = layer_tilemap_get_id(layer_get_id("Layer_Walls"));
draw_tilemap(tileMap,0,0);
surface_reset_target();
draw_surface(wallmask, 0, 0);
surface_set_target(bloodsurface);
gpu_set_blendmode(bm_subtract);
draw_set_color(c_black);
draw_surface(wallmask, 0, 0);
gpu_set_blendmode(bm_normal);
surface_reset_target();
draw_surface(bloodsurface, 0, 0);
Basically my idea was to draw the Walls to a surface, leaving the floor and other areas black. Then draw the blood splatter on top of that and subtract wherever there are black tiles. But I can only seem to get the opposite effect. Ive also tried using gpu_set_colorwriteenable and gpu_set_blendmode_ext but I think I'm misunderstanding the documentation.
Here's the results, first rendering the wallsurface and then when I try to blend the blood surface onto it:
So yeah, I want the opposite effect, blood on the walls but not on the floor so I can keep the perspective look later on.
I'm sure this is really easy but I've been trying for some days now and I just cant figure it out. Any help would be appreciated.