I need help trying to apply a simple transparency shader over a layer and it sub-layers, with no success.
When the player passes a trigger the shader is supposed to slowly fade out the main layer and it's children, this includes instance, assets, tile layers.
Here is the code
Room Create Event
Step Event
Fragment shader
When the player passes a trigger the shader is supposed to slowly fade out the main layer and it's children, this includes instance, assets, tile layers.
Here is the code
Room Create Event
Code:
var lay_ID = layer_get_id("Alpha_Layer");
layer_shader(lay_ID, shd_layeralpha);
shader_handle_ID= shader_get_uniform(shd_layeralpha, lay_ID);
Code:
active = place_meeting(x,y,main_player);
//shift the layer alpha
var rate = 0.05;
if active then current_alpha+=rate; else current_alpha-=rate;
current_alpha = clamp(current_alpha, 0, 1);
shader_set(shd_layeralpha);
shader_handle_ID = shader_get_uniform(shd_layeralpha, "Alpha_Layer");
shader_set_uniform_f(shader_handle_ID, current_alpha);
shader_reset();
GML:
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float Alpha_value;
void main()
{
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
gl_FragColor.a = Alpha_value;
}