re-rendered all frames for chinthe, added teleport in animation as well as VFX for attack and teleport. rough draft of a setup for map glow.

This commit is contained in:
Pal
2025-10-09 03:23:27 -07:00
parent b0f6aa176e
commit 2786c95c22
1658 changed files with 30211 additions and 639 deletions

View File

@@ -0,0 +1,29 @@
[gd_scene load_steps=5 format=3 uid="uid://cdkcvd7pwmr2r"]
[ext_resource type="PackedScene" uid="uid://6wwibo25iv0f" path="res://src/map/assets/Dungeon Doors/A1DOORWAY.glb" id="1_7s0hs"]
[sub_resource type="PlaneMesh" id="PlaneMesh_pebkc"]
[sub_resource type="PlaneMesh" id="PlaneMesh_y350u"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_x7ln1"]
shading_mode = 0
texture_filter = 0
[node name="Node3D" type="Node3D"]
[node name="A1DOORWAY" parent="." instance=ExtResource("1_7s0hs")]
[node name="MeshInstance3D" type="MeshInstance3D" parent="A1DOORWAY"]
transform = Transform3D(2.08, 0, 0, 0, 2.08, 0, 0, 0, 0.48, 0, 0, 0)
mesh = SubResource("PlaneMesh_pebkc")
[node name="Minimap" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.61193, 0.859072, 0)
[node name="Minimap" type="MeshInstance3D" parent="Minimap"]
unique_name_in_owner = true
transform = Transform3D(2.075, 0, 0, 0, 1, 0, 0, 0, 0.485, 0.6263, -0.983959, 0.00100249)
layers = 2
mesh = SubResource("PlaneMesh_y350u")
surface_material_override/0 = SubResource("StandardMaterial3D_x7ln1")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://c5ekisphioovm"]
[gd_scene load_steps=15 format=3 uid="uid://c5ekisphioovm"]
[ext_resource type="Script" uid="uid://dwt6302nsf4vq" path="res://src/map/dungeon/code/DungeonFloor.cs" id="1_cfhj4"]
[ext_resource type="PackedScene" uid="uid://dhkbvos11tkdw" path="res://src/map/dungeon/rooms/Set A/12. Jump Scare Room.tscn" id="1_crv4e"]
@@ -10,7 +10,8 @@
[ext_resource type="PackedScene" uid="uid://cjxrkxr0bgeh1" path="res://src/map/dungeon/corridors/A - Corridor - Corner .tscn" id="7_y0uwp"]
[ext_resource type="PackedScene" uid="uid://8d6n4tk5aam0" path="res://src/map/dungeon/corridors/A - Corridor - End Piece Straight .tscn" id="8_nv4rm"]
[ext_resource type="PackedScene" uid="uid://8u5kue6pljh0" path="res://src/map/dungeon/corridors/A - Corridor - T-Block.tscn" id="9_n5246"]
[ext_resource type="PackedScene" uid="uid://6wwibo25iv0f" path="res://src/map/assets/Dungeon Doors/A1DOORWAY.glb" id="10_yrcgx"]
[ext_resource type="PackedScene" uid="uid://cam640h4euewx" path="res://src/map/dungeon/rooms/Set A/05. Pit Room A.tscn" id="12_4sygy"]
[ext_resource type="PackedScene" uid="uid://cdkcvd7pwmr2r" path="res://src/map/assets/Dungeon Doors/DOORA.tscn" id="12_hkp1m"]
[sub_resource type="Environment" id="Environment_yrcgx"]
background_mode = 1
@@ -131,6 +132,9 @@ transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -53.82
[node name="Node3D8" parent="Corridors" instance=ExtResource("6_hsujv")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -53.8223, 0, -10.0189)
[node name="Node3D8" parent="Corridors/Node3D8" instance=ExtResource("6_hsujv")]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, -8.59965, -0.00168645, -51.6956)
[node name="Node3D9" parent="Corridors" instance=ExtResource("6_hsujv")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -53.8223, 0, -14.0189)
@@ -179,8 +183,8 @@ transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -2.084
[node name="Node3D29" parent="Corridors" instance=ExtResource("7_y0uwp")]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -8.0497, 0, 51.9862)
[node name="A1DOORWAY" parent="." instance=ExtResource("10_yrcgx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -30.0831, 0, 11)
[node name="Pit Room A" parent="." instance=ExtResource("12_4sygy")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -20.095, 0, -56.669)
[node name="A1DOORWAY2" parent="." instance=ExtResource("10_yrcgx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.07064, 0, -15)
[node name="Node3D" parent="." instance=ExtResource("12_hkp1m")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -30.1149, -0.0400015, 11.7445)

View File

@@ -771,6 +771,7 @@ shader_parameter/ssr_screen_fade = 0.05
script = ExtResource("1_j4ho3")
[node name="Model" type="Node3D" parent="."]
transform = Transform3D(1.3, 0, 0, 0, 1.3, 0, 0, 0, 1.3, 0, 0.52099, 0)
[node name="GoG Room mirrored" type="Node3D" parent="Model"]
@@ -810,6 +811,7 @@ mesh = SubResource("ArrayMesh_oeav2")
skeleton = NodePath("")
[node name="Collision" type="Node3D" parent="."]
transform = Transform3D(1.3, 0, 0, 0, 1.3, 0, 0, 0, 1.3, 0, 0.52099, 0)
visible = false
[node name="Maze" type="StaticBody3D" parent="Collision"]
@@ -1052,18 +1054,18 @@ shape = SubResource("CylinderShape3D_xwr0f")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -81.8501, 4.43835, -13.2627)
shape = SubResource("CylinderShape3D_1pour")
[node name="Doors" type="Node3D" parent="."]
[node name="Spawn Points" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -66.2332)
transform = Transform3D(1.3, 0, 0, 0, 1.3, 0, 0, 0, 1.3, 0, 0.52099, -66.2332)
[node name="PlayerSpawn" type="Marker3D" parent="Spawn Points"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.87173, -1.37707, 2.25211)
transform = Transform3D(1.3, 0, 0, 0, 1.3, 0, 0, 0, 1.3, -1.87173, -1.07068, -13.6911)
[node name="Room" type="Node3D" parent="."]
transform = Transform3D(1.3, 0, 0, 0, 1.3, 0, 0, 0, 1.3, 0, 0.52099, 0)
[node name="Minimap" type="Node3D" parent="."]
transform = Transform3D(1.3, 0, 0, 0, 1.3, 0, 0, 0, 1.3, 0, 0.52099, 0)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_1t8a7")

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=76 format=4 uid="uid://cam640h4euewx"]
[gd_scene load_steps=79 format=4 uid="uid://cam640h4euewx"]
[ext_resource type="Script" uid="uid://dhollu4j3pynq" path="res://src/map/dungeon/code/MonsterRoom.cs" id="1_5ni02"]
[ext_resource type="PackedScene" uid="uid://c67r6e54ilvyv" path="res://src/map/dungeon/models/Area 1/Pit/pitroomupdate.glb" id="2_7cn32"]
@@ -794,13 +794,78 @@ radius = 2.0
[sub_resource type="BoxShape3D" id="BoxShape3D_c4wqw"]
size = Vector3(36, 8, 36)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_06rpm"]
albedo_texture = ExtResource("6_5ju0l")
emission_enabled = true
emission = Color(1, 1, 1, 1)
emission_energy_multiplier = 0.0
texture_filter = 0
[sub_resource type="PlaneMesh" id="PlaneMesh_gx7da"]
material = SubResource("StandardMaterial3D_06rpm")
size = Vector2(36, 36)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_06rpm"]
shading_mode = 0
albedo_texture = ExtResource("6_5ju0l")
texture_filter = 0
[sub_resource type="Animation" id="Animation_c4wqw"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../AnimationPlayer/OmniLight3D:omni_attenuation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.091]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("../AnimationPlayer/OmniLight3D:light_energy")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [1.0]
}
[sub_resource type="Animation" id="Animation_7cn32"]
resource_name = "new_animation"
length = 2.5
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("../AnimationPlayer/OmniLight3D:omni_attenuation")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 2.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.091, 0.091]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("../AnimationPlayer/OmniLight3D:light_energy")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1.26667, 2.5),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [3.0, 6.0, 3.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_eb182"]
_data = {
&"RESET": SubResource("Animation_c4wqw"),
&"new_animation": SubResource("Animation_7cn32")
}
[sub_resource type="Curve" id="Curve_7744s"]
_limits = [-2.0, 2.0, 0.0, 1.0]
@@ -844,6 +909,7 @@ script = ExtResource("1_5ni02")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9.0746, 5.13098, 26.6426)
light_color = Color(1.97336e-06, 0.703962, 0.150021, 1)
light_energy = 0.155
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 11.236
omni_attenuation = -0.343
@@ -852,6 +918,7 @@ omni_attenuation = -0.343
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 27.8411, 5.13098, 27.8112)
light_color = Color(1.97336e-06, 0.703962, 0.150021, 1)
light_energy = 0.155
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 11.236
omni_attenuation = -0.343
@@ -860,6 +927,7 @@ omni_attenuation = -0.343
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 27.1805, 5.13098, 7.72368)
light_color = Color(1.97336e-06, 0.703962, 0.150021, 1)
light_energy = 0.155
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 11.236
omni_attenuation = -0.343
@@ -868,6 +936,7 @@ omni_attenuation = -0.343
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9.49731, 5.13098, 8.48584)
light_color = Color(1.97336e-06, 0.703962, 0.150021, 1)
light_energy = 0.155
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 11.236
omni_attenuation = -0.343
@@ -876,6 +945,7 @@ omni_attenuation = -0.343
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18, 0, 18)
[node name="pitroomupdate" parent="A1-Pit" instance=ExtResource("2_7cn32")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.30241)
[node name="Ceiling Structure 2" type="MeshInstance3D" parent="A1-Pit"]
transform = Transform3D(-3.13664, -4.72924e-07, 3.87385e-07, 4.7362e-07, 0, 2.56553, -4.7362e-07, 3.13204, 5.84935e-14, 0.0952569, 9.30535, 0.0901994)
@@ -1114,11 +1184,23 @@ shape = SubResource("BoxShape3D_c4wqw")
[node name="Minimap" type="MeshInstance3D" parent="Minimap"]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18, 0, 18)
visible = false
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18, 0, 17.9999)
layers = 2
mesh = SubResource("PlaneMesh_gx7da")
surface_material_override/0 = SubResource("StandardMaterial3D_06rpm")
[node name="AnimationPlayer" type="AnimationPlayer" parent="Minimap"]
root_node = NodePath("../Minimap")
libraries = {
&"": SubResource("AnimationLibrary_eb182")
}
autoplay = "new_animation"
[node name="OmniLight3D" type="OmniLight3D" parent="Minimap/AnimationPlayer"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18.0173, 17.2525, 17.6794)
layers = 2
light_cull_mask = 4294967294
omni_range = 4096.0
omni_attenuation = 0.091
[node name="GPUParticles3D2" type="GPUParticles3D" parent="."]
transform = Transform3D(0.869, 0, 0, 0, 0.332, 0, 0, 0, 0.967, 18.031, 4.51225, 17.599)
@@ -1132,6 +1214,7 @@ draw_pass_1 = SubResource("QuadMesh_1b53s")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 22.8063, 1.72011, 17.7728)
light_color = Color(0.288422, 0.532296, 0.224511, 1)
light_energy = 1.875
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 16.104
@@ -1139,6 +1222,7 @@ omni_range = 16.104
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 13.2248, 1.72011, 18.0123)
light_color = Color(0.288422, 0.532296, 0.224511, 1)
light_energy = 1.875
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 16.104
@@ -1146,6 +1230,7 @@ omni_range = 16.104
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14.5594, 1.72011, 14.6588)
light_color = Color(0.288422, 0.532296, 0.224511, 1)
light_energy = 1.875
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 16.104
@@ -1153,6 +1238,7 @@ omni_range = 16.104
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14.6107, 1.72011, 21.4342)
light_color = Color(0.288422, 0.532296, 0.224511, 1)
light_energy = 1.875
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 16.104
@@ -1160,6 +1246,7 @@ omni_range = 16.104
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18.1011, 1.72011, 22.7346)
light_color = Color(0.288422, 0.532296, 0.224511, 1)
light_energy = 1.875
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 16.104
@@ -1167,6 +1254,7 @@ omni_range = 16.104
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.5231, 1.72011, 21.2803)
light_color = Color(0.288422, 0.532296, 0.224511, 1)
light_energy = 1.875
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 16.104
@@ -1174,6 +1262,7 @@ omni_range = 16.104
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 17.8616, 1.72011, 13.2044)
light_color = Color(0.288422, 0.532296, 0.224511, 1)
light_energy = 1.875
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 16.104
@@ -1181,6 +1270,7 @@ omni_range = 16.104
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.3349, 1.72011, 14.385)
light_color = Color(0.288422, 0.532296, 0.224511, 1)
light_energy = 1.875
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 16.104
@@ -1188,6 +1278,7 @@ omni_range = 16.104
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.6428, 1.72011, 21.2631)
light_color = Color(0.288422, 0.532296, 0.224511, 1)
light_energy = 1.875
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 16.104
@@ -1195,6 +1286,7 @@ omni_range = 16.104
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18.28, 0.166375, 18.488)
light_color = Color(0.288422, 0.532296, 0.224511, 1)
light_energy = 1.875
light_cull_mask = 4294967293
shadow_enabled = true
omni_range = 7.598
omni_attenuation = 1.969

View File

@@ -0,0 +1,244 @@
shader_type spatial;
render_mode world_vertex_coords, cull_disabled;
uniform sampler2D screen : hint_screen_texture, filter_linear_mipmap_anisotropic, repeat_disable;
group_uniforms colours;
uniform vec3 surfacecolour : source_color;
uniform vec3 volumecolour : source_color;
group_uniforms material;
uniform float AirIOR = 1.0;
uniform float IOR = 1.33;
group_uniforms textures;
uniform vec2 sampler1speed = vec2(0.02, 0.0);
uniform vec2 sampler2speed = vec2(0.0, 0.02);
uniform float samplermix : hint_range(0.0, 1.0, 0.1) = 0.5;
uniform vec2 samplerscale = vec2(0.1);
uniform sampler2D normal1tex : filter_linear_mipmap_anisotropic, hint_normal;
uniform sampler2D normal2tex : filter_linear_mipmap_anisotropic, hint_normal;
uniform float normalstrength : hint_range(0.0, 5.0, 0.01) = 1.0;
uniform sampler2D height1tex : filter_linear_mipmap_anisotropic;
uniform sampler2D height2tex : filter_linear_mipmap_anisotropic;
uniform float heightstrength : hint_range(0.0, 5.0, 0.01) = 0.12;
uniform sampler2D edge1tex : filter_linear_mipmap_anisotropic;
uniform sampler2D edge2tex : filter_linear_mipmap_anisotropic;
varying vec2 position;
varying vec3 wposition;
group_uniforms refraction;
uniform float refrationamount : hint_range(0.0, 1.0, 0.01);
uniform bool fog_underwater;
group_uniforms edge;
uniform float edge_size : hint_range(0.01, 0.5, 0.01) = 0.1;
uniform bool foam_or_fade = false;
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap, repeat_disable;
group_uniforms screen_space_reflection;
uniform float far_clip = 50.0;
uniform int steps : hint_range(64, 1024, 16) = 512;
uniform float ssr_screen_fade : hint_range(0.01, 0.5, 0.01) = 0.05;
float schlickfresnel(float ior1, float ior2, vec3 view, vec3 norm) {
float incident = dot(view, norm);
float reflectance = pow(((ior2 - ior1)/(ior2 + ior1)), 2.0);
float fresnelincident = reflectance + (1.0 - reflectance) * pow(1.0 - cos(incident), 5.0);
return(fresnelincident / incident);
}
void vertex() {
position = VERTEX.xz;
UV = VERTEX.xz * samplerscale + (sampler1speed * TIME);
UV2 = VERTEX.xz * samplerscale + (sampler2speed * TIME);
float height = mix(texture(height1tex, UV),texture(height2tex, UV2),samplermix).x;
VERTEX.y += (height - 0.5) * heightstrength;
wposition = VERTEX;
// Called for every vertex the material is visible on.
}
float snells_window(vec3 normal, vec3 view, float ior) {
float cos_theta = dot(normal, view);
return step(sqrt(1.0 - cos_theta * cos_theta) * ior, 1.0);
}
float linear_depth(float nonlinear_depth, mat4 inv_projection_matrix) {
return 1.0 / (nonlinear_depth * inv_projection_matrix[2].w + inv_projection_matrix[3].w);
}
float nonlinear_depth(float linear_depth, mat4 inv_projection_matrix) {
return (1.0 / linear_depth - inv_projection_matrix[3].w) / inv_projection_matrix[2].w;
}
vec2 view2uv(vec3 position_view_space, mat4 proj_m)
{
vec4 position_clip_space = proj_m * vec4(position_view_space.xyz, 1.0);
vec2 position_ndc = position_clip_space.xy / position_clip_space.w;
return position_ndc.xy * 0.5 + 0.5;
}
float remap(float x, float min1, float max1, float min2, float max2) {
return ((x - min1) / (max1 - min1) + min2) * (max2 - min2);
}
float remap1(float x, float min1, float max1) {
return (x - min1) / (max1 - min1);
}
float edge_fade(vec2 uv, float size) {
float x1 = clamp(remap1(uv.x, 0.0, size), 0.0, 1.0);
float x2 = clamp(remap1(uv.x, 1.0, 1.0 - size), 0.0, 1.0);
float y1 = clamp(remap1(uv.y, 0.0, size), 0.0, 1.0);
float y2 = clamp(remap1(uv.y, 1.0, 1.0 - size), 0.0, 1.0);
return x1*x2*y1*y2;
}
void fragment() {
vec3 onorm = NORMAL;
vec2 normmap = mix(texture(normal1tex, UV),texture(normal2tex, UV2),samplermix).xy;
NORMAL += TANGENT * (normmap.x - 0.5) * normalstrength;
NORMAL += BINORMAL * (normmap.y - 0.5) * normalstrength;
vec3 wnorm = (vec4(NORMAL, 0.0) * VIEW_MATRIX).xyz;
vec3 wview = (vec4(VIEW, 0.0) * VIEW_MATRIX).xyz;
if (FRONT_FACING) {
ROUGHNESS = 0.0;
METALLIC = 1.0;
SPECULAR = 0.0;
float fres = schlickfresnel(AirIOR, IOR, VIEW, NORMAL);
ALBEDO = surfacecolour * fres;
// REFRACTION
float lineardepth = linear_depth(texture(DEPTH_TEXTURE, SCREEN_UV).r, INV_PROJECTION_MATRIX);
float selfdepth = -VERTEX.z;
float depth_diff = lineardepth - selfdepth;
vec3 tanx = BINORMAL * (normmap.x - 0.5) * normalstrength;
vec3 tany = TANGENT * (normmap.y - 0.5) * normalstrength;
vec2 refracted_uv = SCREEN_UV + (tanx + tany).xy * refrationamount * depth_diff / lineardepth;
float newdepth = linear_depth(texture(DEPTH_TEXTURE, refracted_uv).r, INV_PROJECTION_MATRIX);
//float selfdepth = 1.0/(1.0 + 2.0 * distance(wposition, CAMERA_POSITION_WORLD));
vec3 newvolcolour = mix(volumecolour, vec3(1.0), clamp(1.0 / (depth_diff * 1.0), 0.0, 1.0));
EMISSION = newvolcolour * texture(screen, refracted_uv).rgb;
if (newdepth < selfdepth) {
EMISSION = newvolcolour * texture(screen, SCREEN_UV).rgb;
}
// SSR
vec3 reflected = -reflect(VIEW, NORMAL);
vec3 pos = VERTEX;
int curstep = 0;
bool finished = false;
vec2 uv;
float currentdepth;
while (curstep < steps) {
float step_scale = float(curstep + 1) / float(steps);
float step_dist = step_scale * step_scale * far_clip;
pos += reflected * step_dist;
curstep += 1;
currentdepth = -pos.z;
uv = view2uv(pos, PROJECTION_MATRIX);
if (!(uv.x < 1.0 && uv.y < 1.0 && uv.x > 0.0 && uv.y > 0.0)) {
break;
}
float testdepth = linear_depth(texture(DEPTH_TEXTURE, uv).r, INV_PROJECTION_MATRIX);
if (testdepth < currentdepth) {
finished = true;
break;
}
}
if (finished && currentdepth < far_clip * 0.99) {
ALBEDO *= 1.0 - edge_fade(uv, ssr_screen_fade);
METALLIC *= 1.0 - edge_fade(uv, ssr_screen_fade);
EMISSION += texture(screen, uv).xyz * schlickfresnel(1.0, 1.33, VIEW, NORMAL) * edge_fade(uv, ssr_screen_fade);
}
// EDGE EFFECT
float distfromedge = depth_diff * dot(normalize(NORMAL), normalize(-VERTEX)) / VIEW.z;
if (distfromedge < edge_size) {
distfromedge /= edge_size;
if (foam_or_fade) {
ALPHA = distfromedge;
} else {
float edgetex = mix(texture(edge1tex, UV).r, texture(edge2tex, UV2).r, samplermix);
if (edgetex > distfromedge) {
ALBEDO = vec3(1.0);
ROUGHNESS = 1.0;
METALLIC = 1.0;
EMISSION = vec3(0.0);
NORMAL = onorm;
}
}
}
} else {
// SNELLS WINDOW
float window = snells_window(wnorm, wview, IOR);
if (window > 0.5) {
ROUGHNESS = 1.0;
METALLIC = 1.0;
ALBEDO = vec3(0.0);
SPECULAR = 0.0;
float linear_depth = 1.0 / (texture(DEPTH_TEXTURE, SCREEN_UV).r * INV_PROJECTION_MATRIX[2].w + INV_PROJECTION_MATRIX[3].w);
float selfdepth = 1.0 / (FRAGCOORD.z * INV_PROJECTION_MATRIX[2].w + INV_PROJECTION_MATRIX[3].w);
float depth_diff = linear_depth - selfdepth;
vec3 tanx = BINORMAL * (normmap.x - 0.5) * normalstrength;
vec3 tany = TANGENT * (normmap.y - 0.5) * normalstrength;
float newdepth = 1.0 / (texture(DEPTH_TEXTURE, SCREEN_UV + (tanx + tany).xy * refrationamount).r * INV_PROJECTION_MATRIX[2].w + INV_PROJECTION_MATRIX[3].w);
//float selfdepth = 1.0/(1.0 + 2.0 * distance(wposition, CAMERA_POSITION_WORLD));
vec3 newvolcolour = mix(volumecolour, vec3(1.0), clamp(1.0 / (selfdepth * 1.0), 0.0, 1.0));
if (!fog_underwater) {
newvolcolour = vec3(1.0);
}
EMISSION = newvolcolour * texture(screen, SCREEN_UV + (tanx + tany).xy * refrationamount).rgb;
} else {
ALBEDO = surfacecolour;
ROUGHNESS = 0.0;
METALLIC = 1.0;
// SSR
vec3 reflected = -reflect(VIEW, NORMAL);
vec3 pos = VERTEX;
int curstep = 0;
bool finished = false;
vec2 uv;
float currentdepth;
while (curstep < steps) {
float step_scale = float(curstep + 1) / float(steps);
float step_dist = step_scale * step_scale * far_clip;
pos += reflected * step_dist;
curstep += 1;
currentdepth = -pos.z;
uv = view2uv(pos, PROJECTION_MATRIX);
if (!(uv.x < 1.0 && uv.y < 1.0 && uv.x > 0.0 && uv.y > 0.0)) {
break;
}
float testdepth = linear_depth(texture(DEPTH_TEXTURE, uv).r, INV_PROJECTION_MATRIX);
if (testdepth < currentdepth) {
finished = true;
break;
}
}
if (finished && currentdepth < far_clip * 0.99) {
ALBEDO *= 1.0 - edge_fade(uv, ssr_screen_fade);
METALLIC *= 1.0 - edge_fade(uv, ssr_screen_fade);
EMISSION += texture(screen, uv).xyz * schlickfresnel(1.0, 1.33, VIEW, NORMAL) * edge_fade(uv, ssr_screen_fade);
}
}
}
}

View File

@@ -0,0 +1 @@
uid://xaibn4lwsd17