adding starlight projector

This commit is contained in:
betalars 2023-02-08 11:37:23 +01:00
parent fb7d2f5d01
commit e580e1a38d
13 changed files with 1283 additions and 5 deletions

View file

@ -0,0 +1,56 @@
shader_type spatial;
render_mode blend_add, specular_disabled, ambient_light_disabled;
/*
noise1 = universe_noise.rg
noise2 = universe_noise.ba
*/
uniform sampler2D universe_noise;
/*
stars = other_noise.r
star_noise = other_noise.g
gradient = other_noise.b
*/
uniform vec2 displace_gradient = vec2(0.0);
uniform vec2 displace_stars = vec2(0.0);
uniform float star_scale = 0.5;
uniform sampler2D other_noise;
uniform vec4 fog_color:hint_color = vec4(0.0, 0.0, 1.0, 1.0);
uniform vec4 star_color:hint_color = vec4(1.0);
uniform float strengh_noise1 = 3.0;
uniform float strengh_noise2 = 3.0;
uniform float strengh_star_noise = 0.5;
uniform float time_scale_noise1 = 0.05;
uniform float time_scale_noise2 = 0.05;
uniform float time_scale_stars = 0.05;
uniform float time_scale_star_noise = 0.2;
// https://gist.github.com/ayamflow/c06bc0c8a64f985dd431bd0ac5b557cd
vec2 rotateUV(vec2 uv, vec2 mid, float rotation)
{
return vec2(
cos(rotation) * (uv.x - mid.x) + sin(rotation) * (uv.y - mid.y) + mid.x,
cos(rotation) * (uv.y - mid.y) - sin(rotation) * (uv.x - mid.x) + mid.y
);
}
void fragment() {
ALBEDO = vec3(0.0);
ALBEDO = fog_color.rgb * texture(other_noise, displace_gradient + UV +
(
texture(universe_noise, rotateUV(UV, vec2(0.0, 0.0), TIME * time_scale_noise1)).rg
- vec2(.5)
)
* strengh_noise1
+ (
texture(universe_noise, rotateUV(UV, vec2(1.0, 1.0), TIME * time_scale_noise2)).ba
- vec2(.5)
)
* strengh_noise2
).b
+ (star_color.rgb * (texture(other_noise, rotateUV(UV, vec2(0.0, 0.0), TIME * time_scale_noise2) ).r
* max(0.0, sin(
TIME * time_scale_star_noise
* texture(other_noise, UV).g
))));
}

BIN
src/assets/VFX/stars_and_gradient.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/stars_and_gradient.png-fe9412781c2987f4f28a9b70b98ad323.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/VFX/stars_and_gradient.png"
dest_files=[ "res://.import/stars_and_gradient.png-fe9412781c2987f4f28a9b70b98ad323.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.9
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=1
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

BIN
src/assets/VFX/universe_noise.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/universe_noise.png-c1b138e3a84d69fb8ab3f799b304a053.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/VFX/universe_noise.png"
dest_files=[ "res://.import/universe_noise.png-c1b138e3a84d69fb8ab3f799b304a053.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=true
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

Binary file not shown.

BIN
src/assets/youth_room/starlight_catcher.glb (Stored with Git LFS) Normal file

Binary file not shown.

File diff suppressed because it is too large Load diff

BIN
src/assets/youth_room/starlight_catcher_room001.mesh (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://assets/youth_room/youth_room.glb" type="PackedScene" id=1]
[ext_resource path="res://assets/textures/hdr/pretville_cinema_4k.hdr" type="Texture" id=2]
[ext_resource path="res://assets/youth_room/starlight_catcher_room001.mesh" type="ArrayMesh" id=6]
[sub_resource type="PanoramaSky" id=1]
radiance_size = 4
@ -12,6 +13,15 @@ background_mode = 2
background_sky = SubResource( 1 )
background_sky_orientation = Basis( -0.866025, 0.5, 8.74228e-08, 0.5, 0.866025, 0, -7.57103e-08, 4.37114e-08, -1 )
background_energy = 0.1
fog_enabled = true
fog_color = Color( 0.0627451, 0.0666667, 0.168627, 1 )
fog_depth_enabled = false
fog_depth_curve = 0.812252
fog_transmit_curve = 1.10957
fog_height_enabled = true
fog_height_min = 3.0
fog_height_max = -2.0
fog_height_curve = 3.36358
tonemap_mode = 1
tonemap_exposure = 1.62
tonemap_white = 2.01
@ -156,6 +166,7 @@ depth = 4.39209
environment = SubResource( 2 )
[node name="Thunder" type="Spatial" parent="WorldEnvironment"]
visible = false
[node name="AnimationPlayer" type="AnimationPlayer" parent="WorldEnvironment/Thunder"]
autoplay = "lightning_1"
@ -163,10 +174,11 @@ anims/RESET = SubResource( 4 )
anims/lightning_1 = SubResource( 5 )
[node name="DirectionalLight" type="SpotLight" parent="WorldEnvironment/Thunder"]
transform = Transform( 0.928274, 0.0676328, -0.365694, 0.00504579, 0.980943, 0.194227, 0.371861, -0.182142, 0.910243, 0, 2.42148, 5.72203 )
transform = Transform( 0.928274, 0.0676328, -0.365694, 0.00504578, 0.980943, 0.194227, 0.371861, -0.182142, 0.910243, 0, 2.42148, 5.72203 )
light_color = Color( 0.87451, 0.968627, 1, 1 )
light_energy = 0.0
light_specular = 4.662
light_cull_mask = 4294966273
shadow_enabled = true
spot_range = 8.5031
spot_angle = 22.4863
@ -174,6 +186,7 @@ spot_angle = 22.4863
[node name="OmniLight" type="OmniLight" parent="WorldEnvironment/Thunder/DirectionalLight"]
transform = Transform( 0.914217, -0.0247696, 0.404467, 0.0922751, 0.984632, -0.14827, -0.394579, 0.172874, 0.902454, -1.74898, 0.227914, -8.58099 )
light_energy = 0.0
light_cull_mask = 4294966289
omni_range = 6.36159
script = SubResource( 6 )
@ -182,13 +195,15 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.191191, 1.74344, -0.0735504
light_color = Color( 0.101961, 0, 1, 1 )
light_energy = 0.2
light_specular = 0.0
light_cull_mask = 4294966273
omni_range = 4.66672
omni_attenuation = 0.329878
[node name="OmniLight2" type="OmniLight" parent="WorldEnvironment"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.23416, 1.99505, 0.375105 )
light_color = Color( 1, 0.666667, 0.470588, 1 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.931734, 1.87783, 0.470971 )
light_color = Color( 1, 0.647059, 0.447059, 1 )
light_energy = 0.2
light_cull_mask = 4294966273
shadow_enabled = true
shadow_bias = 0.034
omni_range = 3.81869
@ -199,6 +214,7 @@ omni_shadow_mode = 0
transform = Transform( 0.99801, 0.0320666, 0.0542887, -0.0630518, 0.507564, 0.859304, 0, -0.861017, 0.508576, -0.585629, 1.40734, 1.63678 )
light_color = Color( 0.952941, 0.694118, 0.419608, 1 )
light_energy = 4.0
light_cull_mask = 4294966273
spot_range = 1.3341
spot_angle = 53.3304
@ -206,13 +222,15 @@ spot_angle = 53.3304
transform = Transform( 1, 0, 0, 0, 1, 2.98023e-08, 0, 2.98023e-08, 1, 0.00947899, 0.0839477, -0.379508 )
light_color = Color( 1, 0.666667, 0.470588, 1 )
light_energy = 0.2
light_cull_mask = 4294966273
shadow_enabled = true
omni_range = 4.09816
omni_attenuation = 0.554784
omni_shadow_mode = 0
[node name="Camera" type="Camera" parent="."]
transform = Transform( -0.684369, 0, -0.729136, 0, 1, 0, 0.729136, 0, -0.684369, -0.579239, 1.09208, -1.04088 )
transform = Transform( 0.906234, 0.00170183, 0.422774, 0.0332697, 0.996604, -0.0753268, -0.421466, 0.0823293, 0.903099, 1.239, 1.104, 2.447 )
cull_mask = 1048573
[node name="Label" type="Label" parent="Camera"]
margin_right = 40.0
@ -221,4 +239,21 @@ script = SubResource( 3 )
[node name="SpotLight" type="SpotLight" parent="."]
transform = Transform( -0.267934, 0.906933, 0.325091, -0.828721, -0.389042, 0.402327, 0.491357, -0.161613, 0.855833, 3.21517, 0.148682, 0.80532 )
layers = 16
light_cull_mask = 4294966288
spot_angle = 40.6194
[node name="starlight_catcher_room001" type="MeshInstance" parent="."]
transform = Transform( 0.995, 0, 0, 0, 0.995, 0, 0, 0, 0.995, 0, 0, 0 )
layers = 16
mesh = ExtResource( 6 )
skeleton = NodePath("Projector")
[node name="Projector" type="SpotLight" parent="starlight_catcher_room001"]
transform = Transform( 0.701463, 0.42093, 0.583818, 0.255247, 0.616753, -0.751359, -0.672959, 0.672688, 0.323562, 1.74449, 0.672188, 0.17655 )
layers = 16
light_energy = 3.642
light_cull_mask = 4294966288
spot_range = 3.22806
spot_attenuation = 3.13834
spot_angle = 40.3476

View file

@ -0,0 +1,34 @@
[gd_scene load_steps=3 format=2]
[sub_resource type="SpatialMaterial" id=1]
flags_unshaded = true
[sub_resource type="CanvasItemMaterial" id=2]
blend_mode = 1
[node name="Spatial" type="Spatial"]
[node name="CSGBox" type="CSGBox" parent="."]
[node name="CSGBox2" type="CSGBox" parent="."]
transform = Transform( 0.385146, 0.3526, -0.128526, -0.230014, 0.367299, 0.318384, 0.296545, -0.173055, 0.413879, 0, 0, 0 )
layers = 2
material = SubResource( 1 )
[node name="Camera" type="Camera" parent="."]
transform = Transform( 0.843716, 0.0666588, 0.532636, -0.427728, 0.68302, 0.592058, -0.324335, -0.727352, 0.604786, -1.03121, 2.09691, 2.99809 )
cull_mask = 1048573
[node name="ViewportContainer" type="ViewportContainer" parent="Camera"]
material = SubResource( 2 )
margin_right = 1920.0
margin_bottom = 1080.0
[node name="Viewport" type="Viewport" parent="Camera/ViewportContainer"]
size = Vector2( 1920, 1080 )
handle_input_locally = false
render_target_update_mode = 3
[node name="Camera2" type="Camera" parent="Camera"]
transform = Transform( 1, 0, 0, -1.49012e-08, 1, -1.49012e-08, -2.98023e-08, 1.49012e-08, 1, 0, 0, 0 )
cull_mask = 1048574

View file

@ -35,6 +35,12 @@ click={
pointing/emulate_touch_from_mouse=true
[layer_names]
3d_render/layer_1="main_geometry"
3d_render/layer_2="main_lights"
3d_render/layer_3="starlight"
[physics]
common/enable_pause_aware_picking=true