commit 7514598acc8ec28eafaef744592792b31854f619 Author: yannk Date: Sat Jun 6 21:45:30 2020 +0200 Initial commit diff --git a/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.etc2.stex b/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.etc2.stex new file mode 100644 index 0000000..66e7855 Binary files /dev/null and b/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.etc2.stex differ diff --git a/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.md5 b/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.md5 new file mode 100644 index 0000000..a7ec028 --- /dev/null +++ b/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.md5 @@ -0,0 +1,3 @@ +source_md5="d9af9f79de549eca6d954487ab638c1c" +dest_md5="15ee69c90e911f7ea7f726de40e4394c" + diff --git a/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.s3tc.stex b/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.s3tc.stex new file mode 100644 index 0000000..cbacfdf Binary files /dev/null and b/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.s3tc.stex differ diff --git a/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.stex b/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.stex new file mode 100644 index 0000000..c8b4a94 Binary files /dev/null and b/.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.stex differ diff --git a/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 new file mode 100644 index 0000000..a111eea --- /dev/null +++ b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 @@ -0,0 +1,3 @@ +source_md5="0167658bc4406f0d0fe437e0197c415a" +dest_md5="64b0613b3173e1e1c96dd18b6569e62d" + diff --git a/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex new file mode 100644 index 0000000..002ad14 Binary files /dev/null and b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex differ diff --git a/base_ground.gd b/base_ground.gd new file mode 100644 index 0000000..ff4c543 --- /dev/null +++ b/base_ground.gd @@ -0,0 +1,8 @@ +tool +extends Spatial + +export( Color ) var color = Color( 1.0, 1.0, 1.0, 1.0 ) setget set_shader_albedo + +func set_shader_albedo( value ): + color = value + $textured_ground.get_surface_material( 0 ).set_shader_param("albedo", self.color) diff --git a/base_ground.tscn b/base_ground.tscn new file mode 100644 index 0000000..e1fb41b --- /dev/null +++ b/base_ground.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://base_rainboxing.tres" type="Material" id=1] +[ext_resource path="res://base_ground.gd" type="Script" id=2] + +[sub_resource type="PlaneMesh" id=1] + +[node name="base_ground" type="Spatial"] +script = ExtResource( 2 ) +color = Color( 0.93, 0.4929, 0.4929, 1 ) + +[node name="textured_ground" type="MeshInstance" parent="."] +mesh = SubResource( 1 ) +material/0 = ExtResource( 1 ) +__meta__ = { +"_editor_description_": "" +} diff --git a/base_rainboxing.tres b/base_rainboxing.tres new file mode 100644 index 0000000..f00228f --- /dev/null +++ b/base_rainboxing.tres @@ -0,0 +1,12 @@ +[gd_resource type="ShaderMaterial" load_steps=3 format=2] + +[ext_resource path="res://basic_texture_1024.png" type="Texture" id=1] +[ext_resource path="res://rainboxing.shader" type="Shader" id=2] + +[resource] +resource_local_to_scene = true +shader = ExtResource( 2 ) +shader_param/albedo = Color( 0.93, 0.4929, 0.4929, 1 ) +shader_param/scale = 1.0 +shader_param/uv1_offset = Vector3( 0, 0, 0 ) +shader_param/grid_texture = ExtResource( 1 ) diff --git a/basic_texture_1024.png b/basic_texture_1024.png new file mode 100644 index 0000000..e3755a3 Binary files /dev/null and b/basic_texture_1024.png differ diff --git a/basic_texture_1024.png.import b/basic_texture_1024.png.import new file mode 100644 index 0000000..0d073d4 --- /dev/null +++ b/basic_texture_1024.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="StreamTexture" +path.s3tc="res://.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.s3tc.stex" +path.etc2="res://.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.etc2.stex" +metadata={ +"imported_formats": [ "s3tc", "etc2" ], +"vram_texture": true +} + +[deps] + +source_file="res://basic_texture_1024.png" +dest_files=[ "res://.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.s3tc.stex", "res://.import/basic_texture_1024.png-125fe46c9b5fe8c3494a771c6fb2ed11.etc2.stex" ] + +[params] + +compress/mode=2 +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=1 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 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..2e42096 Binary files /dev/null and b/icon.png differ diff --git a/icon.png.import b/icon.png.import new file mode 100644 index 0000000..96cbf46 --- /dev/null +++ b/icon.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.png" +dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/main.tscn b/main.tscn new file mode 100644 index 0000000..35f5c23 --- /dev/null +++ b/main.tscn @@ -0,0 +1,16 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://base_ground.tscn" type="PackedScene" id=1] + +[node name="Main" type="Spatial"] + +[node name="base_ground" parent="." instance=ExtResource( 1 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, 0 ) +color = Color( 0.556863, 0.929412, 0.494118, 1 ) + +[node name="base_ground2" parent="." instance=ExtResource( 1 )] +color = Color( 0.494118, 0.929412, 0.827451, 1 ) + +[node name="base_ground3" parent="." instance=ExtResource( 1 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, 0 ) +color = Color( 0.835294, 0.494118, 0.929412, 1 ) diff --git a/new_spatialmaterial.tres b/new_spatialmaterial.tres new file mode 100644 index 0000000..9cd5825 --- /dev/null +++ b/new_spatialmaterial.tres @@ -0,0 +1,10 @@ +[gd_resource type="SpatialMaterial" load_steps=2 format=2] + +[ext_resource path="res://basic_texture_1024.png" type="Texture" id=1] + +[resource] +albedo_color = Color( 0.953125, 0.621765, 0.621765, 1 ) +albedo_texture = ExtResource( 1 ) +uv1_scale = Vector3( 3, 2, 4 ) +uv1_offset = Vector3( 1, 2, 3 ) +uv1_triplanar = true diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..4b9bcff --- /dev/null +++ b/project.godot @@ -0,0 +1,24 @@ +; 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 + +_global_script_classes=[ ] +_global_script_class_icons={ + +} + +[application] + +config/name="YannK Sandbox" +run/main_scene="res://main.tscn" +config/icon="res://icon.png" + +[rendering] + +environment/default_environment="res://default_env.tres" diff --git a/rainboxing.shader b/rainboxing.shader new file mode 100644 index 0000000..981226f --- /dev/null +++ b/rainboxing.shader @@ -0,0 +1,31 @@ +shader_type spatial; +render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx; + +uniform sampler2D grid_texture : hint_albedo; +uniform vec4 albedo : hint_color = vec4(1.0); +uniform float scale = float(1.0); +uniform vec3 uv1_offset = vec3(0); + +varying vec3 uv1_power_normal; +varying vec3 uv1_triplanar_pos; + +vec4 triplanar_texture(sampler2D p_sampler,vec3 p_weights,vec3 p_triplanar_pos) { + vec4 samp=vec4(0.0); + samp+= texture(p_sampler,p_triplanar_pos.xy) * p_weights.z; + samp+= texture(p_sampler,p_triplanar_pos.xz) * p_weights.y; + samp+= texture(p_sampler,p_triplanar_pos.zy * vec2(-1.0,1.0)) * p_weights.x; + return samp; +} + +void vertex() { + uv1_power_normal=pow(abs(NORMAL),vec3(1.0)); + uv1_power_normal/=dot(uv1_power_normal,vec3(1.0)); + vec3 uv1_scale = vec3(scale); + uv1_triplanar_pos = VERTEX * uv1_scale + uv1_offset; + uv1_triplanar_pos *= vec3(1.0,-1.0, 1.0); +} + +void fragment() { + vec4 albedo_tex = triplanar_texture(grid_texture,uv1_power_normal,uv1_triplanar_pos); + ALBEDO = albedo.rgb * albedo_tex.rgb; +} \ No newline at end of file