Better bullet traces and raycast for hitscan

This commit is contained in:
2025-01-26 10:59:59 +01:00
parent 1c8458048c
commit 7da4a3d6bb
26 changed files with 1444 additions and 292 deletions

View File

@ -0,0 +1,16 @@
shader_type spatial;
render_mode unshaded, depth_draw_never;
uniform vec4 shine_color : source_color = vec4( 1.0, 1.0, 1.0, 1.0 );
uniform float cycle_interval : hint_range(0.5, 5.0) = 1.0;
uniform float shine_speed : hint_range(1.0, 5.0) = 3.0;
uniform float shine_width : hint_range(1.0, 100.0) = 3.0;
void fragment( )
{
vec3 vertex = ( INV_VIEW_MATRIX * vec4( VERTEX, 1.0 ) ).xyz;
float width = shine_width * 0.001 * cycle_interval;
float frequency = floor( sin( vertex.z * cycle_interval + TIME * shine_speed * cycle_interval ) + width );
ALBEDO = shine_color.rgb;
ALPHA = clamp( ( 1.0 - dot( NORMAL, VIEW ) ) * frequency * shine_color.a, 0.0, 1.0 );
}