frame-of-mind/src/base-environments/transition/time_sparks.gdshader

29 lines
1.0 KiB
Plaintext
Raw Normal View History

shader_type spatial;
render_mode unshaded, blend_add, fog_disabled, cull_disabled, depth_draw_opaque;
uniform sampler2D spark_texture;
varying vec4 passtrough;
void vertex() {
passtrough = INSTANCE_CUSTOM;
//MODELVIEW_MATRIX = VIEW_MATRIX * mat4(
// vec4(normalize(cross(vec3(0.0, 1.0, 0.0), MAIN_CAM_INV_VIEW_MATRIX[2].xyz)), 0.0),
// vec4(0.0, 0.0, 1.0, 0.0),
// vec4(normalize(cross(MAIN_CAM_INV_VIEW_MATRIX[0].xyz, vec3(1.0, 0.0, 0.0))), 0.0),
// MODEL_MATRIX[3]);
//MODELVIEW_NORMAL_MATRIX = mat3(MODELVIEW_MATRIX);
}
void fragment() {
vec2 disp = vec2((cos(UV.y*8.0) * sin(UV.y+passtrough.x*200.0) + cos(UV.y*20.0) * sin(UV.y*70.0+TIME)) * 0.1, COLOR.w-passtrough.y*0.1);
ALBEDO = texture(spark_texture, (UV + disp) * vec2(0.5, 0.5) + vec2(sin(TIME*0.2+COLOR.w*20.0)), 0.0).xyz * COLOR.xyz * float((UV+disp).x > 0.3 && (UV+disp).x < 0.7);
//ALBEDO = vec3(float((disp-UV).y < 0.0));
}
//void light() {
// Called for every pixel for every light affecting the material.
// Uncomment to replace the default light processing function with this one.
//}