diff options
| author | Anson Bridges <bridges.anson@gmail.com> | 2022-09-07 14:16:17 -0400 |
|---|---|---|
| committer | Anson Bridges <bridges.anson@gmail.com> | 2022-09-07 14:16:17 -0400 |
| commit | 366761197034a20d444282431e4a8edeb7882840 (patch) | |
| tree | 63d7b11eccbb499aef8f5afc3634945c63c14ff5 /scenes/environment/Water.tscn | |
| parent | c232b92e2dde1277324d1f89d0e75ae641e4ac3b (diff) | |
whoops, fixed reorg
Diffstat (limited to 'scenes/environment/Water.tscn')
| -rw-r--r-- | scenes/environment/Water.tscn | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/scenes/environment/Water.tscn b/scenes/environment/Water.tscn deleted file mode 100644 index 04410b1..0000000 --- a/scenes/environment/Water.tscn +++ /dev/null @@ -1,109 +0,0 @@ -[gd_scene load_steps=7 format=2] - -[ext_resource path="res://textures/WaterC.jpg" type="Texture" id=1] -[ext_resource path="res://textures/WaterA.jpg" type="Texture" id=2] - -[sub_resource type="QuadMesh" id=1] -size = Vector2( 2, 2 ) - -[sub_resource type="Shader" id=2] -code = "shader_type spatial; -render_mode world_vertex_coords, cull_disabled; - -uniform int ShaderID = 4; - -uniform vec4 Color : hint_color; -uniform vec4 BackgroundColor : hint_color; -uniform sampler2D Texture : hint_albedo; -uniform sampler2D BackgroundTexture : hint_albedo; -varying vec3 TriplanarPosistion; -varying vec3 PowerNormal; -uniform vec3 UVScale = vec3(1); -uniform vec3 UVOffset; -uniform float Transparent = 1.0; -uniform float Power = 0.0; -uniform vec4 EmissionColor : hint_color; - -void vertex() -{ - vec2 Pos = vec2(0); - Pos.x += TIME * 0.05; - TANGENT = vec3(0.0, 0.0, -1.0) * abs(NORMAL.x); - TANGENT += vec3(1.0, 0.0, 0.0) * abs(NORMAL.y); - TANGENT += vec3(1.0, 0.0, 0.0) * abs(NORMAL.z); - TANGENT = normalize(TANGENT); - BINORMAL = vec3(0.0, -1.0, 0.0) * abs(NORMAL.x); - BINORMAL += vec3(0.0, 0.0, 1.0) * abs(NORMAL.y); - BINORMAL += vec3(0.0, -1.0, 0.0) * abs(NORMAL.z); - BINORMAL = normalize(BINORMAL); - PowerNormal = pow(abs(NORMAL), vec3(1.0)); - PowerNormal /= dot(PowerNormal, vec3(1.0)); - TriplanarPosistion = VERTEX * UVScale + UVOffset;// + vec3(Pos.x, Pos.y, 0); - TriplanarPosistion *= vec3(1.0, -1.0, 1.0); -} - - -vec4 TriplanarTexture(sampler2D TSampler,vec3 TWeights,vec3 TTriplanarPosition) -{ - vec4 Sampler = vec4(0.0); - Sampler += texture(TSampler, TTriplanarPosition.xy) * TWeights.z; - Sampler += texture(TSampler, TTriplanarPosition.xz) * TWeights.y; - Sampler += texture(TSampler, TTriplanarPosition.zy * vec2(-1.0, 1.0)) * TWeights.x; - return Sampler; -} - - - -void fragment() -{ - vec3 NewOffset = vec3(0); - NewOffset.x = cos(TIME + TriplanarPosistion.x * 2.0) * 0.05; - NewOffset.z = cos(TIME + TriplanarPosistion.z) * 0.05; - - ALBEDO = TriplanarTexture(BackgroundTexture, PowerNormal, TriplanarPosistion + NewOffset).rgb * BackgroundColor.rgb; - ALBEDO += TriplanarTexture(Texture, PowerNormal, TriplanarPosistion + NewOffset * 5.1).rgb * Color.rgb; - EMISSION = ALBEDO * Power; - - float depth = texture(DEPTH_TEXTURE, SCREEN_UV).r; - depth = depth*2.0 - 1.0; - depth = PROJECTION_MATRIX[3][2] / (depth + PROJECTION_MATRIX[2][2]); - depth = depth + VERTEX.z; - depth = exp(-depth*0.05); - //depth *= 0.01; - ALPHA = clamp(1.0-depth, Transparent, 1.0); -} - - - - -" - -[sub_resource type="ShaderMaterial" id=3] -render_priority = -100 -shader = SubResource( 2 ) -shader_param/ShaderID = 4 -shader_param/Color = Color( 0.270588, 0.372549, 0.423529, 0.490196 ) -shader_param/BackgroundColor = Color( 0.560784, 0.560784, 0.560784, 1 ) -shader_param/UVScale = Vector3( 0.05, 0.05, 0.05 ) -shader_param/UVOffset = null -shader_param/Transparent = 0.4 -shader_param/Power = 0.2 -shader_param/EmissionColor = null -shader_param/Texture = ExtResource( 2 ) -shader_param/BackgroundTexture = ExtResource( 1 ) - -[sub_resource type="BoxShape" id=4] - -[node name="Water" type="Spatial"] - -[node name="MeshInstance" type="MeshInstance" parent="."] -transform = Transform( 1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0 ) -mesh = SubResource( 1 ) -material/0 = SubResource( 3 ) - -[node name="WaterArea" type="Area" parent="."] -collision_layer = 4 - -[node name="CollisionShape" type="CollisionShape" parent="WaterArea"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0 ) -shape = SubResource( 4 ) |
