[gd_resource type="ShaderMaterial" load_steps=6 format=2] [sub_resource type="Shader" id=1] code = "shader_type spatial; render_mode cull_disabled; uniform sampler2D texture; uniform sampler2D blendTexture; uniform sampler2D noiseTexture; uniform float offset = 0.; uniform bool up = true; uniform vec4 borderColor: hint_color = vec4(1., 1., 0., 1.); uniform float borderHeight = 0.1; uniform float waveAmplitude = 1.; uniform float waveFrequency = 1.; uniform float wavePhase = 0.1; uniform float emissionIntensity = 1.; uniform float noiseSpeed = .01; uniform float noiseInfluence = 1.; uniform vec2 blendUVScale = vec2(1.); uniform vec2 noiseUVScale = vec2(1.); uniform vec2 textureUVScale = vec2(1.); const float tao = 2. * 3.14; // https://github.com/godotengine/godot/issues/19800 uniform mat4 global_transform; varying vec3 world_pos; void vertex(){ world_pos = (global_transform * vec4(VERTEX, 1.0)).xyz; } void fragment() { vec3 position = world_pos; vec4 text = texture(texture, UV); vec4 blend = texture(blendTexture, UV * blendUVScale); vec2 st = UV; st.y -= TIME * noiseSpeed; vec4 noise = texture(noiseTexture, st * noiseUVScale); float x = tao * position.x; float waveFrequency1 = waveFrequency; float waveFrequency2 = waveFrequency + 2. - wavePhase; float waveFrequency3 = waveFrequency + 3. - wavePhase; position.y += waveAmplitude * (sin(x / waveFrequency1) + sin(x / waveFrequency2) + sin(x / waveFrequency3)); position.y += (noise.r * noiseInfluence); float direction = up ? 1. : -1.; float upperBorder = smoothstep(offset, offset, (position.y * direction) + 1.); float bottomBorder = smoothstep(offset, offset, (position.y * direction) - borderHeight + 1.); float borderPart = upperBorder - bottomBorder; vec4 color = mix(blend, borderColor, upperBorder); color = mix(color, text, bottomBorder); ALBEDO = color.rgb; if (!FRONT_FACING) { ALBEDO = borderColor.rgb; NORMAL = VIEW; } ALPHA = color.a; ALPHA_SCISSOR = 1.0; EMISSION = vec3(borderPart) * borderColor.rgb * emissionIntensity; } " [sub_resource type="Gradient" id=2] offsets = PoolRealArray( 0, 0.996575, 1 ) colors = PoolColorArray( 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0 ) [sub_resource type="GradientTexture" id=3] gradient = SubResource( 2 ) [sub_resource type="OpenSimplexNoise" id=5] [sub_resource type="NoiseTexture" id=4] seamless = true noise = SubResource( 5 ) [resource] resource_local_to_scene = true shader = SubResource( 1 ) shader_param/offset = 0.147 shader_param/up = true shader_param/borderColor = Color( 1, 1, 1, 0 ) shader_param/borderHeight = 0.0 shader_param/waveAmplitude = 1.0 shader_param/waveFrequency = 1.0 shader_param/wavePhase = 0.1 shader_param/emissionIntensity = 1.0 shader_param/noiseSpeed = 0.0 shader_param/noiseInfluence = 1.0 shader_param/blendUVScale = Vector2( 1, 1 ) shader_param/noiseUVScale = Vector2( 1, 1 ) shader_param/textureUVScale = Vector2( 1, 1 ) shader_param/global_transform = null shader_param/blendTexture = SubResource( 3 ) shader_param/noiseTexture = SubResource( 4 )