52 lines
2.0 KiB
Plaintext
52 lines
2.0 KiB
Plaintext
// NOTE: Shader automatically converted from Godot Engine 4.3.stable's StandardMaterial3D.
|
|
|
|
shader_type spatial;
|
|
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx;
|
|
|
|
|
|
uniform sampler2D spray_texture;
|
|
uniform sampler2D lifetime_gradient;
|
|
varying vec4 passtrough;
|
|
|
|
void vertex() {
|
|
passtrough = INSTANCE_CUSTOM;
|
|
|
|
// Billboard Mode: Particles
|
|
mat4 mat_world = mat4(
|
|
normalize(INV_VIEW_MATRIX[0]),
|
|
normalize(INV_VIEW_MATRIX[1]),
|
|
normalize(INV_VIEW_MATRIX[2]),
|
|
MODEL_MATRIX[3]);
|
|
mat_world = mat_world * mat4(
|
|
vec4(cos(INSTANCE_CUSTOM.x), -sin(INSTANCE_CUSTOM.x), 0.0, 0.0),
|
|
vec4(sin(INSTANCE_CUSTOM.x), cos(INSTANCE_CUSTOM.x), 0.0, 0.0),
|
|
vec4(0.0, 0.0, 1.0, 0.0),
|
|
vec4(0.0, 0.0, 0.0, 1.0));
|
|
MODELVIEW_MATRIX = VIEW_MATRIX * mat_world;
|
|
|
|
// Billboard Keep Scale: Enabled
|
|
MODELVIEW_MATRIX = MODELVIEW_MATRIX * mat4(
|
|
vec4(length(MODEL_MATRIX[0].xyz), 0.0, 0.0, 0.0),
|
|
vec4(0.0, length(MODEL_MATRIX[1].xyz), 0.0, 0.0),
|
|
vec4(0.0, 0.0, length(MODEL_MATRIX[2].xyz), 0.0),
|
|
vec4(0.0, 0.0, 0.0, 1.0));
|
|
|
|
MODELVIEW_NORMAL_MATRIX = mat3(MODELVIEW_MATRIX);
|
|
|
|
//passtrough = INSTANCE_CUSTOM;
|
|
}
|
|
|
|
void fragment() {
|
|
ROUGHNESS = 0.2;
|
|
|
|
vec2 uv = UV * 2.0 - COLOR.xy + (texture(spray_texture, UV * 1.5 + TIME * 0.2 + COLOR.xy * 4.0).zz - (TIME * 0.3)) * 0.2;
|
|
float mist = texture(spray_texture, UV*0.7 + TIME*0.2 - COLOR.xy).x * sin(pow(passtrough.y, 8.0)*PI);
|
|
float foam = (texture(spray_texture, uv).y -0.5) * 2.0 * sin(pow(passtrough.y, 0.5)*PI);
|
|
float mask = max(0, pow((1.3 - length(0.5-UV)*2.5), 2.0-passtrough.y));
|
|
//ALPHA = min(1.0, max(0, texture(spray_texture, UV*0.7 - TIME*0.5 - COLOR.xy).x * sin(pow(passtrough.y, 4.0)*PI) + texture(spray_texture, uv).y -0.5) * 2.0 * sin(pow(passtrough.y, 0.3)*PI) * max(0, pow((1.3 - length(0.5-UV) * 2.0), 1.0+passtrough.y)));
|
|
ALPHA = min(1.0, max(0.0, (foam + mist) * mask));
|
|
ALBEDO = texture(lifetime_gradient, vec2(passtrough.y, 0.5)).xyz;
|
|
BACKLIGHT = ALBEDO;
|
|
//EMISSION = COLOR.xyz * max(0, (1.5-pow(passtrough.y, 0.3)*2.0));
|
|
}
|