Special Area Environments Setup, Guidance Room is Bugged,

This commit is contained in:
Pal
2025-09-11 03:34:46 -07:00
parent 80d4838338
commit 4364c93c5c
58 changed files with 7844 additions and 145 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,291 @@
shader_type sky;
render_mode use_quarter_res_pass;
// Originaly based on https://godotshaders.com/shader/stylized-sky-shader-with-clouds/ but there's not much left
group_uniforms sky;
uniform vec3 day_top_color : source_color = vec3( 0.1, 0.6, 1.0 );
uniform vec3 day_bottom_color : source_color = vec3( 0.4, 0.8, 1.0 );
uniform vec3 sunset_top_color : source_color = vec3( 0.7, 0.75, 1.0 );
uniform vec3 sunset_bottom_color : source_color = vec3( 1.0, 0.5, 0.7 );
uniform vec3 night_top_color : source_color = vec3( 0.02, 0.0, 0.04 );
uniform vec3 night_bottom_color : source_color = vec3( 0.1, 0.0, 0.2 );
group_uniforms horizon;
uniform vec3 horizon_color : source_color = vec3( 0.0, 0.7, 0.8 );
uniform float horizon_blur : hint_range( 0.0, 1.0, 0.01 ) = 0.05;
group_uniforms sun; // First DirectionalLight3D will be the sun
uniform vec3 sun_color : source_color = vec3( 10.0, 8.0, 1.0 );
uniform vec3 sun_sunset_color : source_color = vec3( 10.0, 0.0, 0.0 );
uniform float sun_size : hint_range( 0.01, 1.0 ) = 0.2;
uniform float sun_blur : hint_range( 0.01, 20.0 ) = 10.0;
group_uniforms moon; // Second DirectionalLight3D will be the moon
uniform vec3 moon_color : source_color = vec3( 1.0, 0.95, 0.7 );
uniform float moon_size : hint_range( 0.01, 1.0 ) = 0.06;
uniform float moon_blur : hint_range( 0.01, 10.0 ) = 0.1;
group_uniforms clouds;
// Replaced by noise functions, unncomment if you want to use graphical textures
// uniform sampler2D clouds_top_texture : filter_linear_mipmap, hint_default_black;
// uniform sampler2D clouds_middle_texture : filter_linear_mipmap, hint_default_black;
// uniform sampler2D clouds_bottom_texture : filter_linear_mipmap, hint_default_black;
uniform vec3 clouds_edge_color : source_color = vec3( 0.8, 0.8, 0.98 );
uniform vec3 clouds_top_color : source_color = vec3( 1.0, 1.0, 1.00 );
uniform vec3 clouds_middle_color : source_color = vec3( 0.92, 0.92, 0.98 );
uniform vec3 clouds_bottom_color : source_color = vec3( 0.83, 0.83, 0.94 );
uniform float clouds_speed : hint_range( 0.0, 20.0, 0.01 ) = 2.0;
uniform float clouds_direction : hint_range( -0.5, 0.5, 0.0 ) = 0.2;
uniform float clouds_scale : hint_range( 0.0, 4.0, 0.01 ) = 1.0;
uniform float clouds_cutoff : hint_range( 0.0, 1.0, 0.01 ) = 0.3;
uniform float clouds_fuzziness : hint_range( 0.0, 2.0, 0.01 ) = 0.5;
// More weight is simply a darker color, usefull for rain/storm
uniform float clouds_weight : hint_range( 0.0, 1.0, 0.01 ) = 0.0;
uniform float clouds_blur : hint_range( 0.0, 1.0, 0.01 ) = 0.25;
group_uniforms stars;
// Stars should be at black background
uniform sampler2D stars_texture : filter_linear_mipmap, hint_default_black;
uniform float stars_speed : hint_range( 0.0, 20.0, 0.01 ) = 1.0;
group_uniforms settings;
uniform float overwritten_time = 0.0;
////////////////////////////////////////////////////////////////////////////////////////////////////
// Function for clouds noises. You can replace using "gen_fractal_ping_pong" with a simple texture reading.
// I was frustrated with the repeating texture that's why I included the algorithm in the code.
// Source: https://github.com/Auburn/FastNoiseLite/tree/master
const int PRIME_X = 501125321;
const int PRIME_Y = 1136930381;
float lerp( float a, float b, float t )
{
return a + t * ( b - a );
}
float cubic_lerp( float a, float b, float c, float d, float t )
{
float p = d - c - ( a - b );
return t * t * t * p + t * t * ( a - b - p ) + t * ( c - a ) + b;
}
float ping_pong( float t )
{
t -= trunc( t * 0.5 ) * 2.0;
return t < 1.0 ? t : 2.0 - t;
}
int hash( int seed, int x_primed, int y_primed )
{
return ( seed ^ x_primed ^ y_primed ) * 0x27d4eb2d;
}
float val_coord( int seed, int x_primed, int y_primed )
{
int hash = hash( seed, x_primed, y_primed );
hash *= hash;
hash ^= hash << 19;
return float( hash ) * ( 1.0 / 2147483648.0 );
}
float single_value_cubic( int seed, float x, float y )
{
int x1 = int( floor( x ));
int y1 = int( floor( y ));
float xs = x - float( x1 );
float ys = y - float( y1 );
x1 *= PRIME_X;
y1 *= PRIME_Y;
int x0 = x1 - PRIME_X;
int y0 = y1 - PRIME_Y;
int x2 = x1 + PRIME_X;
int y2 = y1 + PRIME_Y;
int x3 = x1 + ( PRIME_X << 1 );
int y3 = y1 + ( PRIME_Y << 1 );
return cubic_lerp(
cubic_lerp( val_coord( seed, x0, y0 ), val_coord( seed, x1, y0 ), val_coord( seed, x2, y0 ), val_coord( seed, x3, y0 ), xs ),
cubic_lerp( val_coord( seed, x0, y1 ), val_coord( seed, x1, y1 ), val_coord( seed, x2, y1 ), val_coord( seed, x3, y1 ), xs ),
cubic_lerp( val_coord( seed, x0, y2 ), val_coord( seed, x1, y2 ), val_coord( seed, x2, y2 ), val_coord( seed, x3, y2 ), xs ),
cubic_lerp( val_coord( seed, x0, y3 ), val_coord( seed, x1, y3 ), val_coord( seed, x2, y3 ), val_coord( seed, x3, y3 ), xs ),
ys ) * ( 1.0 / ( 1.5 * 1.5 ));
}
// Params can be change in the same way as in noise settings in Godot
const float FRACTAL_BOUNDING = 1.0 / 1.75;
const int OCTAVES = 5;
const float PING_PONG_STRENGTH = 2.0;
const float WEIGHTED_STRENGTH = 0.0;
const float GAIN = 0.5;
const float LACUNARITY = 2.0;
float gen_fractal_ping_pong( vec2 pos, int seed, float frequency )
{
float x = pos.x * frequency;
float y = pos.y * frequency;
float sum = 0.0;
float amp = FRACTAL_BOUNDING;
for( int i = 0; i < OCTAVES; i++ )
{
float noise = ping_pong(( single_value_cubic( seed++, x, y ) + 1.0 ) * PING_PONG_STRENGTH );
sum += ( noise - 0.5 ) * 2.0 * amp;
amp *= lerp( 1.0, noise, WEIGHTED_STRENGTH );
x *= LACUNARITY;
y *= LACUNARITY;
amp *= GAIN;
}
return sum * 0.5 + 0.5;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// Function needed to calculate the phase of the moon
// Source: https://kelvinvanhoorn.com/2022/03/17/skybox-tutorial-part-1/
float sphere_intersect( vec3 view_dir, vec3 sphere_pos, float radius )
{
float b = dot( -sphere_pos, view_dir );
float c = dot( -sphere_pos, -sphere_pos ) - pow( radius, 2 );
float h = pow( b, 2 ) - c;
return h < 0.0 ? -1.0 : -b - sqrt( h );
}
void sky()
{
float time = overwritten_time != 0.0 ? overwritten_time : TIME;
//////////////////// SKY ///////////////////////////////////////////////////////////////////////
float _eyedir_y = abs( sin( EYEDIR.y * PI * 0.5 ));
// The day color will be our base color
vec3 _sky_color = mix( day_bottom_color, day_top_color, _eyedir_y );
_sky_color = mix( _sky_color, vec3( 0.0 ), clamp(( 0.7 - clouds_cutoff ) * clouds_weight, 0.0, 1.0 ));
float _sunset_amount = clamp( 0.5 - abs( LIGHT0_DIRECTION.y ), 0.0, 0.5 ) * 2.0;
// The sky should be more red around the west, on the opposite side you don't see it as much
float _sunset_distance = clamp( 1.0 - pow( distance( EYEDIR, LIGHT0_DIRECTION ), 2 ), 0.0, 1.0 );
vec3 _sky_sunset_color = mix( sunset_bottom_color, sunset_top_color, _eyedir_y + 0.5 );
_sky_sunset_color = mix( _sky_sunset_color, sunset_bottom_color, _sunset_amount * _sunset_distance );
_sky_color = mix( _sky_color, _sky_sunset_color, _sunset_amount );
float _night_amount = clamp( -LIGHT0_DIRECTION.y + 0.7, 0.0, 1.0 );
vec3 _sky_night_color = mix( night_bottom_color, night_top_color, _eyedir_y );
_sky_color = mix( _sky_color, _sky_night_color, _night_amount );
// Final sky color
COLOR = _sky_color;
//////////////////// HORIZON ///////////////////////////////////////////////////////////////////
float _horizon_amount = 0.0;
if( EYEDIR.y < 0.0 )
{
_horizon_amount = clamp( abs( EYEDIR.y ) / horizon_blur, 0.0, 1.0 );
// Mixing with the color of the night sky to make the horizon darker
vec3 _horizon_color = mix( horizon_color, _sky_color, _night_amount * 0.9 );
// And if ther are many dark clouds, we also make the horizon darker
_horizon_color = mix( _horizon_color, vec3( 0.0 ), ( 1.0 - clouds_cutoff ) * clouds_weight * 0.7 );
COLOR = mix( COLOR, _horizon_color, _horizon_amount );
}
//////////////////// MOON //////////////////////////////////////////////////////////////////////
float _moon_amount = 0.0;
if( LIGHT1_ENABLED )
{
// Bigger moon near the horizon
float _moon_size = moon_size + cos( LIGHT1_DIRECTION.y * PI ) * moon_size * 0.25;
float _moon_distance = distance( EYEDIR, LIGHT1_DIRECTION ) / _moon_size;
// Finding moon disc and edge blur
_moon_amount = clamp(( 1.0 - _moon_distance ) / moon_blur, 0.0, 1.0 );
if( _moon_amount > 0.0 )
{
// Moon illumination depending on the position of the sun
float _moon_intersect = sphere_intersect( EYEDIR, LIGHT1_DIRECTION, _moon_size );
vec3 _moon_normal = normalize( LIGHT1_DIRECTION - EYEDIR * _moon_intersect );
// Power on the result gives a better effect
float _moon_n_dot_l = pow( clamp( dot( _moon_normal, -LIGHT0_DIRECTION ), 0.05, 1.0 ), 2 );
// Hiding the moon behind the horizon
_moon_amount *= 1.0 - _horizon_amount;
COLOR = mix( COLOR, moon_color, _moon_n_dot_l * _moon_amount );
}
}
//////////////////// SUN ///////////////////////////////////////////////////////////////////////
float _sun_distance = 0.0;
if( LIGHT0_ENABLED )
{
_sun_distance = distance( EYEDIR, LIGHT0_DIRECTION );
// Bigger sun near the horizon
float _sun_size = sun_size + cos( LIGHT0_DIRECTION.y * PI ) * sun_size * 0.25;
// Finding sun disc and edge blur
float _sun_amount = clamp(( 1.0 - _sun_distance / _sun_size ) / sun_blur, 0.0, 1.0 );
if( _sun_amount > 0.0 )
{
// Changing color of the sun during sunset
float _sunset_amount = 1.0;
if( LIGHT0_DIRECTION.y > 0.0 )
_sunset_amount = clamp( cos( LIGHT0_DIRECTION.y * PI ), 0.0, 1.0 );
vec3 _sun_color = mix( sun_color, sun_sunset_color, _sunset_amount );
// Hiding the sun behind the moon
_sun_amount = clamp( _sun_amount * ( 1.0 - _moon_amount ), 0.0, 1.0 );
// Hiding the sun behind the horizon
_sun_amount *= 1.0 - _horizon_amount;
// Leveling the "glow" in color
if( _sun_color.r > 1.0 || _sun_color.g > 1.0 || _sun_color.b > 1.0 )
_sun_color *= _sun_amount;
COLOR = mix( COLOR, _sun_color, _sun_amount );
}
}
//////////////////// STARS /////////////////////////////////////////////////////////////////
vec2 _sky_uv = EYEDIR.xz / sqrt( EYEDIR.y );
if( EYEDIR.y > -0.01 && LIGHT0_DIRECTION.y < 0.0 )
{
// Stars UV rotation
float _stars_speed_cos = cos( stars_speed * time * 0.005 );
float _stars_speed_sin = sin( stars_speed * time * 0.005 );
vec2 _stars_uv = vec2(
_sky_uv.x * _stars_speed_cos - _sky_uv.y * _stars_speed_sin,
_sky_uv.x * _stars_speed_sin + _sky_uv.y * _stars_speed_cos
);
// Stars texture
vec3 _stars_color = texture( stars_texture, _stars_uv ).rgb * -LIGHT0_DIRECTION.y;
// Hiding stars behind the moon
_stars_color *= 1.0 - _moon_amount;
COLOR += _stars_color;
}
//////////////////// CLOUDS ////////////////////////////////////////////////////////////////
if( EYEDIR.y > 0.0 )
{
// Clouds UV movement direction
float _clouds_speed = time * clouds_speed * 0.01;
float _sin_x = sin( clouds_direction * PI * 2.0 );
float _cos_y = cos( clouds_direction * PI * 2.0 );
// I using 3 levels of clouds. Top is the lightes and botom the darkest.
// The speed of movement (and direction a little) is different for the illusion of the changing shape of the clouds.
vec2 _clouds_movement = vec2( _sin_x, _cos_y ) * _clouds_speed;
// float _noise_top = texture( clouds_top_texture, ( _sky_uv + _clouds_movement ) * clouds_scale ).r;
float _noise_top = gen_fractal_ping_pong( ( _sky_uv + _clouds_movement ) * clouds_scale, 0, 0.5 );
_clouds_movement = vec2( _sin_x * 0.97, _cos_y * 1.07 ) * _clouds_speed * 0.89;
// float _noise_middle = texture( clouds_middle_texture, ( _sky_uv + _clouds_movement ) * clouds_scale ).r;
float _noise_middle = gen_fractal_ping_pong( ( _sky_uv + _clouds_movement ) * clouds_scale, 1, 0.75 );
_clouds_movement = vec2( _sin_x * 1.01, _cos_y * 0.89 ) * _clouds_speed * 0.79;
// float _noise_bottom = texture( clouds_bottom_texture, ( _sky_uv + _clouds_movement ) * clouds_scale ).r;
float _noise_bottom = gen_fractal_ping_pong( ( _sky_uv + _clouds_movement ) * clouds_scale, 2, 1.0 );
// Smoothstep with the addition of a noise value from a lower level gives a nice, deep result
_noise_bottom = smoothstep( clouds_cutoff, clouds_cutoff + clouds_fuzziness, _noise_bottom );
_noise_middle = smoothstep( clouds_cutoff, clouds_cutoff + clouds_fuzziness, _noise_middle + _noise_bottom * 0.2 ) * 1.1;
_noise_top = smoothstep( clouds_cutoff, clouds_cutoff + clouds_fuzziness, _noise_top + _noise_middle * 0.4 ) * 1.2;
float _clouds_amount = clamp( _noise_top + _noise_middle + _noise_bottom, 0.0, 1.0 );
// Fading clouds near the horizon
_clouds_amount *= clamp( abs( EYEDIR.y ) / clouds_blur, 0.0, 1.0 );
vec3 _clouds_color = mix( vec3( 0.0 ), clouds_top_color, _noise_top );
_clouds_color = mix( _clouds_color, clouds_middle_color, _noise_middle );
_clouds_color = mix( _clouds_color, clouds_bottom_color, _noise_bottom );
// The edge color gives a nice smooth edge, you can try turning this off if you need sharper edges
_clouds_color = mix( clouds_edge_color, _clouds_color, _noise_top );
// The sun passing through the clouds effect
_clouds_color = mix( _clouds_color, clamp( sun_color, 0.0, 1.0 ), pow( 1.0 - clamp( _sun_distance, 0.0, 1.0 ), 5 ));
// Color combined with sunset condition
_clouds_color = mix( _clouds_color, sunset_bottom_color, _sunset_amount * 0.75 );
// Color depending on the "progress" of the night.
_clouds_color = mix( _clouds_color, _sky_color, clamp( _night_amount, 0.0, 0.98 ));
_clouds_color = mix( _clouds_color, vec3( 0.0 ), clouds_weight * 0.9 );
COLOR = mix( COLOR, _clouds_color, _clouds_amount );
}
}

View File

@@ -0,0 +1 @@
uid://bbn3f2r51dy27

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=121 format=4 uid="uid://ceo7ph483io44"]
[gd_scene load_steps=132 format=4 uid="uid://ceo7ph483io44"]
[ext_resource type="Script" uid="uid://cvj30id0i8ska" path="res://src/map/dungeon/code/BossRoomB.cs" id="1_bxvob"]
[ext_resource type="Texture2D" uid="uid://dovqerwxfvkga" path="res://src/map/dungeon/models/Set B/34. Boss Floor B/34_A2_BOSS FLOOR B_VER_COLUMN_WHITE.png" id="2_egkxs"]
@@ -26,6 +26,10 @@
[ext_resource type="Texture2D" uid="uid://dmqdpmcr3wdym" path="res://src/map/dungeon/models/Set B/34. Boss Floor B/34_A2_BOSS FLOOR B_VER_Painting-for-Tempple-merged.png" id="23_rke2f"]
[ext_resource type="Texture2D" uid="uid://20wawph7jcn4" path="res://src/map/dungeon/models/Set B/34. Boss Floor B/34_A2_BOSS FLOOR B_VER_RUBBLE_1.png" id="24_k805n"]
[ext_resource type="PackedScene" uid="uid://6kck5vborfyk" path="res://src/enemy/enemy_types/16. demon wall/DemonWall.tscn" id="25_k2q0o"]
[ext_resource type="Shader" uid="uid://crbilces53hat" path="res://src/map/map shaders/B2 Night Sky World Environment.gdshader" id="27_yu47a"]
[ext_resource type="Texture2D" uid="uid://bk2irsqn0sbex" path="res://src/map/map shaders/B2 Night Sky Star Textures.png" id="28_nlpir"]
[ext_resource type="Shader" uid="uid://kqp7mww6drrx" path="res://src/map/map shaders/B2 Cloud Roll Middle.gdshader" id="29_ykaaj"]
[ext_resource type="Shader" uid="uid://c1aea2co8saff" path="res://src/map/map shaders/B2 Cloud Roll Top.gdshader" id="30_xwamj"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4oyst"]
resource_name = "COLUMN WHITE"
@@ -1303,6 +1307,7 @@ resource_name = "Material.008"
transparency = 2
alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0
cull_mode = 2
albedo_texture = ExtResource("22_ddrwt")
[sub_resource type="ArrayMesh" id="ArrayMesh_7f5nk"]
@@ -1574,6 +1579,68 @@ size = Vector3(1.9823, 12.776, 1.97168)
[sub_resource type="BoxShape3D" id="BoxShape3D_bxvob"]
size = Vector3(31.5159, 15.6586, 11.8418)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_x4buj"]
shader = ExtResource("27_yu47a")
shader_parameter/day_top_color = Color(0, 0, 0, 1)
shader_parameter/day_bottom_color = Color(0, 0, 0, 1)
shader_parameter/sunset_top_color = Color(0, 0, 0, 1)
shader_parameter/sunset_bottom_color = Color(0, 0, 0, 1)
shader_parameter/night_top_color = Color(0.0464372, 0.0521147, 0.06448, 1)
shader_parameter/night_bottom_color = Color(0, 0, 0, 1)
shader_parameter/horizon_color = Color(0.130304, 0.244302, 0.34566, 1)
shader_parameter/horizon_blur = 0.53
shader_parameter/sun_color = Color(10, 8, 1, 1)
shader_parameter/sun_sunset_color = Color(10, 0, 0, 1)
shader_parameter/sun_size = 0.01
shader_parameter/sun_blur = 10.0
shader_parameter/moon_color = Color(1, 0.200968, 0.243243, 1)
shader_parameter/moon_size = 0.034
shader_parameter/moon_blur = 0.184
shader_parameter/clouds_edge_color = Color(0.8, 0.8, 0.98, 1)
shader_parameter/clouds_top_color = Color(1, 1, 1, 1)
shader_parameter/clouds_middle_color = Color(0.92, 0.92, 0.98, 1)
shader_parameter/clouds_bottom_color = Color(0.83, 0.83, 0.94, 1)
shader_parameter/clouds_speed = 2.0
shader_parameter/clouds_direction = 0.2
shader_parameter/clouds_scale = 1.0
shader_parameter/clouds_cutoff = 0.3
shader_parameter/clouds_fuzziness = 0.5
shader_parameter/clouds_weight = 1.0
shader_parameter/clouds_blur = 1.0
shader_parameter/stars_texture = ExtResource("28_nlpir")
shader_parameter/stars_speed = 0.02
shader_parameter/overwritten_time = 0.0
[sub_resource type="Sky" id="Sky_0n2r5"]
sky_material = SubResource("ShaderMaterial_x4buj")
[sub_resource type="Environment" id="Environment_qev6n"]
background_mode = 2
sky = SubResource("Sky_0n2r5")
ambient_light_source = 1
reflected_light_source = 1
glow_enabled = true
glow_intensity = 0.68
glow_bloom = 0.45
glow_blend_mode = 0
fog_light_color = Color(0.631028, 0.374553, 0.482473, 1)
[sub_resource type="PlaneMesh" id="PlaneMesh_xtuw8"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_jvu42"]
render_priority = 0
shader = ExtResource("29_ykaaj")
shader_parameter/cloud_color = Vector4(1.37, 3.515, 9.085, 0.01)
shader_parameter/cloud_opacity = 0.263
[sub_resource type="PlaneMesh" id="PlaneMesh_s2vdx"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_3plo0"]
render_priority = 0
shader = ExtResource("30_xwamj")
shader_parameter/cloud_color = Vector4(1.32, 3.3, 7.875, 0.205)
shader_parameter/cloud_opacity = 0.36
[node name="Boss Floor B" type="Node3D"]
script = ExtResource("1_bxvob")
@@ -1665,7 +1732,7 @@ mesh = SubResource("ArrayMesh_gcjr4")
skeleton = NodePath("")
[node name="ROOM" type="MeshInstance3D" parent="Model/34_A2_BOSS FLOOR B_VER_1"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.674493, 35.4721, -46.1588)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.674493, 35.3853, -46.1588)
mesh = SubResource("ArrayMesh_mvrh3")
skeleton = NodePath("")
@@ -1892,3 +1959,49 @@ shape = SubResource("BoxShape3D_bxvob")
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 21.2936, 55.334)
_maximumWallMoveAmount = 24.0
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_qev6n")
[node name="MOON" type="DirectionalLight3D" parent="WorldEnvironment"]
transform = Transform3D(0.146712, 0.350899, -0.924849, -0.418597, -0.8251, -0.379456, -0.896243, 0.44281, 0.0258334, 0, 0, 0)
light_color = Color(0.0328802, 0.23377, 0.359902, 1)
light_energy = 0.241
light_indirect_energy = 2.203
shadow_enabled = true
shadow_blur = 4.308
[node name="SUN" type="DirectionalLight3D" parent="WorldEnvironment"]
transform = Transform3D(-0.509203, -0.000255823, 0.860646, 0.437018, 0.86141, 0.258819, -0.741436, 0.50791, -0.438521, 0, 0, 0)
light_color = Color(0.11449, 0.455278, 0.552762, 1)
light_energy = 0.02
light_angular_distance = 0.65
shadow_enabled = true
shadow_bias = 0.072
shadow_blur = 2.295
[node name="Clouds Lower" type="MeshInstance3D" parent="."]
transform = Transform3D(900, 0, 0, 0, 900, 0, 0, 0, 900, 890.748, -126.602, 0)
mesh = SubResource("PlaneMesh_xtuw8")
surface_material_override/0 = SubResource("ShaderMaterial_jvu42")
[node name="Clouds Upper" type="MeshInstance3D" parent="."]
transform = Transform3D(3000, 0, 0, 0, 3000, 0, 0, 0, 3000, 2586.39, -86.6694, 0.852608)
mesh = SubResource("PlaneMesh_s2vdx")
surface_material_override/0 = SubResource("ShaderMaterial_3plo0")
[node name="OmniLight3D" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.57804, 31.8639, -46.7457)
light_color = Color(1, 0.425788, 0.357085, 1)
light_energy = 4.108
light_indirect_energy = 2.727
omni_range = 10.252
omni_attenuation = 1.432
[node name="OmniLight3D2" type="OmniLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.18858, 31.8639, -46.7457)
light_color = Color(1, 0.425788, 0.357085, 1)
light_energy = 4.108
light_indirect_energy = 2.727
omni_range = 10.252
omni_attenuation = 1.432

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,244 @@
shader_type spatial;
render_mode world_vertex_coords, cull_disabled;
uniform sampler2D screen : hint_screen_texture, filter_linear_mipmap_anisotropic, repeat_disable;
group_uniforms colours;
uniform vec3 surfacecolour : source_color;
uniform vec3 volumecolour : source_color;
group_uniforms material;
uniform float AirIOR = 1.0;
uniform float IOR = 1.33;
group_uniforms textures;
uniform vec2 sampler1speed = vec2(0.02, 0.0);
uniform vec2 sampler2speed = vec2(0.0, 0.02);
uniform float samplermix : hint_range(0.0, 1.0, 0.1) = 0.5;
uniform vec2 samplerscale = vec2(0.1);
uniform sampler2D normal1tex : filter_linear_mipmap_anisotropic, hint_normal;
uniform sampler2D normal2tex : filter_linear_mipmap_anisotropic, hint_normal;
uniform float normalstrength : hint_range(0.0, 5.0, 0.01) = 1.0;
uniform sampler2D height1tex : filter_linear_mipmap_anisotropic;
uniform sampler2D height2tex : filter_linear_mipmap_anisotropic;
uniform float heightstrength : hint_range(0.0, 5.0, 0.01) = 0.12;
uniform sampler2D edge1tex : filter_linear_mipmap_anisotropic;
uniform sampler2D edge2tex : filter_linear_mipmap_anisotropic;
varying vec2 position;
varying vec3 wposition;
group_uniforms refraction;
uniform float refrationamount : hint_range(0.0, 1.0, 0.01);
uniform bool fog_underwater;
group_uniforms edge;
uniform float edge_size : hint_range(0.01, 0.5, 0.01) = 0.1;
uniform bool foam_or_fade = false;
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap, repeat_disable;
group_uniforms screen_space_reflection;
uniform float far_clip = 50.0;
uniform int steps : hint_range(64, 1024, 16) = 512;
uniform float ssr_screen_fade : hint_range(0.01, 0.5, 0.01) = 0.05;
float schlickfresnel(float ior1, float ior2, vec3 view, vec3 norm) {
float incident = dot(view, norm);
float reflectance = pow(((ior2 - ior1)/(ior2 + ior1)), 2.0);
float fresnelincident = reflectance + (1.0 - reflectance) * pow(1.0 - cos(incident), 5.0);
return(fresnelincident / incident);
}
void vertex() {
position = VERTEX.xz;
UV = VERTEX.xz * samplerscale + (sampler1speed * TIME);
UV2 = VERTEX.xz * samplerscale + (sampler2speed * TIME);
float height = mix(texture(height1tex, UV),texture(height2tex, UV2),samplermix).x;
VERTEX.y += (height - 0.5) * heightstrength;
wposition = VERTEX;
// Called for every vertex the material is visible on.
}
float snells_window(vec3 normal, vec3 view, float ior) {
float cos_theta = dot(normal, view);
return step(sqrt(1.0 - cos_theta * cos_theta) * ior, 1.0);
}
float linear_depth(float nonlinear_depth, mat4 inv_projection_matrix) {
return 1.0 / (nonlinear_depth * inv_projection_matrix[2].w + inv_projection_matrix[3].w);
}
float nonlinear_depth(float linear_depth, mat4 inv_projection_matrix) {
return (1.0 / linear_depth - inv_projection_matrix[3].w) / inv_projection_matrix[2].w;
}
vec2 view2uv(vec3 position_view_space, mat4 proj_m)
{
vec4 position_clip_space = proj_m * vec4(position_view_space.xyz, 1.0);
vec2 position_ndc = position_clip_space.xy / position_clip_space.w;
return position_ndc.xy * 0.5 + 0.5;
}
float remap(float x, float min1, float max1, float min2, float max2) {
return ((x - min1) / (max1 - min1) + min2) * (max2 - min2);
}
float remap1(float x, float min1, float max1) {
return (x - min1) / (max1 - min1);
}
float edge_fade(vec2 uv, float size) {
float x1 = clamp(remap1(uv.x, 0.0, size), 0.0, 1.0);
float x2 = clamp(remap1(uv.x, 1.0, 1.0 - size), 0.0, 1.0);
float y1 = clamp(remap1(uv.y, 0.0, size), 0.0, 1.0);
float y2 = clamp(remap1(uv.y, 1.0, 1.0 - size), 0.0, 1.0);
return x1*x2*y1*y2;
}
void fragment() {
vec3 onorm = NORMAL;
vec2 normmap = mix(texture(normal1tex, UV),texture(normal2tex, UV2),samplermix).xy;
NORMAL += TANGENT * (normmap.x - 0.5) * normalstrength;
NORMAL += BINORMAL * (normmap.y - 0.5) * normalstrength;
vec3 wnorm = (vec4(NORMAL, 0.0) * VIEW_MATRIX).xyz;
vec3 wview = (vec4(VIEW, 0.0) * VIEW_MATRIX).xyz;
if (FRONT_FACING) {
ROUGHNESS = 0.0;
METALLIC = 1.0;
SPECULAR = 0.0;
float fres = schlickfresnel(AirIOR, IOR, VIEW, NORMAL);
ALBEDO = surfacecolour * fres;
// REFRACTION
float lineardepth = linear_depth(texture(DEPTH_TEXTURE, SCREEN_UV).r, INV_PROJECTION_MATRIX);
float selfdepth = -VERTEX.z;
float depth_diff = lineardepth - selfdepth;
vec3 tanx = BINORMAL * (normmap.x - 0.5) * normalstrength;
vec3 tany = TANGENT * (normmap.y - 0.5) * normalstrength;
vec2 refracted_uv = SCREEN_UV + (tanx + tany).xy * refrationamount * depth_diff / lineardepth;
float newdepth = linear_depth(texture(DEPTH_TEXTURE, refracted_uv).r, INV_PROJECTION_MATRIX);
//float selfdepth = 1.0/(1.0 + 2.0 * distance(wposition, CAMERA_POSITION_WORLD));
vec3 newvolcolour = mix(volumecolour, vec3(1.0), clamp(1.0 / (depth_diff * 1.0), 0.0, 1.0));
EMISSION = newvolcolour * texture(screen, refracted_uv).rgb;
if (newdepth < selfdepth) {
EMISSION = newvolcolour * texture(screen, SCREEN_UV).rgb;
}
// SSR
vec3 reflected = -reflect(VIEW, NORMAL);
vec3 pos = VERTEX;
int curstep = 0;
bool finished = false;
vec2 uv;
float currentdepth;
while (curstep < steps) {
float step_scale = float(curstep + 1) / float(steps);
float step_dist = step_scale * step_scale * far_clip;
pos += reflected * step_dist;
curstep += 1;
currentdepth = -pos.z;
uv = view2uv(pos, PROJECTION_MATRIX);
if (!(uv.x < 1.0 && uv.y < 1.0 && uv.x > 0.0 && uv.y > 0.0)) {
break;
}
float testdepth = linear_depth(texture(DEPTH_TEXTURE, uv).r, INV_PROJECTION_MATRIX);
if (testdepth < currentdepth) {
finished = true;
break;
}
}
if (finished && currentdepth < far_clip * 0.99) {
ALBEDO *= 1.0 - edge_fade(uv, ssr_screen_fade);
METALLIC *= 1.0 - edge_fade(uv, ssr_screen_fade);
EMISSION += texture(screen, uv).xyz * schlickfresnel(1.0, 1.33, VIEW, NORMAL) * edge_fade(uv, ssr_screen_fade);
}
// EDGE EFFECT
float distfromedge = depth_diff * dot(normalize(NORMAL), normalize(-VERTEX)) / VIEW.z;
if (distfromedge < edge_size) {
distfromedge /= edge_size;
if (foam_or_fade) {
ALPHA = distfromedge;
} else {
float edgetex = mix(texture(edge1tex, UV).r, texture(edge2tex, UV2).r, samplermix);
if (edgetex > distfromedge) {
ALBEDO = vec3(1.0);
ROUGHNESS = 1.0;
METALLIC = 1.0;
EMISSION = vec3(0.0);
NORMAL = onorm;
}
}
}
} else {
// SNELLS WINDOW
float window = snells_window(wnorm, wview, IOR);
if (window > 0.5) {
ROUGHNESS = 1.0;
METALLIC = 1.0;
ALBEDO = vec3(0.0);
SPECULAR = 0.0;
float linear_depth = 1.0 / (texture(DEPTH_TEXTURE, SCREEN_UV).r * INV_PROJECTION_MATRIX[2].w + INV_PROJECTION_MATRIX[3].w);
float selfdepth = 1.0 / (FRAGCOORD.z * INV_PROJECTION_MATRIX[2].w + INV_PROJECTION_MATRIX[3].w);
float depth_diff = linear_depth - selfdepth;
vec3 tanx = BINORMAL * (normmap.x - 0.5) * normalstrength;
vec3 tany = TANGENT * (normmap.y - 0.5) * normalstrength;
float newdepth = 1.0 / (texture(DEPTH_TEXTURE, SCREEN_UV + (tanx + tany).xy * refrationamount).r * INV_PROJECTION_MATRIX[2].w + INV_PROJECTION_MATRIX[3].w);
//float selfdepth = 1.0/(1.0 + 2.0 * distance(wposition, CAMERA_POSITION_WORLD));
vec3 newvolcolour = mix(volumecolour, vec3(1.0), clamp(1.0 / (selfdepth * 1.0), 0.0, 1.0));
if (!fog_underwater) {
newvolcolour = vec3(1.0);
}
EMISSION = newvolcolour * texture(screen, SCREEN_UV + (tanx + tany).xy * refrationamount).rgb;
} else {
ALBEDO = surfacecolour;
ROUGHNESS = 0.0;
METALLIC = 1.0;
// SSR
vec3 reflected = -reflect(VIEW, NORMAL);
vec3 pos = VERTEX;
int curstep = 0;
bool finished = false;
vec2 uv;
float currentdepth;
while (curstep < steps) {
float step_scale = float(curstep + 1) / float(steps);
float step_dist = step_scale * step_scale * far_clip;
pos += reflected * step_dist;
curstep += 1;
currentdepth = -pos.z;
uv = view2uv(pos, PROJECTION_MATRIX);
if (!(uv.x < 1.0 && uv.y < 1.0 && uv.x > 0.0 && uv.y > 0.0)) {
break;
}
float testdepth = linear_depth(texture(DEPTH_TEXTURE, uv).r, INV_PROJECTION_MATRIX);
if (testdepth < currentdepth) {
finished = true;
break;
}
}
if (finished && currentdepth < far_clip * 0.99) {
ALBEDO *= 1.0 - edge_fade(uv, ssr_screen_fade);
METALLIC *= 1.0 - edge_fade(uv, ssr_screen_fade);
EMISSION += texture(screen, uv).xyz * schlickfresnel(1.0, 1.33, VIEW, NORMAL) * edge_fade(uv, ssr_screen_fade);
}
}
}
}

View File

@@ -0,0 +1 @@
uid://beg8sp6kw66w8