This is an image of the shield's shader that I want to recreate in my project.
As you can see, the impact shader doesn't works by lighting up an entire shield when it gets hit by the bullet. Because the impact area effect is limited, so only a small area lights up when it got hit by a bullet.
I try to do something similar with this, but I don't know how make this impact effect for the shield. I spent hours but couldn't find any tutorial videos about this, so I'm currently exhausted and in need for your help.
Here is the simple shader for the shield I made by following a tutorial:
shader_type spatial;
render_mode blend_mix,depth_draw_always,cull_back,diffuse_burley,specular_schlick_ggx;//depth_test_disable;
uniform vec4 albedo : hint_color;
uniform vec4 emission_color : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float emission_amount: hint_range(0.0, 16.0) = 5.0f;
uniform float rim_steepness : hint_range(0.0f, 16.0f) = 3.0f; //higher values mean a smaller rim.
uniform vec3 uv_scale;
uniform vec3 uv_offset;
void vertex() {
UV=UV*uv_scale.xy+uv_offset.xy;
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
ALBEDO = albedo.rgb * albedo_tex.rgb;
EMISSION = emission_color.rgb * emission_amount;
float PI = 3.14159265359;
float NdotV = dot(NORMAL, VIEW);
float rim_light = pow(1.0 - NdotV, rim_steepness);
ALPHA = rim_light * emission_color.a / PI;
}
Please let me know if you have any questions, and I will try to answer them as fast as possible. Thanks for your help and I wish you a good day.