Testing stuff out

This commit is contained in:
Otto 2024-10-01 17:29:36 +03:00
parent 56de371634
commit 8fd94c37ef
11 changed files with 271 additions and 4 deletions

View file

@ -0,0 +1,16 @@
shader_type spatial;
render_mode unshaded;
instance uniform int id;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
ALBEDO = vec3(cos(TIME + float(id) * 0.01), sin(TIME + float(id) * 0.01), tan(TIME + float(id) * 0.01));
}
void light() {
DIFFUSE_LIGHT = vec3(1.0, 1.0, 1.0);
}

View file

@ -0,0 +1,13 @@
shader_type spatial;
void vertex() {
}
void fragment() {
ALBEDO = vec3(1.0, 1.0, 1.0);
}
void light() {
DIFFUSE_LIGHT = vec3(0.0, 0.0, 0.0);
}

View file

@ -0,0 +1,13 @@
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() {
DIFFUSE_LIGHT = vec3(1.0, 1.0, 1.0);
}

View file

@ -0,0 +1,79 @@
[gd_scene load_steps=10 format=3 uid="uid://qehbjfkqs5pl"]
[ext_resource type="Script" path="res://scripts/particles_cool.gd" id="1_5jfiw"]
[ext_resource type="Shader" path="res://assets/shaders/Weird-B&W.gdshader" id="1_qtxk8"]
[ext_resource type="Shader" path="res://scripts/WatchDogsCool.gdshader" id="3_mwhb0"]
[sub_resource type="Environment" id="Environment_s81sd"]
background_mode = 2
reflected_light_source = 1
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dl6l5"]
render_priority = 0
shader = ExtResource("1_qtxk8")
[sub_resource type="SphereMesh" id="SphereMesh_ui3pw"]
material = SubResource("ShaderMaterial_dl6l5")
radius = 0.9
height = 1.9
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_ry4cm"]
emission_shape = 2
emission_sphere_radius = 1.0
turbulence_enabled = true
turbulence_noise_strength = 8.42
turbulence_noise_speed = Vector3(1.26, 0.905, -1.06)
turbulence_noise_speed_random = 0.65
turbulence_influence_min = 0.075
turbulence_influence_max = 0.188
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0gq3c"]
render_priority = 0
shader = ExtResource("3_mwhb0")
[sub_resource type="SphereMesh" id="SphereMesh_caeh0"]
material = SubResource("ShaderMaterial_0gq3c")
radius = 0.001
[node name="Node3D" type="Node3D"]
script = ExtResource("1_5jfiw")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_s81sd")
[node name="OrbitCam" type="Node3D" parent="."]
transform = Transform3D(1.19251, 0, -1.00129, 0, 1, 0, 0.89166, 0, 1.33913, 0, 0, 0)
[node name="Camera3D" type="Camera3D" parent="OrbitCam"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.76064, 4.93176)
current = true
[node name="Ball" type="MeshInstance3D" parent="."]
transform = Transform3D(0.0753269, 0, -0.997159, 0, 1, 0, 0.997159, 0, 0.0753269, 0, 0, -2.3681)
visible = false
mesh = SubResource("SphereMesh_ui3pw")
skeleton = NodePath("GPUParticles3D2")
[node name="GPUParticles3D2" type="GPUParticles3D" parent="Ball"]
transform = Transform3D(0.0753269, 0, -0.997159, 0, 1, 0, 0.997159, 0, 0.0753269, 0, 0, 0)
visible = false
cast_shadow = 0
amount = 1000
lifetime = 5.0
fixed_fps = 60
process_material = SubResource("ParticleProcessMaterial_ry4cm")
draw_pass_1 = SubResource("SphereMesh_caeh0")
[node name="Ball2" type="MeshInstance3D" parent="."]
transform = Transform3D(0.0753269, 0, -0.997159, 0, 1, 0, 0.997159, 0, 0.0753269, 0, 0, 2.30962)
mesh = SubResource("SphereMesh_ui3pw")
skeleton = NodePath("GPUParticles3D2")
[node name="GPUParticles3D2" type="GPUParticles3D" parent="Ball2"]
transform = Transform3D(0.0753269, 0, -0.997159, 0, 1, 0, 0.997159, 0, 0.0753269, 0, 0, 0)
cast_shadow = 0
amount = 25000
lifetime = 5.0
fixed_fps = 60
process_material = SubResource("ParticleProcessMaterial_ry4cm")
draw_pass_1 = SubResource("SphereMesh_caeh0")

View file

@ -1,7 +1,38 @@
[gd_scene load_steps=2 format=3 uid="uid://c0jgk88bnwwbs"] [gd_scene load_steps=4 format=3 uid="uid://c0jgk88bnwwbs"]
[ext_resource type="Script" path="res://scripts/manager.gd" id="1_5d7ur"] [ext_resource type="Script" path="res://scripts/manager.gd" id="1_5d7ur"]
[sub_resource type="Animation" id="Animation_qy15n"]
resource_name = "timeline"
length = 10.0
tracks/0/type = "method"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 10),
"transitions": PackedFloat32Array(1, 1),
"values": [{
"args": [0],
"method": &"set_scene"
}, {
"args": [1],
"method": &"set_scene"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_v07gp"]
_data = {
"timeline": SubResource("Animation_qy15n")
}
[node name="Manager" type="Manager"] [node name="Manager" type="Manager"]
bgm = "res://assets/bgm.ogg" bgm = "res://assets/bgm.ogg"
script = ExtResource("1_5d7ur") script = ExtResource("1_5d7ur")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_v07gp")
}

48
entities/shape_dance.tscn Normal file
View file

@ -0,0 +1,48 @@
[gd_scene load_steps=8 format=3 uid="uid://lcp4gqi6nigy"]
[ext_resource type="Script" path="res://scripts/shape_dance.gd" id="1_g2fd3"]
[ext_resource type="Shader" path="res://assets/shaders/ShapeDanceShapes.gdshader" id="2_jw15c"]
[sub_resource type="Curve3D" id="Curve3D_kx25u"]
_data = {
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 0, 0, -6.635, 0, 14.74, 0, 0, 0, 60, 0, 1.8),
"tilts": PackedFloat32Array(0, 0)
}
point_count = 2
[sub_resource type="ShaderMaterial" id="ShaderMaterial_r1n2u"]
render_priority = 0
shader = ExtResource("2_jw15c")
[sub_resource type="BoxMesh" id="BoxMesh_ysqih"]
material = SubResource("ShaderMaterial_r1n2u")
[sub_resource type="Sky" id="Sky_ux7r0"]
[sub_resource type="Environment" id="Environment_1wa4s"]
background_mode = 2
sky = SubResource("Sky_ux7r0")
[node name="ShapeDance" type="Node3D"]
script = ExtResource("1_g2fd3")
amount = 20
offset = 2.8
shape_shader = ExtResource("2_jw15c")
[node name="Path" type="Path3D" parent="."]
curve = SubResource("Curve3D_kx25u")
[node name="PathFollow3D" type="PathFollow3D" parent="Path"]
transform = Transform3D(-0.0299847, 0, -0.999484, 0, 0.999932, 0, 0.999487, 0, -0.0299846, 0, 0, 0)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Path/PathFollow3D"]
mesh = SubResource("BoxMesh_ysqih")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(0.394721, 0.132523, -0.909194, -0.0542735, 0.991179, 0.120911, 0.917197, 0.00161915, 0.398431, -0.411877, 1.41195, 2.2298)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_1wa4s")
[node name="ShowLight" type="DirectionalLight3D" parent="."]
visible = false

View file

@ -27,7 +27,7 @@ position = Vector2(534, 309)
texture = ExtResource("1_3phrh") texture = ExtResource("1_3phrh")
[node name="ScramblingText" type="ScramblingText" parent="."] [node name="ScramblingText" type="ScramblingText" parent="."]
duration = 0.5 infinite = false
offset_right = 40.0 offset_right = 40.0
offset_bottom = 23.0 offset_bottom = 23.0
text = "HELLO WORLD" text = "HELLO WORLD"

View file

@ -0,0 +1,19 @@
shader_type spatial;
render_mode unshaded;
uniform sampler2D depth_texture : source_color, hint_depth_texture;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
float depth = texture(depth_texture, SCREEN_UV).x;
//ALBEDO = vec3(1.0, 1.0, 1.0);
ALBEDO = vec3(0.7, 0.7, 0.7) + depth * SCREEN_UV.x;
ALPHA = 1.0;
}
void light() {
DIFFUSE_LIGHT = vec3(1.0, 1.0, 1.0);
}

View file

@ -1,10 +1,16 @@
extends Manager extends Manager
var scene1: PackedScene = preload("res://entities/test.tscn") var scene1: PackedScene = preload("res://entities/test.tscn");
var scene2: PackedScene = preload("res://entities/shape_dance.tscn");
var scene3: PackedScene = preload("res://entities/ParticlesCool.tscn");
var scene4: PackedScene = preload("res://entities/test.tscn")
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
register_scene(scene1); register_scene(scene1);
register_scene(scene2);
register_scene(scene3);
register_scene(scene4);
start_audio(); start_audio();
set_scene(0); $AnimationPlayer.play("timeline");

10
scripts/particles_cool.gd Normal file
View file

@ -0,0 +1,10 @@
extends Node3D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$OrbitCam/Camera3D.current = true;
#
#func _physics_process(delta: float) -> void:
#$OrbitCam.rotate_y(1.0);

32
scripts/shape_dance.gd Normal file
View file

@ -0,0 +1,32 @@
extends Node3D
@export var amount: int = 2;
@export var offset: float = 2.0;
@export var shape_shader: Shader;
@onready var path: Path3D = $Path
@onready var shape_material: ShaderMaterial = ShaderMaterial.new();
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
$Camera3D.make_current();
shape_material.set_shader(shape_shader);
var path_length: float = (path as Path3D).get_curve().get_baked_length();
for i in range(amount):
var instance: PathFollow3D = PathFollow3D.new();
var mesh_instance: MeshInstance3D = MeshInstance3D.new();
mesh_instance.mesh = BoxMesh.new();
mesh_instance.set_surface_override_material(0, shape_material);
mesh_instance.set_instance_shader_parameter("id", i);
print("kaka" + str((mesh_instance.get_surface_override_material(0) as Material).get_shader_parameter("id")))
instance.add_child(mesh_instance);
path.add_child(instance);
instance.set_progress_ratio(offset / 100 * i);
#print(instance.progress_ratio);
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass