diff --git a/assets/materials/gunk_overlay_bright.material b/assets/materials/gunk_overlay_bright.material index 7845c90..18b7e2f 100644 Binary files a/assets/materials/gunk_overlay_bright.material and b/assets/materials/gunk_overlay_bright.material differ diff --git a/levels/sandbox/sandbox.tscn b/levels/sandbox/sandbox.tscn index 82e1a84..2279a3e 100644 --- a/levels/sandbox/sandbox.tscn +++ b/levels/sandbox/sandbox.tscn @@ -91,7 +91,7 @@ seamless = true seamless_blend_skirt = 0.5 noise = ExtResource("6_l64ek") -[sub_resource type="ShaderMaterial" id="ShaderMaterial_6lnam"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_lorhs"] resource_local_to_scene = true render_priority = 0 shader = ExtResource("5_rdjtm") @@ -171,7 +171,7 @@ seamless = true seamless_blend_skirt = 0.5 noise = ExtResource("6_l64ek") -[sub_resource type="ShaderMaterial" id="ShaderMaterial_lorhs"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_v2ya2"] resource_local_to_scene = true render_priority = 0 shader = ExtResource("5_rdjtm") @@ -236,7 +236,7 @@ shadow_mesh = SubResource("ArrayMesh_i3ihq") [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_0qjrr"] data = PackedVector3Array(-4, 4, 4, -4, -4, 4, -4, 4, -4, -4, 4, -4, -4, -4, 4, -4, -4, -4, -4, 4, -4, -4, -4, -4, 4, 4, -4, 4, 4, -4, -4, -4, -4, 4, -4, -4, 4, 4, -4, 4, -4, -4, 4, 4, 4, 4, 4, 4, 4, -4, -4, 4, -4, 4, 4, 4, 4, 4, -4, 4, -4, 4, 4, -4, 4, 4, 4, -4, 4, -4, -4, 4, 4, -4, -4, -4, -4, -4, 4, -4, 4, 4, -4, 4, -4, -4, -4, -4, -4, 4, -4, 4, -4, 4, 4, -4, -4, 4, 4, -4, 4, 4, 4, 4, -4, 4, 4, 4) -[sub_resource type="ShaderMaterial" id="ShaderMaterial_v2ya2"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_60cnp"] resource_local_to_scene = true render_priority = 0 shader = ExtResource("5_rdjtm") @@ -303,7 +303,7 @@ shadow_mesh = SubResource("ArrayMesh_jllhp") [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_6ood3"] data = PackedVector3Array(-0.0001, 6, -4, -0.0001, -6, -4, 0.7803, 6, -3.9232, 0.7803, 6, -3.9232, -0.0001, -6, -4, 0.7803, -6, -3.9232, 0.7803, 6, -3.9232, 0.7803, -6, -3.9232, 1.5307, 6, -3.6956, 1.5307, 6, -3.6956, 0.7803, -6, -3.9232, 1.5307, -6, -3.6956, 1.5307, 6, -3.6956, 1.5307, -6, -3.6956, 2.2223, 6, -3.3259, 2.2223, 6, -3.3259, 1.5307, -6, -3.6956, 2.2223, -6, -3.3259, 2.2223, 6, -3.3259, 2.2223, -6, -3.3259, 2.8284, 6, -2.8285, 2.8284, 6, -2.8285, 2.2223, -6, -3.3259, 2.8284, -6, -2.8285, 2.8284, 6, -2.8285, 2.8284, -6, -2.8285, 3.3258, 6, -2.2224, 3.3258, 6, -2.2224, 2.8284, -6, -2.8285, 3.3258, -6, -2.2224, 3.3258, 6, -2.2224, 3.3258, -6, -2.2224, 3.6954, 6, -1.5308, 3.6954, 6, -1.5308, 3.3258, -6, -2.2224, 3.6954, -6, -1.5308, 3.6954, 6, -1.5308, 3.6954, -6, -1.5308, 3.9231, 6, -0.7805, 3.9231, 6, -0.7805, 3.6954, -6, -1.5308, 3.9231, -6, -0.7805, 3.9231, 6, -0.7805, 3.9231, -6, -0.7805, 4, 6, -0.0001, 4, 6, -0.0001, 3.9231, -6, -0.7805, 4, -6, -0.0001, 4, 6, -0.0001, 4, -6, -0.0001, 3.9231, 6, 0.7803, 3.9231, 6, 0.7803, 4, -6, -0.0001, 3.9231, -6, 0.7803, 3.9231, 6, 0.7803, 3.9231, -6, 0.7803, 3.6954, 6, 1.5307, 3.6954, 6, 1.5307, 3.9231, -6, 0.7803, 3.6954, -6, 1.5307, 3.6954, 6, 1.5307, 3.6954, -6, 1.5307, 3.3258, 6, 2.2223, 3.3258, 6, 2.2223, 3.6954, -6, 1.5307, 3.3258, -6, 2.2223, 3.3258, 6, 2.2223, 3.3258, -6, 2.2223, 2.8284, 6, 2.8284, 2.8284, 6, 2.8284, 3.3258, -6, 2.2223, 2.8284, -6, 2.8284, 2.8284, 6, 2.8284, 2.8284, -6, 2.8284, 2.2223, 6, 3.3258, 2.2223, 6, 3.3258, 2.8284, -6, 2.8284, 2.2223, -6, 3.3258, 2.2223, 6, 3.3258, 2.2223, -6, 3.3258, 1.5307, 6, 3.6954, 1.5307, 6, 3.6954, 2.2223, -6, 3.3258, 1.5307, -6, 3.6954, 1.5307, 6, 3.6954, 1.5307, -6, 3.6954, 0.7803, 6, 3.9231, 0.7803, 6, 3.9231, 1.5307, -6, 3.6954, 0.7803, -6, 3.9231, 0.7803, 6, 3.9231, 0.7803, -6, 3.9231, -0.0001, 6, 4, -0.0001, 6, 4, 0.7803, -6, 3.9231, -0.0001, -6, 4, -0.0001, 6, 4, -0.0001, -6, 4, -0.7805, 6, 3.9231, -0.7805, 6, 3.9231, -0.0001, -6, 4, -0.7805, -6, 3.9231, -0.7805, 6, 3.9231, -0.7805, -6, 3.9231, -1.5308, 6, 3.6954, -1.5308, 6, 3.6954, -0.7805, -6, 3.9231, -1.5308, -6, 3.6954, -1.5308, 6, 3.6954, -1.5308, -6, 3.6954, -2.2224, 6, 3.3258, -2.2224, 6, 3.3258, -1.5308, -6, 3.6954, -2.2224, -6, 3.3258, -2.2224, 6, 3.3258, -2.2224, -6, 3.3258, -2.8285, 6, 2.8284, -2.8285, 6, 2.8284, -2.2224, -6, 3.3258, -2.8285, -6, 2.8284, -2.8285, 6, 2.8284, -2.8285, -6, 2.8284, -3.3259, 6, 2.2223, -3.3259, 6, 2.2223, -2.8285, -6, 2.8284, -3.3259, -6, 2.2223, -3.3259, 6, 2.2223, -3.3259, -6, 2.2223, -3.6956, 6, 1.5307, -3.6956, 6, 1.5307, -3.3259, -6, 2.2223, -3.6956, -6, 1.5307, -3.6956, 6, 1.5307, -3.6956, -6, 1.5307, -3.9232, 6, 0.7803, -3.9232, 6, 0.7803, -3.6956, -6, 1.5307, -3.9232, -6, 0.7803, -3.9232, 6, 0.7803, -3.9232, -6, 0.7803, -4, 6, -0.0001, -4, 6, -0.0001, -3.9232, -6, 0.7803, -4, -6, -0.0001, -4, 6, -0.0001, -4, -6, -0.0001, -3.9232, 6, -0.7805, -3.9232, 6, -0.7805, -4, -6, -0.0001, -3.9232, -6, -0.7805, -3.9232, 6, -0.7805, -3.9232, -6, -0.7805, -3.6956, 6, -1.5308, -3.6956, 6, -1.5308, -3.9232, -6, -0.7805, -3.6956, -6, -1.5308, -3.6956, 6, -1.5308, -3.6956, -6, -1.5308, -3.3259, 6, -2.2224, -3.3259, 6, -2.2224, -3.6956, -6, -1.5308, -3.3259, -6, -2.2224, -3.3259, 6, -2.2224, -3.3259, -6, -2.2224, -2.8285, 6, -2.8285, -2.8285, 6, -2.8285, -3.3259, -6, -2.2224, -2.8285, -6, -2.8285, -2.8285, 6, -2.8285, -2.8285, -6, -2.8285, -2.2224, 6, -3.3259, -2.2224, 6, -3.3259, -2.8285, -6, -2.8285, -2.2224, -6, -3.3259, -2.2224, 6, -3.3259, -2.2224, -6, -3.3259, -1.5308, 6, -3.6956, -1.5308, 6, -3.6956, -2.2224, -6, -3.3259, -1.5308, -6, -3.6956, -0.0001, 6, -4, 0.7803, 6, -3.9232, -0.7805, 6, -3.9232, -0.7805, 6, -3.9232, 0.7803, 6, -3.9232, -1.5308, 6, -3.6956, -1.5308, 6, -3.6956, 0.7803, 6, -3.9232, -2.2224, 6, -3.3259, -2.2224, 6, -3.3259, 0.7803, 6, -3.9232, -2.8285, 6, -2.8285, -2.8285, 6, -2.8285, 0.7803, 6, -3.9232, -3.3259, 6, -2.2224, -3.3259, 6, -2.2224, 0.7803, 6, -3.9232, -3.6956, 6, -1.5308, -3.6956, 6, -1.5308, 0.7803, 6, -3.9232, -3.9232, 6, -0.7805, -3.9232, 6, -0.7805, 0.7803, 6, -3.9232, -4, 6, -0.0001, -4, 6, -0.0001, 0.7803, 6, -3.9232, -3.9232, 6, 0.7803, -3.9232, 6, 0.7803, 0.7803, 6, -3.9232, -3.6956, 6, 1.5307, -3.6956, 6, 1.5307, 0.7803, 6, -3.9232, -3.3259, 6, 2.2223, -3.3259, 6, 2.2223, 0.7803, 6, -3.9232, -2.8285, 6, 2.8284, -2.8285, 6, 2.8284, 0.7803, 6, -3.9232, -2.2224, 6, 3.3258, -2.2224, 6, 3.3258, 0.7803, 6, -3.9232, -1.5308, 6, 3.6954, -1.5308, 6, 3.6954, 0.7803, 6, -3.9232, -0.7805, 6, 3.9231, -0.7805, 6, 3.9231, 0.7803, 6, -3.9232, -0.0001, 6, 4, -0.0001, 6, 4, 0.7803, 6, -3.9232, 0.7803, 6, 3.9231, 0.7803, 6, 3.9231, 0.7803, 6, -3.9232, 1.5307, 6, 3.6954, 1.5307, 6, 3.6954, 0.7803, 6, -3.9232, 2.2223, 6, 3.3258, 2.2223, 6, 3.3258, 0.7803, 6, -3.9232, 2.8284, 6, 2.8284, 2.8284, 6, 2.8284, 0.7803, 6, -3.9232, 3.3258, 6, 2.2223, 3.3258, 6, 2.2223, 0.7803, 6, -3.9232, 3.6954, 6, 1.5307, 3.6954, 6, 1.5307, 0.7803, 6, -3.9232, 3.9231, 6, 0.7803, 3.9231, 6, 0.7803, 0.7803, 6, -3.9232, 4, 6, -0.0001, 4, 6, -0.0001, 0.7803, 6, -3.9232, 3.9231, 6, -0.7805, 3.9231, 6, -0.7805, 0.7803, 6, -3.9232, 3.6954, 6, -1.5308, 3.6954, 6, -1.5308, 0.7803, 6, -3.9232, 3.3258, 6, -2.2224, 3.3258, 6, -2.2224, 0.7803, 6, -3.9232, 2.8284, 6, -2.8285, 2.8284, 6, -2.8285, 0.7803, 6, -3.9232, 2.2223, 6, -3.3259, 2.2223, 6, -3.3259, 0.7803, 6, -3.9232, 1.5307, 6, -3.6956, -1.5308, 6, -3.6956, -1.5308, -6, -3.6956, -0.7805, 6, -3.9232, -0.7805, 6, -3.9232, -1.5308, -6, -3.6956, -0.7805, -6, -3.9232, -0.7805, 6, -3.9232, -0.7805, -6, -3.9232, -0.0001, 6, -4, -0.0001, 6, -4, -0.7805, -6, -3.9232, -0.0001, -6, -4, 0.7803, -6, -3.9232, -0.0001, -6, -4, 1.5307, -6, -3.6956, 1.5307, -6, -3.6956, -0.0001, -6, -4, 2.2223, -6, -3.3259, 2.2223, -6, -3.3259, -0.0001, -6, -4, 2.8284, -6, -2.8285, 2.8284, -6, -2.8285, -0.0001, -6, -4, 3.3258, -6, -2.2224, 3.3258, -6, -2.2224, -0.0001, -6, -4, 3.6954, -6, -1.5308, 3.6954, -6, -1.5308, -0.0001, -6, -4, 3.9231, -6, -0.7805, 3.9231, -6, -0.7805, -0.0001, -6, -4, 4, -6, -0.0001, 4, -6, -0.0001, -0.0001, -6, -4, 3.9231, -6, 0.7803, 3.9231, -6, 0.7803, -0.0001, -6, -4, 3.6954, -6, 1.5307, 3.6954, -6, 1.5307, -0.0001, -6, -4, 3.3258, -6, 2.2223, 3.3258, -6, 2.2223, -0.0001, -6, -4, 2.8284, -6, 2.8284, 2.8284, -6, 2.8284, -0.0001, -6, -4, 2.2223, -6, 3.3258, 2.2223, -6, 3.3258, -0.0001, -6, -4, 1.5307, -6, 3.6954, 1.5307, -6, 3.6954, -0.0001, -6, -4, 0.7803, -6, 3.9231, 0.7803, -6, 3.9231, -0.0001, -6, -4, -0.0001, -6, 4, -0.0001, -6, 4, -0.0001, -6, -4, -0.7805, -6, 3.9231, -0.7805, -6, 3.9231, -0.0001, -6, -4, -1.5308, -6, 3.6954, -1.5308, -6, 3.6954, -0.0001, -6, -4, -2.2224, -6, 3.3258, -2.2224, -6, 3.3258, -0.0001, -6, -4, -2.8285, -6, 2.8284, -2.8285, -6, 2.8284, -0.0001, -6, -4, -3.3259, -6, 2.2223, -3.3259, -6, 2.2223, -0.0001, -6, -4, -3.6956, -6, 1.5307, -3.6956, -6, 1.5307, -0.0001, -6, -4, -3.9232, -6, 0.7803, -3.9232, -6, 0.7803, -0.0001, -6, -4, -4, -6, -0.0001, -4, -6, -0.0001, -0.0001, -6, -4, -3.9232, -6, -0.7805, -3.9232, -6, -0.7805, -0.0001, -6, -4, -3.6956, -6, -1.5308, -3.6956, -6, -1.5308, -0.0001, -6, -4, -3.3259, -6, -2.2224, -3.3259, -6, -2.2224, -0.0001, -6, -4, -2.8285, -6, -2.8285, -2.8285, -6, -2.8285, -0.0001, -6, -4, -2.2224, -6, -3.3259, -2.2224, -6, -3.3259, -0.0001, -6, -4, -1.5308, -6, -3.6956, -1.5308, -6, -3.6956, -0.0001, -6, -4, -0.7805, -6, -3.9232) -[sub_resource type="ShaderMaterial" id="ShaderMaterial_60cnp"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_n2skm"] resource_local_to_scene = true render_priority = 0 shader = ExtResource("5_rdjtm") @@ -334,7 +334,7 @@ shader_parameter/overlay_emission_scale = 1.0 [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_p1wtp"] data = PackedVector3Array(-1.5, 0, -6, -1.5, 0, 6, -1.5, 3, -6, -1.5, 3, -6, -1.5, 0, 6, -1.5, 3, 6, 1.5, 0, 6, 1.5, 0, -6, 1.5, 3, 6, 1.5, 3, 6, 1.5, 0, -6, 1.5, 3, -6, -1.5, 0, 6, -1.5, 0, -6, 1.5, 0, 6, 1.5, 0, 6, -1.5, 0, -6, 1.5, 0, -6, 1.5, 3, 6, 1.5, 3, -6, -1.5, 3, 6, -1.5, 3, 6, 1.5, 3, -6, -1.5, 3, -6) -[sub_resource type="ShaderMaterial" id="ShaderMaterial_n2skm"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_e7iqv"] resource_local_to_scene = true render_priority = 0 shader = ExtResource("5_rdjtm") @@ -399,7 +399,7 @@ data = PackedVector3Array(-1, 0, 0.2, -1, -0.4, 0, -1, 0, -0.2, -1, 0, -0.2, -1, [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_2l4r6"] data = PackedVector3Array(-1.5, 0, -6, -1.5, 0, 6, -1.5, 3, -6, -1.5, 3, -6, -1.5, 0, 6, -1.5, 3, 6, 1.5, 0, 6, 1.5, 0, -6, 1.5, 3, 6, 1.5, 3, 6, 1.5, 0, -6, 1.5, 3, -6, -1.5, 0, 6, -1.5, 0, -6, 1.5, 0, 6, 1.5, 0, 6, -1.5, 0, -6, 1.5, 0, -6, 1.5, 3, 6, 1.5, 3, -6, -1.5, 3, 6, -1.5, 3, 6, 1.5, 3, -6, -1.5, 3, -6) -[sub_resource type="ShaderMaterial" id="ShaderMaterial_e7iqv"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_sbkki"] resource_local_to_scene = true render_priority = 0 shader = ExtResource("5_rdjtm") @@ -430,7 +430,7 @@ shader_parameter/overlay_emission_scale = 1.0 [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_tmxet"] data = PackedVector3Array(-1.5, 0, -6, -1.5, 0, 6, -1.5, 3, -6, -1.5, 3, -6, -1.5, 0, 6, -1.5, 3, 6, 1.5, 0, 6, 1.5, 0, -6, 1.5, 3, 6, 1.5, 3, 6, 1.5, 0, -6, 1.5, 3, -6, -1.5, 0, 6, -1.5, 0, -6, 1.5, 0, 6, 1.5, 0, 6, -1.5, 0, -6, 1.5, 0, -6, 1.5, 3, 6, 1.5, 3, -6, -1.5, 3, 6, -1.5, 3, 6, 1.5, 3, -6, -1.5, 3, -6) -[sub_resource type="ShaderMaterial" id="ShaderMaterial_sbkki"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ttaci"] resource_local_to_scene = true render_priority = 0 shader = ExtResource("5_rdjtm") @@ -564,7 +564,7 @@ mask_dim = 128 body = NodePath("..") mesh_instance = NodePath("../..") initial_mask = ExtResource("2_2roq2") -source_gunk_material = SubResource("ShaderMaterial_6lnam") +source_gunk_material = SubResource("ShaderMaterial_lorhs") [node name="Monkey" type="MeshInstance3D" parent="Geometry"] transform = Transform3D(-0.616239, 0, 0.787559, 0, 1, 0, -0.787559, 0, -0.616239, -2.22512, 1.41158, 2.88581) @@ -581,7 +581,7 @@ shape = SubResource("ConcavePolygonShape3D_hvf6a") mask_dim = 128 body = NodePath("..") mesh_instance = NodePath("../..") -source_gunk_material = SubResource("ShaderMaterial_lorhs") +source_gunk_material = SubResource("ShaderMaterial_v2ya2") [node name="Cube" type="MeshInstance3D" parent="Geometry"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 4, 0) @@ -600,7 +600,7 @@ shape = SubResource("ConcavePolygonShape3D_0qjrr") mask_dim = 512 body = NodePath("..") mesh_instance = NodePath("../..") -source_gunk_material = SubResource("ShaderMaterial_v2ya2") +source_gunk_material = SubResource("ShaderMaterial_60cnp") [node name="Cylinder" type="MeshInstance3D" parent="Geometry"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.33738, 6, -7.18125) @@ -618,7 +618,7 @@ shape = SubResource("ConcavePolygonShape3D_6ood3") mask_dim = 512 body = NodePath("..") mesh_instance = NodePath("../..") -source_gunk_material = SubResource("ShaderMaterial_60cnp") +source_gunk_material = SubResource("ShaderMaterial_n2skm") [node name="WallSwitch" parent="Geometry" instance=ExtResource("9_p27ol")] transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 3.9, 1.50699, 2.45659) @@ -641,7 +641,7 @@ shape = SubResource("ConcavePolygonShape3D_p1wtp") [node name="Gunkable" parent="LevelTiles/Hallway1/StaticBody3D" node_paths=PackedStringArray("body", "mesh_instance") instance=ExtResource("2_aj57l")] body = NodePath("..") mesh_instance = NodePath("../..") -source_gunk_material = SubResource("ShaderMaterial_n2skm") +source_gunk_material = SubResource("ShaderMaterial_e7iqv") [node name="AirlockSign" type="MeshInstance3D" parent="LevelTiles/Hallway1"] transform = Transform3D(1, 0, 1.74846e-07, 0, 1, 0, -1.74846e-07, 0, 1, 0, 3, -4.5) @@ -677,7 +677,7 @@ shape = SubResource("ConcavePolygonShape3D_2l4r6") [node name="Gunkable" parent="LevelTiles/Hallway2/StaticBody3D" node_paths=PackedStringArray("body", "mesh_instance") instance=ExtResource("2_aj57l")] body = NodePath("..") mesh_instance = NodePath("../..") -source_gunk_material = SubResource("ShaderMaterial_e7iqv") +source_gunk_material = SubResource("ShaderMaterial_sbkki") [node name="Hallway3" type="MeshInstance3D" parent="LevelTiles"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 30) @@ -694,7 +694,7 @@ shape = SubResource("ConcavePolygonShape3D_tmxet") [node name="Gunkable" parent="LevelTiles/Hallway3/StaticBody3D" node_paths=PackedStringArray("body", "mesh_instance") instance=ExtResource("2_aj57l")] body = NodePath("..") mesh_instance = NodePath("../..") -source_gunk_material = SubResource("ShaderMaterial_sbkki") +source_gunk_material = SubResource("ShaderMaterial_ttaci") [node name="GrunkNodule" parent="." instance=ExtResource("10_2roq2")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 1, -1) diff --git a/src/shaders/gunk_overlay.gdshader b/src/shaders/gunk_overlay.gdshader index 9397c41..3e83173 100644 --- a/src/shaders/gunk_overlay.gdshader +++ b/src/shaders/gunk_overlay.gdshader @@ -2,33 +2,41 @@ shader_type spatial; render_mode depth_prepass_alpha; group_uniforms gunk_material; +uniform highp sampler3D gunk_noise; uniform vec3 color_1: source_color = vec3(0.0, 0.03, 0.1); uniform vec3 color_2: source_color = vec3(0.0, 0.1, 0.3); uniform vec3 emission_color: source_color = vec3(0.25, 0.88, 1.0); -uniform vec3 fresnel_color: source_color = vec3(1.0); -uniform sampler2D fresnel_gradient; + + +// Used ONLY by the gunk, does not affect the gunk mask. +uniform vec2 uv_scale = vec2(1.0); + +uniform float time_scale = 1.0; uniform float pixellation = 128.0; uniform float time_pixellation = 30.0; uniform float roughness: hint_range(0.0, 1.0) = 0.15; uniform float specular_contribution = 0.8; uniform float emission_strength = 0.05; -uniform float fresnel_power = 4.0; -uniform float fresnel_intensity = 0.0; uniform float bump_strength = 1.0; -// Used ONLY by the gunk, does not affect the gunk mask. -uniform vec2 uv_scale = vec2(1.0); - -uniform float time_scale = 1.0; - +group_uniforms gunk_mask; uniform float edge_bleed = 0.25; - uniform sampler2D gunk_mask; -uniform highp sampler3D gunk_noise; -uniform highp sampler3D gunk_normal_map; +group_uniforms fresnel; +uniform vec3 fresnel_color: source_color = vec3(1.0); +uniform sampler2D fresnel_gradient; +uniform float fresnel_power = 4.0; +uniform float fresnel_intensity = 0.0; + +group_uniforms iridescence; +uniform vec3 iridescence_color: source_color = vec3(1.0); +uniform sampler2D iridescence_gradient; +uniform float iridescence_power = 4.0; +uniform float iridescence_intensity = 0.0; + group_uniforms overlay; uniform sampler2D overlay_albedo: hint_default_transparent, filter_nearest; @@ -36,10 +44,17 @@ uniform sampler2D overlay_emission: hint_default_transparent, filter_nearest; uniform float overlay_emission_scale = 1.0; -vec3 fresnel_glow(vec3 normal, vec3 view) { +vec3 rim_glow( + vec3 normal, + vec3 view, + sampler2D gradient, + vec3 color, + float power, + float intensity +) { float normal_angle = clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0); - vec3 color = texture(fresnel_gradient, vec2(normal_angle, 0.0)).rgb * fresnel_color; - return pow((1.0 - normal_angle), fresnel_power) * color * fresnel_intensity; + vec3 base_color = texture(gradient, vec2(normal_angle, 0.0)).rgb * color; + return pow((1.0 - normal_angle), power) * base_color * intensity; } float hardstep(float value) { @@ -49,7 +64,7 @@ float hardstep(float value) { float bump_sample(vec2 uv, vec3 uvt, float dx, float dy) { vec2 offset = vec2(dx / pixellation, dy / pixellation); - float height = texture(gunk_normal_map, uvt + vec3(offset, 0.0)).r; + float height = texture(gunk_noise, uvt + vec3(offset, 0.0)).r; float mask = texture(gunk_mask, uv + offset / uv_scale).r; return height * smoothstep(1.0, 0.0, mask); } @@ -90,7 +105,24 @@ void fragment() { // add fresnel vec3 world_normal = mat3(TANGENT, BINORMAL, NORMAL) * (NORMAL_MAP * 2.0 - 1.0); - ALBEDO += fresnel_glow(world_normal, VIEW); + EMISSION += rim_glow( + world_normal, + VIEW, + fresnel_gradient, + fresnel_color, + fresnel_power, + fresnel_intensity + ); + + // add iridescence + ALBEDO += rim_glow( + world_normal, + VIEW, + iridescence_gradient, + iridescence_color, + iridescence_power, + iridescence_intensity + ); // Hardish edge float mask = texture(gunk_mask, UV).r; diff --git a/src/world/world.tscn b/src/world/world.tscn index 4d792d0..4d2d566 100644 --- a/src/world/world.tscn +++ b/src/world/world.tscn @@ -4,7 +4,7 @@ [ext_resource type="Resource" uid="uid://tgac5tnfx56r" path="res://src/world/world_manager.tres" id="2_5kmgb"] [ext_resource type="PackedScene" uid="uid://byvjsvavbg5xe" path="res://src/ui/menus/pause_menu/pause_menu.tscn" id="2_6fy3g"] [ext_resource type="Resource" uid="uid://0i72bf8ip1lx" path="res://src/world/spook_manager.tres" id="3_l0av5"] -[ext_resource type="PackedScene" uid="uid://700gr7k3gqlf" path="res://levels/grunkbeast_test/visual_test/visual_test.tscn" id="4_5kmgb"] +[ext_resource type="PackedScene" uid="uid://dc4tts6342cuj" path="res://levels/prop_test/prop_test.tscn" id="4_5kmgb"] [ext_resource type="PackedScene" uid="uid://c0uitm5cg88h1" path="res://src/ui/menus/kill_screen/kill_screen.tscn" id="6_l0av5"] [ext_resource type="PackedScene" uid="uid://brknr57xc2cp0" path="res://src/ui/elements/save_icon/save_icon.tscn" id="7_5kmgb"]