new shaders

This commit is contained in:
Luca 2025-01-07 17:11:41 +01:00
parent c4115b3569
commit 7ada6a0f2c
24 changed files with 567 additions and 124 deletions

Binary file not shown.

View file

@ -0,0 +1,36 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://83u6swv86t81"
path="res://.godot/imported/monstree.glb-a56a1e0cfe11e646b308bd8b8f94d0d6.scn"
[deps]
source_file="res://assets/models/own/monstree.glb"
dest_files=["res://.godot/imported/monstree.glb-a56a1e0cfe11e646b308bd8b8f94d0d6.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=false
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=true
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

View file

@ -0,0 +1,39 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ck584d0e6w3uf"
path.s3tc="res://.godot/imported/monstree_texture_1001.jpg-63703d8deae163a50d9736d96992e32f.s3tc.ctex"
path.etc2="res://.godot/imported/monstree_texture_1001.jpg-63703d8deae163a50d9736d96992e32f.etc2.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
}
generator_parameters={
"md5": "67a8a253223b26a936e687d2cff27d5b"
}
[deps]
source_file="res://assets/models/own/monstree_texture_1001.jpg"
dest_files=["res://.godot/imported/monstree_texture_1001.jpg-63703d8deae163a50d9736d96992e32f.s3tc.ctex", "res://.godot/imported/monstree_texture_1001.jpg-63703d8deae163a50d9736d96992e32f.etc2.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

View file

@ -0,0 +1,39 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bu5h23fuvsybf"
path.s3tc="res://.godot/imported/monstree_texture_1002.jpg-b9158a4a8779c7ef68059489fb08d536.s3tc.ctex"
path.etc2="res://.godot/imported/monstree_texture_1002.jpg-b9158a4a8779c7ef68059489fb08d536.etc2.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
}
generator_parameters={
"md5": "eb0efbe98e4def55e742abeaf0480f7b"
}
[deps]
source_file="res://assets/models/own/monstree_texture_1002.jpg"
dest_files=["res://.godot/imported/monstree_texture_1002.jpg-b9158a4a8779c7ef68059489fb08d536.s3tc.ctex", "res://.godot/imported/monstree_texture_1002.jpg-b9158a4a8779c7ef68059489fb08d536.etc2.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

View file

@ -0,0 +1,39 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://v5muqivqa6hq"
path.s3tc="res://.godot/imported/monstree_texture_1003.jpg-54aec798c6530d55f2bcab662c9adf7f.s3tc.ctex"
path.etc2="res://.godot/imported/monstree_texture_1003.jpg-54aec798c6530d55f2bcab662c9adf7f.etc2.ctex"
metadata={
"imported_formats": ["s3tc_bptc", "etc2_astc"],
"vram_texture": true
}
generator_parameters={
"md5": "98da70e2c6f8d18f9040ffa967db4a0c"
}
[deps]
source_file="res://assets/models/own/monstree_texture_1003.jpg"
dest_files=["res://.godot/imported/monstree_texture_1003.jpg-54aec798c6530d55f2bcab662c9adf7f.s3tc.ctex", "res://.godot/imported/monstree_texture_1003.jpg-54aec798c6530d55f2bcab662c9adf7f.etc2.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View file

@ -4,6 +4,16 @@ extends StaticBody3D
@onready var exhibit_title: Label3D = $ExhibitTitle
@onready var exhibit_number: Label3D = $ExhibitNumber
var current_exhibit: Node = null
@export_group("Exhibit Settings")
@export var exhibit: PackedScene:
get:
return exhibit
set(value):
exhibit = value
set_exhibit()
@export var prefix: String:
get:
return prefix
@ -27,3 +37,14 @@ func set_label3d():
if not prefix.is_empty() and not title.is_empty():
exhibit_title.text = title
exhibit_number.text = prefix
func set_exhibit():
# remove the old exhibit if present
if current_exhibit:
remove_child(current_exhibit)
if exhibit != null:
var scene_node = exhibit.instantiate()
scene_node.position.y = 2
current_exhibit = scene_node
add_child(scene_node)

View file

@ -9,6 +9,7 @@ size = Vector3(0.91626, 1.34576, 0.744141)
[node name="Plinth" type="StaticBody3D"]
script = ExtResource("1_c0mgr")
exhibit_position = Vector3(0, 0, 0)
prefix = "000"
title = "Title"

167
main.tscn
View file

@ -1,4 +1,4 @@
[gd_scene load_steps=23 format=3 uid="uid://xiyknqrsrmws"]
[gd_scene load_steps=28 format=3 uid="uid://xiyknqrsrmws"]
[ext_resource type="PackedScene" uid="uid://dcv8xw0aeturp" path="res://entities/viewer/viewer.tscn" id="1_ann0f"]
[ext_resource type="PackedScene" uid="uid://bn6vxev7totc8" path="res://entities/plinth/plinth.tscn" id="3_hl5po"]
@ -13,10 +13,15 @@
[ext_resource type="PackedScene" uid="uid://c0c1k04qmog56" path="res://shaders/000_playground/playground.tscn" id="11_u0jti"]
[ext_resource type="FontFile" uid="uid://d268g1dy6fv6t" path="res://assets/fonts/FrederickatheGreat-Regular.ttf" id="12_mj3dk"]
[ext_resource type="PackedScene" uid="uid://bcsb32y37da3f" path="res://shaders/009_fresnel/fresnel.tscn" id="12_mx7ux"]
[ext_resource type="PackedScene" uid="uid://drgqrnj1otb25" path="res://shaders/010_outline/outline.tscn" id="13_3375a"]
[ext_resource type="PackedScene" uid="uid://drgqrnj1otb25" path="res://shaders/010_edge_detection/edge_detection.tscn" id="13_3375a"]
[ext_resource type="Script" path="res://openxr.gd" id="15_a8hdi"]
[ext_resource type="PackedScene" uid="uid://cjcfr8tqdhbro" path="res://shaders/011_circle/circle.tscn" id="15_dijaw"]
[ext_resource type="PackedScene" uid="uid://2o8nbxn0x7of" path="res://shaders/012_polygon/polygon.tscn" id="16_j3uxc"]
[ext_resource type="PackedScene" uid="uid://eh06d5qto3hu" path="res://shaders/014_depth/depth.tscn" id="18_pt3p3"]
[ext_resource type="PackedScene" uid="uid://omdbnbi707f8" path="res://shaders/016_line/line.tscn" id="19_2f6ea"]
[ext_resource type="PackedScene" uid="uid://dbevfrw75c0lf" path="res://shaders/017_blur/blur.tscn" id="20_qkyju"]
[ext_resource type="PackedScene" uid="uid://dpt0jm6fe6iy" path="res://shaders/018_black_hole/BlackHole.tscn" id="21_8umyp"]
[ext_resource type="PackedScene" uid="uid://83u6swv86t81" path="res://assets/models/own/monstree.glb" id="22_36auf"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_37bgm"]
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
@ -39,6 +44,10 @@ size = Vector2(100, 20)
[node name="Main" type="Node3D"]
[node name="OpenXR" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("15_a8hdi")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
unique_name_in_owner = true
environment = SubResource("Environment_gem6o")
@ -58,101 +67,79 @@ metadata/_edit_lock_ = true
shape = SubResource("WorldBoundaryShape3D_l71tc")
metadata/_edit_lock_ = true
[node name="monstree" parent="." instance=ExtResource("22_36auf")]
transform = Transform3D(-2.18557e-07, 0, 5, 0, 5, 0, -5, 0, -2.18557e-07, 27.4705, -6.36274, -6.36762)
[node name="Viewer" parent="." instance=ExtResource("1_ann0f")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 19.6964, 0, 2.84986)
[node name="XROrigin3D" type="XROrigin3D" parent="."]
[node name="XRCamera3D" type="XRCamera3D" parent="XROrigin3D"]
[node name="LeftHand" type="XRController3D" parent="XROrigin3D"]
tracker = &"left_hand"
[node name="RightHand" type="XRController3D" parent="XROrigin3D"]
tracker = &"right_hand"
[node name="Examples" type="Node3D" parent="."]
[node name="000Playground" type="Node3D" parent="Examples"]
[node name="000Playground" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0)
[node name="Plinth" parent="Examples/000Playground" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("11_u0jti")
title = "Playground"
[node name="Playground" parent="Examples/000Playground" instance=ExtResource("11_u0jti")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="001ChangeColor" type="Node3D" parent="Examples"]
[node name="001ChangeColor" parent="Examples/001ChangeColor" instance=ExtResource("4_ssrg0")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="Plinth" parent="Examples/001ChangeColor" instance=ExtResource("3_hl5po")]
[node name="001ChangeColor" parent="Examples" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("4_ssrg0")
prefix = "001"
title = "Change Color"
[node name="002ChangePosition" type="Node3D" parent="Examples"]
[node name="002ChangePosition" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0)
[node name="Plinth" parent="Examples/002ChangePosition" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("4_3haq7")
prefix = "002"
title = "Change Position"
[node name="ChangePosition" parent="Examples/002ChangePosition" instance=ExtResource("4_3haq7")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="003ColorAndPosition" type="Node3D" parent="Examples"]
[node name="003ColorAndPosition" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 0)
[node name="Plinth" parent="Examples/003ColorAndPosition" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("5_tv25h")
prefix = "003"
title = "Color and Position"
[node name="ColorAndPosition" parent="Examples/003ColorAndPosition" instance=ExtResource("5_tv25h")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="004AddingTime" type="Node3D" parent="Examples"]
[node name="004AddingTime" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, 0)
[node name="Plinth" parent="Examples/004AddingTime" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("6_sjdpt")
prefix = "004"
title = "Adding Time"
[node name="AddingTime" parent="Examples/004AddingTime" instance=ExtResource("6_sjdpt")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="005DisplacingVertices" type="Node3D" parent="Examples"]
[node name="005DisplacingVertices" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, 0)
[node name="Plinth" parent="Examples/005DisplacingVertices" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("7_3a3yj")
prefix = "005"
title = "Displacing Vertices"
[node name="DisplacingVertices" parent="Examples/005DisplacingVertices" instance=ExtResource("7_3a3yj")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="006Variables" type="Node3D" parent="Examples"]
[node name="006Variables" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 0, 0)
[node name="Plinth" parent="Examples/006Variables" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("8_pbwds")
prefix = "006"
title = "Variables"
[node name="Variables" parent="Examples/006Variables" instance=ExtResource("8_pbwds")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="007Reflections" type="Node3D" parent="Examples"]
[node name="007Reflections" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 0, 0)
[node name="Plinth" parent="Examples/007Reflections" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("9_vxv4a")
prefix = "007"
title = "Reflections"
[node name="Reflections" parent="Examples/007Reflections" instance=ExtResource("9_vxv4a")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="008Normals" type="Node3D" parent="Examples"]
[node name="008Normals" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 14, 0, 0)
[node name="Plinth" parent="Examples/008Normals" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("10_cqg4s")
prefix = "008"
title = "Normals"
[node name="Normals" parent="Examples/008Normals" instance=ExtResource("10_cqg4s")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="EffectsLabel" type="Node3D" parent="Examples"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 17, 1, 0)
metadata/_edit_lock_ = true
[node name="EffectsLabel3D" type="Label3D" parent="Examples/EffectsLabel"]
pixel_size = 0.003
@ -174,6 +161,7 @@ font_size = 128
[node name="ShapesLabel" type="Node3D" parent="Examples"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 17, 1, -4)
metadata/_edit_lock_ = true
[node name="ShapesLabel3D" type="Label3D" parent="Examples/ShapesLabel"]
pixel_size = 0.003
@ -193,59 +181,48 @@ text = "--->"
font = ExtResource("12_mj3dk")
font_size = 128
[node name="009Fresnel" type="Node3D" parent="Examples"]
[node name="009Fresnel" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20, 0, 0)
[node name="Plinth" parent="Examples/009Fresnel" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("12_mx7ux")
prefix = "009"
title = "Fresnel"
[node name="Fresnel" parent="Examples/009Fresnel" instance=ExtResource("12_mx7ux")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="010Outline" type="Node3D" parent="Examples"]
[node name="010EdgeDetection" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 22, 0, 0)
[node name="Plinth" parent="Examples/010Outline" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("13_3375a")
prefix = "010"
title = "Outline"
title = "Edge Detection"
[node name="Outline" parent="Examples/010Outline" instance=ExtResource("13_3375a")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="011Circle" type="Node3D" parent="Examples"]
[node name="011Circle" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20, 0, -4)
[node name="Plinth" parent="Examples/011Circle" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("15_dijaw")
prefix = "011"
title = "Circle"
[node name="Circle" parent="Examples/011Circle" instance=ExtResource("15_dijaw")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="012Polygon" type="Node3D" parent="Examples"]
[node name="012Polygon" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 22, 0, -4)
[node name="Plinth" parent="Examples/012Polygon" instance=ExtResource("3_hl5po")]
exhibit = ExtResource("16_j3uxc")
prefix = "012"
title = "Polygon"
[node name="Polygon" parent="Examples/012Polygon" instance=ExtResource("16_j3uxc")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="014Depth" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 24, 0, 0)
exhibit = ExtResource("18_pt3p3")
prefix = "014"
title = "Depth"
[node name="013Rectangles" type="Node3D" parent="Examples"]
[node name="016Line" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 26, 0, 0)
exhibit = ExtResource("19_2f6ea")
prefix = "016"
title = "Line"
[node name="Plinth" parent="Examples/013Rectangles" instance=ExtResource("3_hl5po")]
[node name="017Blur" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 28, 0, 0)
exhibit = ExtResource("20_qkyju")
prefix = "017"
title = "Blur"
[node name="OpenXR" type="Node" parent="."]
unique_name_in_owner = true
script = ExtResource("15_a8hdi")
[node name="XROrigin3D" type="XROrigin3D" parent="."]
[node name="XRCamera3D" type="XRCamera3D" parent="XROrigin3D"]
[node name="LeftHand" type="XRController3D" parent="XROrigin3D"]
tracker = &"left_hand"
[node name="RightHand" type="XRController3D" parent="XROrigin3D"]
tracker = &"right_hand"
[node name="018BlackHole" parent="Examples" instance=ExtResource("3_hl5po")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 44.505, 0, -7.17165)
exhibit = ExtResource("21_8umyp")

View file

@ -41,3 +41,4 @@ back={
[rendering]
textures/vram_compression/import_etc2_astc=true
anti_aliasing/quality/msaa_3d=2

View file

@ -0,0 +1,51 @@
shader_type spatial;
render_mode unshaded;
uniform sampler2D SCREEN_TEXTURE: hint_screen_texture, repeat_disable, filter_nearest;
vec3 convolution(sampler2D tex, vec2 uv, vec2 pixel_size) {
vec3 conv = vec3(0.0, 0.0, 0.0);
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 3; col++) {
conv += texture(tex, uv + vec2(float(col - 1), float(row - 1)) * pixel_size).rgb;
}
}
return conv;
}
void fragment() {
// All surrounding pixels
vec3 pixels[9];
// [0, 1, 2]
// [3, 4, 5]
// [6, 7, 8]
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 3; col++) {
vec2 uv = SCREEN_UV + vec2(float(col - 1), float(row - 1)) * 1.0 / VIEWPORT_SIZE;// SCREEN_PIXEL_SIZE;
pixels[row * 3 + col] = convolution(SCREEN_TEXTURE, uv, 1.0 / VIEWPORT_SIZE); //SCREEN_PIXEL_SIZE);
}
}
// Apply Sobel Operator
// Sobel Edge Horizontal
vec3 gx = (
pixels[0] * -1.0 + pixels[3] * -2.0 + pixels[6] * -1.0 +
pixels[2] * 1.0 + pixels[5] * 2.0 + pixels[8] * 1.0
);
// Sobel Edge Vertical
vec3 gy = (
pixels[0] * -1.0 + pixels[1] * -2.0 + pixels[2] * -1.0 +
pixels[6] * 1.0 + pixels[7] * 2.0 + pixels[8] * 1.0
);
vec3 sobel = sqrt(gx * gx + gy * gy);
float alpha = sobel.r + sobel.g + sobel.b;
alpha /= 3.0;
ALPHA = alpha;
ALBEDO = sobel;
}

View file

@ -0,0 +1,25 @@
[gd_scene load_steps=6 format=3 uid="uid://drgqrnj1otb25"]
[ext_resource type="Shader" path="res://shaders/010_edge_detection/edge_detection.gdshader" id="1_34hnr"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vbj21"]
[sub_resource type="SphereMesh" id="SphereMesh_wnbfj"]
material = SubResource("ShaderMaterial_vbj21")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_855vq"]
render_priority = 0
shader = ExtResource("1_34hnr")
[sub_resource type="QuadMesh" id="QuadMesh_sbqxy"]
size = Vector2(1.6, 2)
[node name="EdgeDetection" type="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_wnbfj")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.965926, -0.258819, 0, 0.258819, 0.965926, 0, 0.322139, 0.653597)
material_override = SubResource("ShaderMaterial_855vq")
mesh = SubResource("QuadMesh_sbqxy")

View file

@ -1,14 +0,0 @@
shader_type spatial;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
// Called for every pixel the material is visible on.
}
//void light() {
// Called for every pixel for every light affecting the material.
// Uncomment to replace the default light processing function with this one.
//}

View file

@ -1,15 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://drgqrnj1otb25"]
[ext_resource type="Shader" path="res://shaders/010_outline/outline.gdshader" id="1_34hnr"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_vbj21"]
render_priority = 0
shader = ExtResource("1_34hnr")
[sub_resource type="SphereMesh" id="SphereMesh_wnbfj"]
material = SubResource("ShaderMaterial_vbj21")
[node name="Outline" type="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_wnbfj")

View file

@ -0,0 +1,32 @@
shader_type spatial;
render_mode unshaded, depth_draw_never, cull_disabled;
uniform float depth_factor: hint_range(0.0, 256.0, 0.1) = 80.0;
uniform float pow_factor: hint_range(0.0, 10.0, 0.1) = 1.0;
uniform sampler2D depth_texture : hint_depth_texture;
void fragment() {
// Read the depth from the SCREEN_UV
float depth = texture(depth_texture, SCREEN_UV).x;
// Normalize the device coordiantes
// See (https://docs.godotengine.org/en/latest/tutorials/shaders/advanced_postprocessing.html)
// for details on Vulkan vs. OpenGL coordinates
// Puts the normalized device coordinates into X and Y and the depth coordinates into Z
vec3 ndc = vec3(SCREEN_UV * 2.0 - 1.0, depth);
// Convert NDC to view space (also known as camera space or eye space)
// View Space gives positions relative to the camera, so Z will give the
// distance from the camera to the point
vec4 view = INV_PROJECTION_MATRIX * vec4(ndc, 1.0);
// Transforms the homogeneous coordinates into 3D space
// this is a common line in 3D graphics
view.xyz /= view.w;
// negate the z value due to vulkans coordinate system
float linear_depth = -view.z;
ALBEDO = vec3(linear_depth / depth_factor);
}

View file

@ -0,0 +1,25 @@
[gd_scene load_steps=5 format=3 uid="uid://eh06d5qto3hu"]
[ext_resource type="Shader" path="res://shaders/014_depth/depth.gdshader" id="1_bci2g"]
[sub_resource type="SphereMesh" id="SphereMesh_46g6r"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_to4o0"]
render_priority = 0
shader = ExtResource("1_bci2g")
shader_parameter/depth_factor = 80.0
shader_parameter/pow_factor = 1.0
[sub_resource type="QuadMesh" id="QuadMesh_xgf2h"]
material = SubResource("ShaderMaterial_to4o0")
size = Vector2(1.6, 2)
[node name="Depth" type="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_46g6r")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.965926, -0.258819, 0, 0.258819, 0.965926, 0, 0.322139, 0.653597)
mesh = SubResource("QuadMesh_xgf2h")
metadata/_edit_lock_ = true

View file

@ -0,0 +1,32 @@
shader_type spatial;
uniform vec2 resolution = vec2(600.0, 400.0);
uniform vec3 line_color: source_color = vec3(0.2, 0.6, 0.2);
uniform float line_thickness: hint_range(0.01, 1.0, 0.01) = 0.05;
uniform float speed = 0.5;
uniform float amp_coef = 0.1;
uniform float freq_coef = 0.5;
uniform float iterations: hint_range(1.0, 20.0, 1.0) = 5.0;
uniform float brightness: hint_range(0.1, 20.0, 0.1) = 0.5;
vec3 draw_line(vec2 uv, vec3 color, float shift, float freq) {
uv.y += (1.0 - smoothstep(0.0, 1.0, abs(uv.x))) * sin(uv.x + shift * freq) * amp_coef * sin(uv.x + shift);
return (1.0 - smoothstep(0.0, line_thickness * (smoothstep(-0.2, 0.9, abs(uv.x))), abs(uv.y))) * color;
}
void fragment() {
// Move the center of the uv to the center of the Mesh
vec2 uv = UV - 0.5;
// Apply the aspect ratio
uv.x *= resolution.x / resolution.y;
float shift = TIME * speed;
vec3 color = vec3(0.0);
for (float i = 0.0; i < iterations; i += 1.0) {
color += draw_line(uv, line_color, shift + i * 0.4, 1.0 + freq_coef);
}
ALBEDO = color * brightness;
}

View file

@ -0,0 +1,23 @@
[gd_scene load_steps=4 format=3 uid="uid://omdbnbi707f8"]
[ext_resource type="Shader" path="res://shaders/016_line/line.gdshader" id="1_wsdq7"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_jjsaw"]
render_priority = 0
shader = ExtResource("1_wsdq7")
shader_parameter/resolution = Vector2(600, 400)
shader_parameter/line_color = Color(0.860779, 0.546136, 0.207257, 1)
shader_parameter/line_thickness = 0.02
shader_parameter/speed = 0.065
shader_parameter/amp_coef = 0.26
shader_parameter/freq_coef = 4.175
shader_parameter/iterations = 20.0
shader_parameter/brightness = 1.0
[sub_resource type="QuadMesh" id="QuadMesh_ldsi7"]
material = SubResource("ShaderMaterial_jjsaw")
[node name="Line" type="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("QuadMesh_ldsi7")

View file

@ -0,0 +1,15 @@
shader_type spatial;
render_mode unshaded;
uniform sampler2D SCREEN_TEXTURE: hint_screen_texture, repeat_disable, filter_nearest;
uniform float blur_power: hint_range(0.0, 0.2, 0.001) = 0.05;
uniform sampler2D noise_texture;
vec2 noise(vec2 uv) {
return texture(noise_texture, uv).xy - 0.5;
}
void fragment() {
vec2 uv = SCREEN_UV;
ALBEDO.rgb = texture(SCREEN_TEXTURE, uv + noise(uv)).rgb * blur_power;
}

View file

@ -0,0 +1,34 @@
[gd_scene load_steps=7 format=3 uid="uid://dbevfrw75c0lf"]
[ext_resource type="Shader" path="res://shaders/017_blur/blur.gdshader" id="1_5bxw6"]
[sub_resource type="SphereMesh" id="SphereMesh_i42j4"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_vfc3l"]
noise_type = 0
frequency = 0.0132
fractal_octaves = 3
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_08gkt"]
as_normal_map = true
bump_strength = 0.4
noise = SubResource("FastNoiseLite_vfc3l")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_rdcxf"]
render_priority = 0
shader = ExtResource("1_5bxw6")
shader_parameter/blur_power = 0.2
shader_parameter/noise_texture = SubResource("NoiseTexture2D_08gkt")
[sub_resource type="QuadMesh" id="QuadMesh_prlu3"]
material = SubResource("ShaderMaterial_rdcxf")
size = Vector2(1.6, 2)
[node name="Blur" type="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_i42j4")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.965926, -0.258819, 0, 0.258819, 0.965926, 0, 0.322139, 0.653597)
mesh = SubResource("QuadMesh_prlu3")

View file

@ -0,0 +1,63 @@
shader_type spatial;
render_mode unshaded;
uniform sampler2D screen_tex : hint_screen_texture;
uniform sampler2D depth_tex : hint_depth_texture;
uniform float scale;
bool hit_sphere(vec3 ray_origin, vec3 ray_dir, vec3 sphere_origin, float radius) {
vec3 oc = ray_origin - sphere_origin;
float a = dot(ray_dir, ray_dir);
float b = 2.0 * dot(ray_dir, oc);
float c = dot(oc, oc) - (radius * radius);
float disc = (b * b) - 4.0 * a * c;
return disc > 0.0;
}
vec3 get_world_position_from_uv(vec2 uv, float depth, mat4 inv_proj_m, mat4 inv_view_m) {
vec4 ndc = vec4((uv * 2.0) - 1.0, depth, 1.0);
vec4 view_p = inv_proj_m * ndc;
view_p.xyz /= view_p.w;
view_p = (inv_view_m * vec4(view_p.xyz, 1.0));
return view_p.xyz;
}
vec2 get_uv_from_world_position(vec3 position_w, mat4 proj_m, mat4 view_m) {
vec3 position_v = (view_m * vec4(position_w, 1.0)).xyz;
vec4 position_cs = proj_m * vec4(position_v.xyz, 1.0);
vec2 ndc = position_cs.xy / position_cs.w;
return ndc.xy * 0.5 + 0.5;
}
float fresnel(float amount, vec3 normal, vec3 view) {
return pow((1.0 - clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0 )), amount);
}
void fragment() {
float depth = texture(depth_tex, SCREEN_UV).x;
vec3 frag_p = get_world_position_from_uv(SCREEN_UV, depth, INV_PROJECTION_MATRIX, INV_VIEW_MATRIX);
vec3 ray_dir = normalize(frag_p - CAMERA_POSITION_WORLD);
bool hit = hit_sphere(CAMERA_POSITION_WORLD, ray_dir, NODE_POSITION_WORLD, scale * .3);
vec4 screen_color = texture(screen_tex, SCREEN_UV);
vec3 color;
if (hit) {
color = vec3(0.0);
}
else {
vec2 bh_p = get_uv_from_world_position(NODE_POSITION_WORLD, PROJECTION_MATRIX, VIEW_MATRIX);
vec2 dis_dir = normalize(bh_p - SCREEN_UV) * 0.5;
float f = 1.0 - fresnel(0.5, NORMAL, VIEW);
float fov = atan(-1.0 / PROJECTION_MATRIX[1][1] * 2.0);
float dist = distance(CAMERA_POSITION_WORLD, NODE_POSITION_WORLD);
float s = (2.0 * dist * tan(fov * 0.5)) / scale;
vec2 uv = SCREEN_UV + (dis_dir * (f / s));
screen_color = texture(screen_tex, uv);
color = vec3(screen_color.r, screen_color.g, screen_color.b);
}
ALBEDO = color;
}

View file

@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=3 uid="uid://dpt0jm6fe6iy"]
[ext_resource type="Shader" path="res://shaders/018_black_hole/BlackHole.gdshader" id="1_qhb28"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_101ce"]
render_priority = 0
shader = ExtResource("1_qhb28")
shader_parameter/scale = 1.0
[sub_resource type="SphereMesh" id="SphereMesh_yxjof"]
material = SubResource("ShaderMaterial_101ce")
flip_faces = true
radius = 2.5
height = 5.0
[node name="BlackHole" type="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_yxjof")