Compare commits

...

2 commits

Author SHA1 Message Date
Rodolphe Houdas 0c12f80c91 Add framerate on visualiser 2023-03-25 22:53:52 +00:00
Rodolphe Houdas 59476fe744 Add cool synthwave style 2023-03-14 21:19:59 +00:00
28 changed files with 437 additions and 61 deletions

View file

@ -3,16 +3,16 @@
name="Linux/X11"
platform="Linux/X11"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="build/UltraleapPluginDemo.Debug.x86_64"
export_path="build/UltraleapPluginDemo.Release.x86_64"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_export_mode=1
script_encryption_key=""
[preset.0.options]
@ -25,5 +25,57 @@ texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
[preset.1]
name="Synthwave Cubes"
platform="Linux/X11"
runnable=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="build/SynthCubes/SynthCubes.x86_64"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_encryption_key=""
[preset.1.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_script=0
binary_format/embed_pck=false
texture_format/bptc=true
texture_format/s3tc=true
texture_format/etc=true
texture_format/etc2=true
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""

View file

@ -1,6 +1,5 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://ba0vd7yms13m1"]
[resource]
shading_mode = 0
albedo_color = Color(0.243137, 0.203922, 0.788235, 1)
metallic_specular = 0.0
roughness = 0.0

View file

@ -1,6 +1,5 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://byps4v7vxvs7n"]
[resource]
shading_mode = 0
albedo_color = Color(0.203922, 0.788235, 0.321569, 1)
metallic_specular = 0.0
roughness = 0.0

View file

@ -1,6 +1,5 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://l7fs3clvptwt"]
[resource]
shading_mode = 0
albedo_color = Color(0.788235, 0.203922, 0.203922, 1)
metallic_specular = 0.0
roughness = 0.0

View file

@ -7,6 +7,7 @@
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7aiux"]
shader = ExtResource("1_biwbg")
shader_parameter/default_colour = Color(0, 0, 0, 1)
shader_parameter/gammaExponent = 1.6
shader_parameter/left = ExtResource("2_uqhtk")
shader_parameter/right = ExtResource("3_kniuh")

13
demo/materials/cube.tres Normal file
View file

@ -0,0 +1,13 @@
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://cbko4lro38pl0"]
[ext_resource type="Texture2D" uid="uid://db4h7k72xse3v" path="res://textures/cube_border.png" id="1_1cceb"]
[ext_resource type="Texture2D" uid="uid://3w6gtvgxxvs0" path="res://textures/cube_emission.png" id="2_xd48o"]
[resource]
transparency = 4
cull_mode = 2
albedo_texture = ExtResource("1_1cceb")
emission_enabled = true
emission_energy_multiplier = 16.0
emission_operator = 1
emission_texture = ExtResource("2_xd48o")

16
demo/materials/floor.tres Normal file
View file

@ -0,0 +1,16 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://btq70n04ejajl"]
[ext_resource type="Texture2D" uid="uid://cegr0wkrccadm" path="res://textures/grid_square.png" id="1_qvtap"]
[resource]
transparency = 4
albedo_color = Color(1, 0.160784, 0.458824, 1)
albedo_texture = ExtResource("1_qvtap")
metallic = 1.0
roughness = 0.67
emission_enabled = true
emission = Color(1, 0.160784, 0.458824, 1)
uv1_scale = Vector3(5000, 5000, 5000)
texture_filter = 5
grow_amount = -1.185
proximity_fade_distance = 0.0

6
demo/materials/hand.tres Normal file
View file

@ -0,0 +1,6 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://btbe5pq8cyrl3"]
[resource]
distance_fade_mode = 2
distance_fade_min_distance = 0.01
distance_fade_max_distance = 0.15

View file

@ -0,0 +1,11 @@
[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://d1llsf23kirfn"]
[ext_resource type="Texture2D" uid="uid://3w6gtvgxxvs0" path="res://textures/cube_emission.png" id="1_r40q2"]
[resource]
resource_local_to_scene = true
transparency = 4
emission_enabled = true
emission_energy_multiplier = 16.0
emission_operator = 1
emission_texture = ExtResource("1_r40q2")

View file

@ -0,0 +1,21 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://d3u0nr4hfuyeg"]
[ext_resource type="Shader" path="res://shaders/synthwave_sky.gdshader" id="1_yk2sd"]
[resource]
shader = ExtResource("1_yk2sd")
shader_parameter/horizon = Color(0.94902, 0.133333, 1, 1)
shader_parameter/top = Color(0.54902, 0.117647, 1, 1)
shader_parameter/bottom = null
shader_parameter/bottom_horizon = Color(0.243137, 0.00392157, 0.431373, 1)
shader_parameter/sun_top = Color(1, 0.827451, 0.0980392, 1)
shader_parameter/sun_horizon = Color(1, 0.160784, 0.458824, 1)
shader_parameter/line_color = Color(0, 0.945098, 1, 1)
shader_parameter/line_width = 0.001
shader_parameter/center = Vector2(0, 0.093)
shader_parameter/radius = 0.15
shader_parameter/min_stripes_height = 0.0
shader_parameter/max_stripes_height = 0.15
shader_parameter/n_stripes = 6
shader_parameter/min_width_modulation = 0.4
shader_parameter/max_width_modulation = 1.0

View file

@ -0,0 +1,6 @@
[gd_resource type="Sky" load_steps=2 format=3 uid="uid://bhsbdowctuwnw"]
[ext_resource type="Material" uid="uid://d3u0nr4hfuyeg" path="res://materials/synthwave_shader.tres" id="1_ieoih"]
[resource]
sky_material = ExtResource("1_ieoih")

View file

@ -0,0 +1,10 @@
[gd_resource type="Sky" load_steps=2 format=3 uid="uid://c8yv2jy7uh4ef"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_7b6ju"]
sky_top_color = Color(0.54902, 0.117647, 1, 1)
sky_horizon_color = Color(0.94902, 0.133333, 1, 1)
ground_bottom_color = Color(0.137255, 0.0431373, 0.203922, 1)
ground_horizon_color = Color(0.341176, 0.00784314, 0.588235, 1)
[resource]
sky_material = SubResource("ProceduralSkyMaterial_7b6ju")

View file

@ -80,3 +80,8 @@ toggle_dev_panel={
[native_extensions]
paths=["res://addons/godot_ultraleap_plugin/godot_ultraleap_plugin.gdextension"]
[rendering]
lights_and_shadows/directional_shadow/soft_shadow_filter_quality=5
anti_aliasing/quality/msaa_3d=3

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://3ughg8xnqqqe"]
[gd_scene load_steps=4 format=3 uid="uid://3ughg8xnqqqe"]
[ext_resource type="PhysicsMaterial" uid="uid://6k8xjvrlw20i" path="res://materials/physics/Cube.tres" id="1_m4ep5"]
[ext_resource type="Material" uid="uid://d1llsf23kirfn" path="res://materials/spawned_cube.tres" id="2_j3so6"]
[sub_resource type="BoxShape3D" id="BoxShape3D_p6njc"]
resource_local_to_scene = true
@ -13,3 +14,4 @@ can_sleep = false
shape = SubResource("BoxShape3D_p6njc")
[node name="CSGBox3D" type="CSGBox3D" parent="."]
material = ExtResource("2_j3so6")

View file

@ -1,8 +1,18 @@
[gd_scene load_steps=2 format=3 uid="uid://bgh27uj3dhagi"]
[gd_scene load_steps=4 format=3 uid="uid://bgh27uj3dhagi"]
[ext_resource type="Material" uid="uid://btq70n04ejajl" path="res://materials/floor.tres" id="1_r1bwr"]
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_lkajd"]
[sub_resource type="PlaneMesh" id="PlaneMesh_xjb7h"]
size = Vector2(1000, 1000)
[node name="StaticBody3D" type="StaticBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("WorldBoundaryShape3D_lkajd")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0)
mesh = SubResource("PlaneMesh_xjb7h")
surface_material_override/0 = ExtResource("1_r1bwr")

View file

@ -1,13 +1,15 @@
[gd_scene load_steps=3 format=3 uid="uid://uaaq7yd773go"]
[gd_scene load_steps=4 format=3 uid="uid://uaaq7yd773go"]
[ext_resource type="Script" path="res://scripts/HUD.gd" id="1_expu4"]
[ext_resource type="AnimationLibrary" uid="uid://svwrh3vdc31s" path="res://animations/HUD_Animations.tres" id="2_dxjft"]
[ext_resource type="Script" path="res://scripts/FPSLabel.gd" id="3_jgha6"]
[node name="HUD" type="CanvasLayer" node_paths=PackedStringArray("subtitle", "subtitle_animator", "tracking_choice")]
[node name="HUD" type="CanvasLayer" node_paths=PackedStringArray("subtitle", "subtitle_animator", "tracking_choice", "tracking_framerate")]
script = ExtResource("1_expu4")
subtitle = NodePath("Label")
subtitle_animator = NodePath("AnimationPlayer")
tracking_choice = NodePath("OptionButton")
tracking_framerate = NodePath("HBoxContainer/TrackingFramerate")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../Label")
@ -21,10 +23,10 @@ anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -300.0
offset_top = -98.0
offset_right = 300.0
offset_bottom = -25.999
offset_left = 276.0
offset_top = 550.0
offset_right = 876.0
offset_bottom = 622.001
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
@ -58,5 +60,31 @@ offset_right = -20.0
offset_bottom = 49.0
grow_horizontal = 0
[node name="HBoxContainer" type="HBoxContainer" parent="."]
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 18.0
offset_top = -32.0
offset_right = -18.0
grow_horizontal = 2
grow_vertical = 0
alignment = 2
[node name="ApplicationFramerate" type="Label" parent="HBoxContainer"]
layout_mode = 2
text = "FPS: 1"
script = ExtResource("3_jgha6")
prefix = "Application Frame Rate:"
[node name="Spacer" type="Control" parent="HBoxContainer"]
custom_minimum_size = Vector2(8, 0)
layout_mode = 2
[node name="TrackingFramerate" type="Label" parent="HBoxContainer"]
layout_mode = 2
text = "FPS: 1"
[connection signal="item_selected" from="OptionButton" to="." method="button_item_selected"]
[connection signal="item_selected" from="Devices" to="." method="device_selected"]

View file

@ -4,7 +4,9 @@
[ext_resource type="Script" path="res://scripts/Starter.gd" id="1_r2upn"]
[ext_resource type="PhysicsMaterial" uid="uid://6k8xjvrlw20i" path="res://materials/physics/Cube.tres" id="2_cn4n8"]
[ext_resource type="Script" path="res://scripts/HandRigger.gd" id="2_tavpj"]
[ext_resource type="Sky" uid="uid://bhsbdowctuwnw" path="res://materials/synthwave_shader_sky.tres" id="4_7qc5t"]
[ext_resource type="Resource" uid="uid://calogg0183u0c" path="res://resources/hand_mappings/default_hands/DefaultLeftHandMapping.tres" id="4_t22n4"]
[ext_resource type="Material" uid="uid://btbe5pq8cyrl3" path="res://materials/hand.tres" id="5_fla0v"]
[ext_resource type="Resource" uid="uid://b30gqri16oypr" path="res://resources/hand_mappings/default_hands/DefaultRightHandMapping.tres" id="5_mnjpi"]
[ext_resource type="Script" path="res://scripts/OriginHands.gd" id="6_7qixu"]
[ext_resource type="Resource" uid="uid://cffd7giqey3m1" path="res://resources/hand_rigging_settings/XRToolsLeftHandRigSettings.tres" id="6_iolh5"]
@ -15,18 +17,15 @@
[ext_resource type="Script" path="res://scripts/CubeSpawner.gd" id="14_d8lm2"]
[ext_resource type="PackedScene" uid="uid://camq2pwvs2mjs" path="res://models/hand_r.gltf" id="14_jr4j5"]
[ext_resource type="PackedScene" uid="uid://bgh27uj3dhagi" path="res://scenes/Floor.tscn" id="14_oblky"]
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_84e0b"]
plane = Plane(1, 0, 0, 0)
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_7b6ju"]
[sub_resource type="Sky" id="Sky_2u0nm"]
sky_material = SubResource("ProceduralSkyMaterial_7b6ju")
[ext_resource type="Material" uid="uid://cbko4lro38pl0" path="res://materials/cube.tres" id="16_vxkw4"]
[sub_resource type="Environment" id="Environment_rgujr"]
background_mode = 2
sky = SubResource("Sky_2u0nm")
sky = ExtResource("4_7qc5t")
ssr_depth_tolerance = 0.51
ssao_enabled = true
ssil_enabled = true
glow_enabled = true
[node name="RiggedHand" type="Node3D" node_paths=PackedStringArray("origin_hands", "rigged_hands", "spawner")]
script = ExtResource("1_58k8d")
@ -38,42 +37,13 @@ cube_material = ExtResource("2_cn4n8")
[node name="Scene" type="Node3D" parent="."]
[node name="Floor" parent="Scene" instance=ExtResource("14_oblky")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
[node name="LeftRightWalls" type="Node3D" parent="Scene"]
[node name="StaticBody3D" type="StaticBody3D" parent="Scene/LeftRightWalls"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Scene/LeftRightWalls/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0)
shape = SubResource("WorldBoundaryShape3D_84e0b")
[node name="StaticBody3D2" type="StaticBody3D" parent="Scene/LeftRightWalls"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 1, 0, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Scene/LeftRightWalls/StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0)
shape = SubResource("WorldBoundaryShape3D_84e0b")
[node name="FrontBackWalls" type="Node3D" parent="Scene"]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0)
[node name="StaticBody3D" type="StaticBody3D" parent="Scene/FrontBackWalls"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Scene/FrontBackWalls/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0)
shape = SubResource("WorldBoundaryShape3D_84e0b")
[node name="StaticBody3D2" type="StaticBody3D" parent="Scene/FrontBackWalls"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 1, 0, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Scene/FrontBackWalls/StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, 0, 0)
shape = SubResource("WorldBoundaryShape3D_84e0b")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="Scene"]
transform = Transform3D(1, 0, 0, 0, 0.631434, 0.77543, 0, -0.77543, 0.631434, 0, 1.46918, 0)
transform = Transform3D(1, 0, 0, 0, -0.996195, 0.0871559, 0, -0.0871559, -0.996195, -0.0119386, 1.47708, 0.00149798)
light_color = Color(1, 0.827451, 0.0980392, 1)
shadow_enabled = true
directional_shadow_blend_splits = true
directional_shadow_max_distance = 10.0
[node name="WorldEnvironment" type="WorldEnvironment" parent="Scene"]
environment = SubResource("Environment_rgujr")
@ -82,10 +52,21 @@ environment = SubResource("Environment_rgujr")
[node name="hand_l" parent="Scene/XRToolsHands" instance=ExtResource("13_6nyhp")]
[node name="mesh_Hand_L" parent="Scene/XRToolsHands/hand_l/Armature/Skeleton3D" index="0"]
surface_material_override/0 = ExtResource("5_fla0v")
[node name="hand_r" parent="Scene/XRToolsHands" instance=ExtResource("14_jr4j5")]
[node name="mesh_Hand_R" parent="Scene/XRToolsHands/hand_r/Armature/Skeleton3D" index="0"]
surface_material_override/0 = ExtResource("5_fla0v")
[node name="ReflectionProbe" type="ReflectionProbe" parent="Scene"]
visible = false
update_mode = 1
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.903336, 0.428935, 0, -0.428935, 0.903336, 0, 0.33, 0.355)
near = 0.001
[node name="HandTracking" type="Node3D" parent="."]
@ -148,6 +129,7 @@ script = ExtResource("14_d8lm2")
left_hand_pinch_detector = NodePath("../HandTracking/Detectors/PinchDetectors/LeftHandDetector")
right_hand_pinch_detector = NodePath("../HandTracking/Detectors/PinchDetectors/RightHandDetector")
max_cube_size = 0.15
cube_spawn_material = ExtResource("16_vxkw4")
[node name="DevPanel" type="Control" parent="."]
layout_mode = 3

View file

@ -14,6 +14,8 @@ class_name CubeSpawner
@export var set_force : bool = true
@export var set_torque : bool = true
@export var cube_spawn_material : StandardMaterial3D
var size_offset : float = 0.04
var min_distance : float = min_cube_size + size_offset
@ -28,6 +30,17 @@ var spawn_size : Vector3 = Vector3.ZERO
var spawn_basis : Basis = Basis.IDENTITY
var prev_cube_transform : Transform3D
var latest_colour : String = "E40303"
var colours : Dictionary = {
"cyan": "#00F1FF",
"blue": "#0161E8",
"bluer": "#290CFF",
"purple": "#9B00E8",
"pink": "#FF019A"
}
var rng : RandomNumberGenerator = RandomNumberGenerator.new()
func _physics_process(delta):
if cubes.size() > max_cubes:
@ -47,6 +60,13 @@ func _physics_process(delta):
spawning_cube = CSGBox3D.new()
get_tree().get_root().add_child(spawning_cube)
spawning_cube.owner = get_tree().get_root()
spawning_cube.material = cube_spawn_material
spawning_cube.material.setup_local_to_scene()
var i : int = rng.randi_range(0, colours.keys().size() - 1)
latest_colour = colours[colours.keys()[i]]
spawning_cube.material.albedo_color = latest_colour
spawning_cube.material.emission = latest_colour
both_pinched = true
@ -85,6 +105,8 @@ func _physics_process(delta):
cube_transform.basis = cube_transform.basis.scaled(spawn_size)
new_cube.get_node("CSGBox3D").size = cube_transform.basis.get_scale()
new_cube.get_node("CollisionShape3D").shape.size = cube_transform.basis.get_scale()
new_cube.get_node("CSGBox3D").material.albedo_color = latest_colour
new_cube.get_node("CSGBox3D").material.emission = latest_colour
# Seems better if I set inertia to zero (recomputes propa' inertia ?)
new_cube.inertia = Vector3.ZERO

6
demo/scripts/FPSLabel.gd Normal file
View file

@ -0,0 +1,6 @@
extends Label
@export var prefix = "FPS:"
func _process(delta):
text = prefix + " " + str(Performance.get_monitor(Performance.TIME_FPS))

View file

@ -7,17 +7,29 @@ extends CanvasLayer
@export var tracking_choice : OptionButton
@export var tracking_framerate : Label
signal tracking_mode_request(tracking_mode : UltraleapTypes.TrackingMode)
signal device_selection(serial : String)
var current_device : UltraleapDevice
var latest_update : float = 0
func _ready():
subtitle_animator.play("show_subtitle")
subtitle_animator.seek(0, true)
subtitle_animator.stop(false)
func _physics_process(delta):
if (current_device == null):
return
if Time.get_unix_time_from_system() - latest_update > 0.5:
tracking_framerate.text = "Tracking Frame Rate: " + str(ceil(current_device.get_last_frame().framerate))
latest_update = Time.get_unix_time_from_system()
func play_floating_bottom_text(text : String):
subtitle.text = text
subtitle_animator.play("show_subtitle")

View file

@ -5,6 +5,8 @@ uniform sampler2D right : hint_default_black;
uniform vec3 default_colour : source_color;
uniform float gammaExponent = 1.0;
void sky() {
ivec2 left_texture_size = textureSize(left, 0);
ivec2 right_texture_size = textureSize(right, 0);
@ -25,5 +27,5 @@ void sky() {
float text_is_valid = is_left_side * left_text_is_valid + (1.0 - is_left_side) * right_text_is_valid;
COLOR = text_is_valid * pix + (1.0 - text_is_valid) * default_colour;
COLOR = pow(text_is_valid * pix + (1.0 - text_is_valid) * default_colour, vec3(gammaExponent));
}

View file

@ -0,0 +1,69 @@
shader_type sky;
uniform vec4 horizon : source_color;
uniform vec4 top : source_color;
uniform vec4 bottom : source_color;
uniform vec4 bottom_horizon : source_color;
uniform vec4 sun_top : source_color;
uniform vec4 sun_horizon : source_color;
uniform vec4 line_color : source_color;
uniform float line_width = 0.001;
uniform vec2 center;
uniform float radius;
uniform float min_stripes_height : hint_range(0.0, 1.0, 0.01);
uniform float max_stripes_height : hint_range(0.0, 1.0, 0.01);
uniform int n_stripes = 5;
uniform float min_width_modulation : hint_range(0.0, 1.0, 0.1);
uniform float max_width_modulation : hint_range(0.0, 1.0, 0.1) = 1.0;
float dst_circle(vec2 c, float r, vec2 p) {
return distance(c, p) - radius;
}
void sky() {
vec4 sky_gradient = mix(horizon, top, clamp(smoothstep(0, 0.2, EYEDIR.y), 0.0, 1.0));
vec4 floor_gradient = mix(bottom_horizon, bottom, clamp(smoothstep(0, -0.2, EYEDIR.y), 0.0, 1.0));
vec4 sky_mask = vec4(vec3(1.0 - step(EYEDIR.y, 0)), 0.0);
vec4 floor_mask = vec4(vec3(step(EYEDIR.y, 0)), 0.0);
vec4 bg = (sky_gradient * sky_mask) + (floor_gradient * floor_mask);
vec4 line_mask = (smoothstep(0.5 - line_width, 0.5, SKY_COORDS.y)) * (smoothstep(0.5 + line_width, 0.5, SKY_COORDS.y)) * vec4(1.0);
vec3 result = ((vec3(1.0) - line_mask.rgb) * bg.rgb) + (line_mask.rgb * line_color.rgb);
// Making the sun
float dst = dst_circle(center, radius, EYEDIR.xy);
vec4 sun_mask = vec4(vec3(smoothstep(0.01, 0, dst)), 1.0) * step(0.0, EYEDIR.y) * (vec4(1.0, 1.0, 1.0, 0.0) - line_mask);
vec4 sun_gradient = mix(sun_horizon, sun_top, clamp(smoothstep(0, 0.25, EYEDIR.y), 0.0, 1.0));
// Make stripes
// Normalize eyedir height between min height and max height for pattern
float eyedir = clamp(smoothstep(min_stripes_height, max_stripes_height, EYEDIR.y), 0.0, 1.0);
float max_stripe_height = 1.0 / float(n_stripes);
// Create repeating pattern and normalize the signal
float pattern_height = mod(eyedir, max_stripe_height) / max_stripe_height;
float n = ceil(eyedir / max_stripe_height);
float width_modulation = mix(min_width_modulation, max_width_modulation, n / float(n_stripes));
//signal = step(signal, width_modulation);
float signal = smoothstep(width_modulation - 0.05, width_modulation + 0.05, pattern_height) * smoothstep(1.0, 0.95, pattern_height);
//signal = smoothstep(0.25, signal, eyedir) + smoothstep(signal, 0.75, eyedir);
vec4 stripes_mask = (1.0 - signal) * sun_mask;
sun_mask = stripes_mask * sun_mask;
COLOR = (vec3(1.0) - sun_mask.rgb) * result.rgb + sun_gradient.rgb * sun_mask.rgb;
//COLOR = stripes_mask.rgb;
//COLOR.r = signal;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://db4h7k72xse3v"
path.s3tc="res://.godot/imported/cube_border.png-d995297aef82249c95cc50dc7569bcb9.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/cube_border.png"
dest_files=["res://.godot/imported/cube_border.png-d995297aef82249c95cc50dc7569bcb9.s3tc.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 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://3w6gtvgxxvs0"
path.s3tc="res://.godot/imported/cube_emission.png-cb902755aeed5a689ebab4d26b30f6dc.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/cube_emission.png"
dest_files=["res://.godot/imported/cube_emission.png-cb902755aeed5a689ebab4d26b30f6dc.s3tc.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 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cegr0wkrccadm"
path.s3tc="res://.godot/imported/grid_square.png-2c3884cc6134a99150267407ac4a5374.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://textures/grid_square.png"
dest_files=["res://.godot/imported/grid_square.png-2c3884cc6134a99150267407ac4a5374.s3tc.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