commit 3788598d69f8b981671b5449184cc255c787c407 Author: Mark Hoekveen Date: Sun Aug 1 01:30:06 2021 +0200 initial commit diff --git a/Spatial.tscn b/Spatial.tscn new file mode 100644 index 0000000..25510d1 --- /dev/null +++ b/Spatial.tscn @@ -0,0 +1,100 @@ +[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 new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/default_env.tres @@ -0,0 +1,7 @@ +[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 new file mode 100644 index 0000000..c98fbb6 Binary files /dev/null and b/icon.png differ diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..6483d03 --- /dev/null +++ b/project.godot @@ -0,0 +1,22 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +[application] + +config/name="Gaz" +config/icon="res://icon.png" + +[physics] + +common/enable_pause_aware_picking=true + +[rendering] + +environment/default_environment="res://default_env.tres" diff --git a/sky.jpg b/sky.jpg new file mode 100644 index 0000000..104db03 Binary files /dev/null and b/sky.jpg differ