这是我想在我的项目中重新创建的盾牌着色器的图像。
如您所见,冲击着色器不会在被子弹击中时点亮整个盾牌。因为影响区域效果有限,所以被子弹击中时只有一小块区域亮起来
我尝试用这个做类似的事情,但我不知道如何为盾牌制作这种冲击效果。我花了几个小时,但找不到任何关于此的教程视频,所以我现在很累,需要你的帮助。
这是我按照教程制作的盾牌简单着色器:
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;
}
如果您有任何问题,请告诉我,我会尽快回答。感谢您的帮助,祝您有美好的一天。