56 lines
1.6 KiB
Plaintext
56 lines
1.6 KiB
Plaintext
shader_type spatial;
|
|
render_mode blend_add, depth_prepass_alpha, cull_disabled; // blend_add
|
|
|
|
uniform float base_opacity: hint_range(0.0, 1.0) = 0.2;
|
|
|
|
group_uniforms warp;
|
|
uniform bool enable_warp = false;
|
|
uniform vec3 warp_vector = vec3(1.0, 1.0, 1.0);
|
|
uniform float warp_strength : hint_range(0.0, 1.0) = 0.5;
|
|
uniform float warp_rate : hint_range(0.0, 200.0) = 0.5;
|
|
|
|
group_uniforms glow;
|
|
uniform bool glow_enabled;
|
|
uniform float glow_amount = 4.0;
|
|
uniform float glow_intensity = 4.5;
|
|
uniform vec3 glow_colour: source_color;
|
|
|
|
instance uniform float built_amount = 2.0;
|
|
instance uniform vec4 albedo_color : source_color = vec4(1, 1, 1, 1);
|
|
instance uniform vec4 hologram_colour : source_color = vec4(1.0, 0.54, 0.0, 1.0);
|
|
|
|
varying float model_y;
|
|
|
|
vec3 fresnel_glow(float amount, float intensity, vec3 color, vec3 normal, vec3 view) {
|
|
return pow((1.0 - dot(normalize(normal), normalize(view))), amount) * color * intensity;
|
|
}
|
|
|
|
// Called for every vertex the material is visible on.
|
|
void vertex() {
|
|
model_y = VERTEX.y;
|
|
if (enable_warp && VERTEX.y > built_amount) {
|
|
float offset = sin(warp_rate * TIME) * pow(warp_strength, 2);
|
|
VERTEX += offset * warp_vector;
|
|
}
|
|
}
|
|
|
|
// Called for every pixel the material is visible on.
|
|
void fragment() {
|
|
if (model_y > built_amount) {
|
|
vec3 fresnel = vec3(0, 0, 0);
|
|
if (glow_enabled) {
|
|
fresnel = fresnel_glow(glow_amount, glow_intensity, glow_colour, NORMAL, VIEW);
|
|
}
|
|
ALBEDO.rgb = (hologram_colour
|
|
).rgb + fresnel;
|
|
ALPHA = base_opacity;
|
|
} else {
|
|
ALPHA = 1.0;
|
|
ALBEDO.rgb = albedo_color.rgb;
|
|
}
|
|
}
|
|
|
|
// Called for every pixel for every light affecting the material.
|
|
//void light() {
|
|
//}
|