diff --git a/maps/basic_setup.tscn b/maps/basic_setup.tscn index 1bdd5b8..bbc1fd5 100644 --- a/maps/basic_setup.tscn +++ b/maps/basic_setup.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://b8p2h0rmwy7qn"] +[gd_scene load_steps=24 format=3 uid="uid://b8p2h0rmwy7qn"] [ext_resource type="Material" uid="uid://dpegsmygxcfmv" path="res://maps/materials/basic_ground.material" id="1_lodye"] [ext_resource type="Shader" path="res://maps/shaders/khanat_sky.gdshader" id="1_mheqi"] @@ -6,6 +6,7 @@ [ext_resource type="PackedScene" uid="uid://cveshwnu272vf" path="res://maps/objects/ramp-complex.tscn" id="2_4eueh"] [ext_resource type="Texture2D" uid="uid://y0ka7tysfp6b" path="res://maps/textures/zabr_tex_001.png" id="3_bgghj"] [ext_resource type="PackedScene" uid="uid://omess6wwwwcq" path="res://maps/objects/ramp-moving.tscn" id="3_bvbgo"] +[ext_resource type="Texture2D" uid="uid://dlxp52r0wnwlq" path="res://maps/textures/stigi_tex_001.png" id="3_jqgsm"] [ext_resource type="PackedScene" uid="uid://dvsl8x3lb1h4e" path="res://maps/objects/moutain.tscn" id="3_rbp35"] [ext_resource type="PackedScene" path="res://maps/objects/cave.tscn" id="4_pc85h"] [ext_resource type="PackedScene" uid="uid://b61edh0bre65c" path="res://maps/objects/ramp.tscn" id="5_dfm8h"] @@ -34,8 +35,11 @@ shader_param/samayun_arc = 50.0 shader_param/samayun_position = Vector3(2.038, 0.584, -0.995) shader_param/zabr_arc = 15.0 shader_param/zabr_position = Vector3(0.6, 0.03, -0.342) +shader_param/stigi_arc = null +shader_param/stigi_position = Vector3(0.688, 0.03, -0.342) shader_param/samayun = ExtResource( "1_thm7k" ) shader_param/zabr = ExtResource( "3_bgghj" ) +shader_param/stigi = ExtResource( "3_jqgsm" ) [sub_resource type="Sky" id="Sky_fa16p"] sky_material = SubResource( "ShaderMaterial_s2q0l" ) diff --git a/maps/shaders/khanat_sky.gdshader b/maps/shaders/khanat_sky.gdshader index 1bb102b..f81742d 100644 --- a/maps/shaders/khanat_sky.gdshader +++ b/maps/shaders/khanat_sky.gdshader @@ -19,13 +19,17 @@ uniform float dither_strength : hint_range(0, 10) = 1.0; uniform sampler2D night_sky : hint_black_albedo; uniform sampler2D samayun : hint_albedo; -uniform float samayun_arc = 25 ; +uniform float samayun_arc = 45 ; uniform vec3 samayun_position = vec3( 0.0, 0.5, 0.0 ); uniform sampler2D zabr : hint_albedo; -uniform float zabr_arc = 12 ; +uniform float zabr_arc = 15 ; uniform vec3 zabr_position = vec3( 0.0, 0.7, 0.0 ); +uniform sampler2D stigi : hint_albedo; +uniform float stigi_arc = 8 ; +uniform vec3 stigi_position = vec3( 0.0, 0.8, 0.0 ); + const vec3 UP = vec3( 0.0, 1.0, 0.0 ); // Sun constants @@ -104,6 +108,7 @@ void sky() { // Calculate respective scales of celestial objects float samayun_scale = radians(samayun_arc) ; float zabr_scale = radians(zabr_arc) ; + float stigi_scale = radians(stigi_arc) ; // Adding Samayun if (length(EYEDIR - normalize(samayun_position)) < samayun_scale / 2.0) { // we are in the area of the sky where samayun is placed @@ -135,4 +140,19 @@ void sky() { COLOR += texture(zabr, vec2(z_x,z_y) / zabr_scale + vec2(0.5)).rgb * texture(zabr, vec2(z_x,z_y) / zabr_scale + vec2(0.5)).a; } } + // Adding stigi + if (length(EYEDIR - normalize(stigi_position)) < stigi_scale / 2.0) { // we are in the area of the sky where stigi is placed + //We define a local plane tangent to the skydome at stigi_position + //We work with everything normalized + vec3 s_n1 = normalize(cross(stigi_position,vec3(0.0,1.0,0.0))) ; + vec3 s_n2 = normalize(cross(stigi_position,s_n1)) ; + //We project EYEDIR on this plane with an approximate correction for projection + float s_x = dot(EYEDIR,s_n1) * 0.89 ; + float s_y = dot(EYEDIR,s_n2) * 0.89 ; + // If samayun is nearer at this place, do nothing + if (length(EYEDIR - normalize(samayun_position)) < samayun_scale / 2.0 && length(samayun_position) < length(stigi_position)){ + } else { // Add stigi to the sky + COLOR += texture(stigi, vec2(s_x,s_y) / stigi_scale + vec2(0.5)).rgb * texture(stigi, vec2(s_x,s_y) / stigi_scale + vec2(0.5)).a; + } + } } diff --git a/maps/textures/stigi_tex_001.png b/maps/textures/stigi_tex_001.png new file mode 100644 index 0000000..02ccdb1 Binary files /dev/null and b/maps/textures/stigi_tex_001.png differ diff --git a/maps/textures/stigi_tex_001.png.import b/maps/textures/stigi_tex_001.png.import new file mode 100644 index 0000000..b7312f7 --- /dev/null +++ b/maps/textures/stigi_tex_001.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dlxp52r0wnwlq" +path.s3tc="res://.godot/imported/stigi_tex_001.png-422a9b36925acddfd148694fe140318a.s3tc.ctex" +path.etc2="res://.godot/imported/stigi_tex_001.png-422a9b36925acddfd148694fe140318a.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://maps/textures/stigi_tex_001.png" +dest_files=["res://.godot/imported/stigi_tex_001.png-422a9b36925acddfd148694fe140318a.s3tc.ctex", "res://.godot/imported/stigi_tex_001.png-422a9b36925acddfd148694fe140318a.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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/size_limit=0 +detect_3d/compress_to=0