SOLVED One Instance Layer makes the below layers appear totally black. Can't figure out why

NastyMonk

Member
This is what the layers look like when working normally.

1585106240977.png
EffectLayer has a obj_fog object that draw all black to a surface of the size of camera view. And then draw this surface with a shader that renders a transparent circle around the player character. Here is the code:

GML:
/// @description Draw a fog of war with a circle in the middle
// You can write your code in this editor

surface_set_target(mySurf);
draw_clear(c_black);
surface_reset_target();

shader_set(sh_fog);
shader_set_uniform_f(playerPosition_x,obj_player.x);
shader_set_uniform_f(playerPosition_y,obj_player.y);
draw_surface(mySurf,camera_get_view_x(view_camera[0]),camera_get_view_y(view_camera[0]));
shader_reset();
Fragment Shader code:

Code:
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
varying vec3 v_Position;
uniform float player_x;
uniform float player_y;


void main()
{
    vec3 playerPosition = vec3(player_x,player_y,0);
    float distanceToPlayer = distance(playerPosition,v_Position);
    
    if (distanceToPlayer < 100.0) {
        // code here
     gl_FragColor = vec4(1.0,1.0,1.0,0) * texture2D( gm_BaseTexture, v_vTexcoord );

    }
    else {
     gl_FragColor = vec4(1.0,1.0,1.0,1.0) * texture2D( gm_BaseTexture, v_vTexcoord );
// code here
    }
}
This is what is looks like normally:
1585106476494.png


When I add an instance layer above the EffectLayer, however, it makes everything black even if the layer itself is empty:
1585106525552.png
1585106546197.png

Even if I turn off the visibility of this layer, it is still black.
 
Top