diff --git a/Planeet.tres b/Planeet.tres new file mode 100644 index 0000000..26465be --- /dev/null +++ b/Planeet.tres @@ -0,0 +1,65 @@ +[gd_resource type="ShaderMaterial" load_steps=2 format=2] + +[sub_resource type="Shader" id=1] +resource_local_to_scene = true +code = "shader_type spatial; +varying vec3 world_pos; +uniform vec4 base_color : hint_color; +uniform vec4 cloud_color : hint_color; + +//Van https://github.com/yiwenl/glsl-fbm/blob/master/3d.glsl + +float mod289f(float x){return x - floor(x * (1.0 / 289.0)) * 289.0;} +vec4 mod289v4(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;} +vec4 perm(vec4 x){return mod289v4(((x * 34.0) + 1.0) * x);} + +float noise1(vec3 p){ + vec3 a = floor(p); + vec3 d = p - a; + d = d * d * (3.0 - 2.0 * d); + + vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0); + vec4 k1 = perm(b.xyxy); + vec4 k2 = perm(k1.xyxy + b.zzww); + + vec4 c = k2 + a.zzzz; + vec4 k3 = perm(c); + vec4 k4 = perm(c + 1.0); + + vec4 o1 = fract(k3 * (1.0 / 41.0)); + vec4 o2 = fract(k4 * (1.0 / 41.0)); + + vec4 o3 = o2 * d.z + o1 * (1.0 - d.z); + vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x); + + return o4.y * d.y + o4.x * (1.0 - d.y); +} + + +float fbm1(vec3 x, float t) { + float v = 0.0; + float a = 0.5; + vec3 shift = t*vec3(0.1); + for (int i = 0; i < 5; ++i) { + v += a * noise1(x*3.0); + x = x * 2.0 + shift; + a *= 0.5; + } + return v; +} + + +void vertex() { + world_pos = VERTEX; +} + +void fragment() { + ALBEDO = mix(base_color.rgb, cloud_color.rgb, cloud_color.rgb*fbm1(world_pos, TIME)); + ALBEDO = base_color.rgb + cloud_color.rgb*fbm1(world_pos, TIME); +} +" + +[resource] +shader = SubResource( 1 ) +shader_param/base_color = Color( 0.0745098, 0.215686, 0.419608, 1 ) +shader_param/cloud_color = Color( 0.580392, 0.580392, 0.580392, 1 ) diff --git a/Planeet.tscn b/Planeet.tscn new file mode 100644 index 0000000..dfcd620 --- /dev/null +++ b/Planeet.tscn @@ -0,0 +1,89 @@ +[gd_scene load_steps=9 format=2] + +[ext_resource path="res://sky.jpg" type="Texture" id=1] +[ext_resource path="res://Planeet.tres" type="Material" id=2] + +[sub_resource type="SphereMesh" id=1] +radius = 2.0 +height = 4.0 + +[sub_resource type="PanoramaSky" id=2] +panorama = ExtResource( 1 ) + +[sub_resource type="Environment" id=3] +background_mode = 2 +background_sky = SubResource( 2 ) +background_energy = 0.16 +ambient_light_color = Color( 0.262745, 0.262745, 0.262745, 1 ) +ambient_light_energy = 7.54 +auto_exposure_scale = 5.28 +auto_exposure_max_luma = 3.73 +auto_exposure_speed = 48.95 +ss_reflections_enabled = true +dof_blur_far_distance = 29.65 +dof_blur_far_transition = 0.08 +glow_enabled = true +glow_levels/1 = true +glow_levels/3 = false +glow_levels/6 = true +glow_bloom = 0.01 +glow_blend_mode = 0 +glow_bicubic_upscale = true +adjustment_enabled = true +adjustment_saturation = 1.05 + +[sub_resource type="Shader" id=4] +code = "shader_type spatial; +uniform vec4 color : hint_color; +uniform float base_strength : hint_range(1.0, 7.0, 0.1); +varying float real_strength; + +float wave(float t) { + float one = 0.06*cos(t); + float two = 0.03*cos(2.0*t+1.0); + return one+two; +} + +void vertex() { + real_strength = base_strength * wave(TIME); + VERTEX = VERTEX*base_strength; + VERTEX += VERTEX*0.5*wave(TIME); +} + +void fragment() { + EMISSION = color.rgb*base_strength; + EMISSION += EMISSION*wave(TIME)*2.0; + +}" + +[sub_resource type="ShaderMaterial" id=5] +shader = SubResource( 4 ) +shader_param/color = Color( 1, 0.996078, 0.866667, 1 ) +shader_param/base_strength = 4.0 + +[sub_resource type="SphereMesh" id=6] +material = SubResource( 5 ) + +[node name="Planeet" type="Spatial"] + +[node name="Camera" type="Camera" parent="."] +transform = Transform( 0.243869, 0, 0.969808, 0, 1, 0, -0.969808, 0, 0.243869, 6.94895, 0, 7.70599 ) +fov = 66.0 + +[node name="Planeet" type="MeshInstance" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00204706, 4.76837e-07, 0.00108433 ) +mesh = SubResource( 1 ) +material/0 = ExtResource( 2 ) + +[node name="Galaxy" type="WorldEnvironment" parent="."] +environment = SubResource( 3 ) + +[node name="Zon" type="MeshInstance" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -72.2436, 4.93426, 30.6297 ) +mesh = SubResource( 6 ) +material/0 = null + +[node name="Zonlamp" type="OmniLight" parent="Zon"] +light_color = Color( 1, 1, 0.956863, 1 ) +omni_range = 265.8 +omni_attenuation = 1.51572 diff --git a/Spatial.tscn b/Spatial.tscn deleted file mode 100644 index 25510d1..0000000 --- a/Spatial.tscn +++ /dev/null @@ -1,100 +0,0 @@ -[gd_scene load_steps=7 format=2] - -[ext_resource path="res://sky.jpg" type="Texture" id=1] - -[sub_resource type="SphereMesh" id=1] -radius = 2.0 -height = 4.0 - -[sub_resource type="Shader" id=5] -code = "shader_type spatial; -varying vec3 world_pos; -uniform vec4 base_color : hint_color; -uniform vec4 cloud_color : hint_color; - -//Van https://github.com/yiwenl/glsl-fbm/blob/master/3d.glsl - -float mod289f(float x){return x - floor(x * (1.0 / 289.0)) * 289.0;} -vec4 mod289v4(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;} -vec4 perm(vec4 x){return mod289v4(((x * 34.0) + 1.0) * x);} - -float noise1(vec3 p){ - vec3 a = floor(p); - vec3 d = p - a; - d = d * d * (3.0 - 2.0 * d); - - vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0); - vec4 k1 = perm(b.xyxy); - vec4 k2 = perm(k1.xyxy + b.zzww); - - vec4 c = k2 + a.zzzz; - vec4 k3 = perm(c); - vec4 k4 = perm(c + 1.0); - - vec4 o1 = fract(k3 * (1.0 / 41.0)); - vec4 o2 = fract(k4 * (1.0 / 41.0)); - - vec4 o3 = o2 * d.z + o1 * (1.0 - d.z); - vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x); - - return o4.y * d.y + o4.x * (1.0 - d.y); -} - - -float fbm1(vec3 x, float t) { - float v = 0.0; - float a = 0.5; - vec3 shift = t*vec3(0.1); - for (int i = 0; i < 5; ++i) { - v += a * noise1(x); - x = x * 2.0 + shift; - a *= 0.5; - } - return v; -} - - -void vertex() { - world_pos = VERTEX; -} - -void fragment() { - ALBEDO = smoothstep(base_color.rgb, cloud_color.rgb, cloud_color.rgb*fbm1(world_pos, TIME)); -}" - -[sub_resource type="ShaderMaterial" id=3] -shader = SubResource( 5 ) -shader_param/base_color = Color( 0.0745098, 0.215686, 0.419608, 1 ) -shader_param/cloud_color = Color( 0.580392, 0.580392, 0.580392, 1 ) - -[sub_resource type="PanoramaSky" id=6] -panorama = ExtResource( 1 ) - -[sub_resource type="Environment" id=4] -background_mode = 2 -background_sky = SubResource( 6 ) -background_energy = 0.16 -ambient_light_color = Color( 0.219608, 0.219608, 0.219608, 1 ) -auto_exposure_scale = 5.28 -auto_exposure_max_luma = 3.73 -auto_exposure_speed = 48.95 -ss_reflections_enabled = true - -[node name="Spatial" type="Spatial"] - -[node name="Camera" type="Camera" parent="."] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 7.28376 ) - -[node name="MeshInstance" type="MeshInstance" parent="."] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00204706, 4.76837e-07, 0.00108433 ) -mesh = SubResource( 1 ) -material/0 = SubResource( 3 ) - -[node name="WorldEnvironment" type="WorldEnvironment" parent="."] -environment = SubResource( 4 ) - -[node name="OmniLight" type="OmniLight" parent="."] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4.14577, 4.93426, 5.11091 ) -light_specular = 0.86 -omni_range = 156.6 -omni_attenuation = 2.21914 diff --git a/default_env.tres b/default_env.tres deleted file mode 100644 index 20207a4..0000000 --- a/default_env.tres +++ /dev/null @@ -1,7 +0,0 @@ -[gd_resource type="Environment" load_steps=2 format=2] - -[sub_resource type="ProceduralSky" id=1] - -[resource] -background_mode = 2 -background_sky = SubResource( 1 ) diff --git a/icon.png b/icon.png deleted file mode 100644 index c98fbb6..0000000 Binary files a/icon.png and /dev/null differ diff --git a/project.godot b/project.godot index 6483d03..6ca063e 100644 --- a/project.godot +++ b/project.godot @@ -11,12 +11,8 @@ config_version=4 [application] config/name="Gaz" -config/icon="res://icon.png" +run/main_scene="res://Planeet.tscn" [physics] common/enable_pause_aware_picking=true - -[rendering] - -environment/default_environment="res://default_env.tres"