From 12a94d73a87a84b7af248ca35b9680480e807d6a Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Fri, 11 Oct 2024 11:19:03 +0200 Subject: [PATCH] Added simple warped water. --- assets/buildings/LogCabin/Pole.glb | Bin 0 -> 3384 bytes assets/buildings/LogCabin/Pole.glb.import | 36 ++++++ assets/buildings/LogCabin/Wall.glb | Bin 0 -> 9432 bytes assets/buildings/LogCabin/Wall.glb.import | 36 ++++++ assets/buildings/LogCabin/Wall_Wall.png | Bin 0 -> 85 bytes .../buildings/LogCabin/Wall_Wall.png.import | 38 ++++++ assets/custom/buildings/LogCabin/pole.tscn | 19 +++ assets/custom/buildings/LogCabin/wall.tscn | 14 +++ world/level.tscn | 76 +++++++++--- world/stylized_water_material.gdshader | 106 ---------------- world/water_simple_warping.tres | 116 ++++++++++++++++++ 11 files changed, 319 insertions(+), 122 deletions(-) create mode 100644 assets/buildings/LogCabin/Pole.glb create mode 100644 assets/buildings/LogCabin/Pole.glb.import create mode 100644 assets/buildings/LogCabin/Wall.glb create mode 100644 assets/buildings/LogCabin/Wall.glb.import create mode 100644 assets/buildings/LogCabin/Wall_Wall.png create mode 100644 assets/buildings/LogCabin/Wall_Wall.png.import create mode 100644 assets/custom/buildings/LogCabin/pole.tscn create mode 100644 assets/custom/buildings/LogCabin/wall.tscn delete mode 100644 world/stylized_water_material.gdshader create mode 100644 world/water_simple_warping.tres diff --git a/assets/buildings/LogCabin/Pole.glb b/assets/buildings/LogCabin/Pole.glb new file mode 100644 index 0000000000000000000000000000000000000000..53649c2a3ce42f52570e117194c2956a14e5fec8 GIT binary patch literal 3384 zcmcInSySXx6po79xbM4S+-5YiSqR;92`#puD9{YclvUJ7g(eLt(+QQNXOU`aUi}4% zzUafe`=GuJJZsInKSY0k-*>sUxiC;PRhp`gv)psObMDE#0XE{Lsk;rss61jAx9>HK z&lVeV+h&mGVPRIc&5bY#v!F;bvuZ9U(I+!YQ$tS4t(ca1CCu_DO|amWY_n^bYn@gL zKC`;AZLV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KaTnr>f!b5jOnum@p0cc?i;U%zeGD@?&Kxk8Pr^jd9nMm8vD?IeK>~x z)Wa`>|7!T3z`W|=dSh7QMe_4LbBs6(sQEPNkE8y&xVanka2@}6r9Udyh4{+;TzHr2 z*%{NvnDxs3sP7j4^XFRiSz$gmE+OA)Sq02$Zbh#2VPy|i-Ulnsf&ZiD0DqIm_bT;A zN&OW7e_pr@SS6A=ezv#xL&U29{s=)yeJyY~upU?^lKKYV3g9)st3^`361WQ32)tG# z_16K{0@nani=_T~;5q<5iCCLNQhy_018)L03%_3U8z9N~I{BMLe~WN!qyARl?ZAz| z+kl&d(?%W;y-_%A{UA>bBZQ24OuBaq~L zoqV_GdxUEn^}WEmfp-D70;9rdBfm}beZpxYe~;*t)W?7%-~#(aQcnRBfCr3=q&^AU z4y1u8k<{M{lHlmTBP^@G4+;1Dn^lKKqr0bmw*zewtL z0Cxd*0&~JYDEfyW$@x0@heiL0aBZXhQQ+gi-N46ydxX_j=|H_&t;ucLK6VuAr=1s literal 0 HcmV?d00001 diff --git a/assets/buildings/LogCabin/Wall_Wall.png.import b/assets/buildings/LogCabin/Wall_Wall.png.import new file mode 100644 index 0000000..b03a4c0 --- /dev/null +++ b/assets/buildings/LogCabin/Wall_Wall.png.import @@ -0,0 +1,38 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bbpa23uyq6nhf" +path.s3tc="res://.godot/imported/Wall_Wall.png-c61701623f737cff4636106deb172caa.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} +generator_parameters={ +"md5": "333a863235775c1d09b020340ea35966" +} + +[deps] + +source_file="res://assets/buildings/LogCabin/Wall_Wall.png" +dest_files=["res://.godot/imported/Wall_Wall.png-c61701623f737cff4636106deb172caa.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +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/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/assets/custom/buildings/LogCabin/pole.tscn b/assets/custom/buildings/LogCabin/pole.tscn new file mode 100644 index 0000000..f6f544e --- /dev/null +++ b/assets/custom/buildings/LogCabin/pole.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=3 format=3 uid="uid://dcvf00ymfkdkd"] + +[ext_resource type="PackedScene" uid="uid://cs2hld5w7r3nc" path="res://assets/buildings/LogCabin/Pole.glb" id="1_ryxc4"] + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_xw3l5"] +margin = 0.08 +height = 1.0 +radius = 0.25 + +[node name="Pole" instance=ExtResource("1_ryxc4")] + +[node name="trunk" parent="." index="0"] +transform = Transform3D(0, -8.49068e-08, 1, 4.21469e-08, 2.01455, 4.21469e-08, -1, 8.49068e-08, 1.77636e-15, 0, 0, 0) + +[node name="StaticBody3D" type="StaticBody3D" parent="." index="1"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" index="0"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.498063, 0) +shape = SubResource("CylinderShape3D_xw3l5") diff --git a/assets/custom/buildings/LogCabin/wall.tscn b/assets/custom/buildings/LogCabin/wall.tscn new file mode 100644 index 0000000..28af805 --- /dev/null +++ b/assets/custom/buildings/LogCabin/wall.tscn @@ -0,0 +1,14 @@ +[gd_scene load_steps=3 format=3 uid="uid://b38ixieurg6db"] + +[ext_resource type="PackedScene" uid="uid://b7xcb0karhxrt" path="res://assets/buildings/LogCabin/Wall.glb" id="1_gbwet"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_3l8ih"] +size = Vector3(1, 1, 0.333) + +[node name="Wall" instance=ExtResource("1_gbwet")] + +[node name="StaticBody3D" type="StaticBody3D" parent="." index="1"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" index="0"] +transform = Transform3D(-4.37114e-08, -4.21468e-08, 1, 4.21468e-08, 1, 4.21468e-08, -1, 4.21469e-08, -4.37114e-08, 0, 0.5, 0) +shape = SubResource("BoxShape3D_3l8ih") diff --git a/world/level.tscn b/world/level.tscn index d25795e..526d328 100644 --- a/world/level.tscn +++ b/world/level.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=25 format=3 uid="uid://dmagdl5pi6jdj"] +[gd_scene load_steps=27 format=3 uid="uid://dmagdl5pi6jdj"] [ext_resource type="MeshLibrary" uid="uid://dcpuitbu16j1a" path="res://assets/mesh_library.tres" id="1_q0eym"] [ext_resource type="PackedScene" uid="uid://da5r82nvypfk4" path="res://objects/pickup_item.tscn" id="2_ccr0r"] @@ -12,14 +12,16 @@ [ext_resource type="Resource" uid="uid://cwerasgcfgx2p" path="res://data/items/hammer.tres" id="10_wch4q"] [ext_resource type="PackedScene" uid="uid://ccjcjputsddrd" path="res://assets/scene_props/tree_pine.tscn" id="11_5olon"] [ext_resource type="Texture2D" uid="uid://bq3b1hxl5ojh6" path="res://assets/icons/npc_emotes/attention.tres" id="12_3vn8y"] +[ext_resource type="PackedScene" uid="uid://dcvf00ymfkdkd" path="res://assets/custom/buildings/LogCabin/pole.tscn" id="12_mmbxl"] +[ext_resource type="PackedScene" uid="uid://b38ixieurg6db" path="res://assets/custom/buildings/LogCabin/wall.tscn" id="13_1kigt"] [ext_resource type="PackedScene" uid="uid://2q8dhf61a7os" path="res://assets/characters/engineer.tscn" id="13_t16lh"] [ext_resource type="PackedScene" uid="uid://dhpc2xvlfln7o" path="res://objects/actionable.tscn" id="14_8oq2l"] +[ext_resource type="Shader" uid="uid://4p6c77xksyue" path="res://world/water_simple_warping.tres" id="15_bmq7i"] [ext_resource type="Resource" uid="uid://qgj4sfugsnav" path="res://dialogue/bridge_builder_missing_tool.dialogue" id="15_mqfyi"] [ext_resource type="PackedScene" uid="uid://coi5tvcm4emba" path="res://assets/scene_props/tree.tscn" id="16_8m1m6"] [ext_resource type="Script" path="res://quests/builder_missing_tool_quest.gd" id="16_dr1ca"] [ext_resource type="Resource" uid="uid://bx2wi6c0f554" path="res://dialogue/default_dialogue.dialogue" id="18_4qvld"] [ext_resource type="PackedScene" uid="uid://kpyvcyklt68g" path="res://assets/scene_props/bridge.tscn" id="18_yqn1p"] -[ext_resource type="Texture2D" uid="uid://psahbr51jdj6" path="res://assets/textures/water_c.png" id="19_n8o41"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_0soe6"] height = 0.6 @@ -27,12 +29,13 @@ radius = 0.158352 [sub_resource type="SphereShape3D" id="SphereShape3D_ugkqa"] -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_c4uk7"] -albedo_texture = ExtResource("19_n8o41") -uv1_triplanar = true +[sub_resource type="ShaderMaterial" id="ShaderMaterial_u21xo"] +render_priority = 0 +shader = ExtResource("15_bmq7i") [sub_resource type="PlaneMesh" id="PlaneMesh_6aebw"] -material = SubResource("StandardMaterial3D_c4uk7") +lightmap_size_hint = Vector2i(1002, 1002) +material = SubResource("ShaderMaterial_u21xo") size = Vector2(200, 200) [node name="Level" type="Node3D"] @@ -90,6 +93,17 @@ item = ExtResource("9_xhfx0") transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.24405, -4.76837e-06, -10.5962) item = ExtResource("10_wch4q") +[node name="Vegetation" type="Node3D" parent="."] + +[node name="TreePine" parent="Vegetation" instance=ExtResource("11_5olon")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.85673, -4.76837e-06, -3.38285) + +[node name="TreePine2" parent="Vegetation" instance=ExtResource("16_8m1m6")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.99916, -4.76837e-06, -3.04329) + +[node name="TreePine3" parent="Vegetation" instance=ExtResource("11_5olon")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.26548, 0, 0) + [node name="Structures" type="Node3D" parent="."] [node name="BridgeNorth" type="Node3D" parent="Structures"] @@ -101,10 +115,46 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.400034, 0) [node name="poles3" parent="Structures/BridgeNorth" instance=ExtResource("18_yqn1p")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.398493, 0.670723) -[node name="Decorations" type="Node3D" parent="."] +[node name="LogCabin" type="Node3D" parent="Structures"] -[node name="TreePine" parent="Decorations" instance=ExtResource("11_5olon")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.26548, 0, 0) +[node name="Pole" parent="Structures/LogCabin" instance=ExtResource("12_mmbxl")] +transform = Transform3D(1, 0, 0, 0, 0.999991, 0.00434586, 0, -0.00434586, 0.999991, 8, 0, -0.5) + +[node name="Wall" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, -1) + +[node name="Pole2" parent="Structures/LogCabin" instance=ExtResource("12_mmbxl")] +transform = Transform3D(1, 0, 0, 0, 0.999991, 0.00434586, 0, -0.00434586, 0.999991, 11.2851, 0, -0.5) + +[node name="Wall2" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.2851, 0, -1) + +[node name="Wall3" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")] +transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 8.65776, 0, -0.485988) + +[node name="Wall5" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")] +transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 10.6823, 0, -0.485988) + +[node name="Pole3" parent="Structures/LogCabin" instance=ExtResource("12_mmbxl")] +transform = Transform3D(1, 0, 0, 0, 0.999991, 0.00434586, 0, -0.00434586, 0.999991, 8, 0, -2.76883) + +[node name="Pole4" parent="Structures/LogCabin" instance=ExtResource("12_mmbxl")] +transform = Transform3D(1, 0, 0, 0, 0.999991, 0.00434586, 0, -0.00434586, 0.999991, 11.2851, 0, -2.76883) + +[node name="Wall6" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")] +transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 8.65776, 0, -2.75482) + +[node name="Wall7" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")] +transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 9.69133, 0, -2.75482) + +[node name="Wall8" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")] +transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 10.6823, 0, -2.75482) + +[node name="Wall9" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, -2.00416) + +[node name="Wall10" parent="Structures/LogCabin" instance=ExtResource("13_1kigt")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 11.2851, 0, -2.00416) [node name="Quests" type="Node" parent="."] @@ -150,12 +200,6 @@ default_dialogue_resource = ExtResource("18_4qvld") [node name="CollisionShape3D" type="CollisionShape3D" parent="Quests/BuilderMissingTool/Merchant/Actionable"] shape = SubResource("SphereShape3D_ugkqa") -[node name="TreePine" parent="." instance=ExtResource("11_5olon")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.85673, -4.76837e-06, -3.38285) - -[node name="Tree" parent="." instance=ExtResource("16_8m1m6")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.99916, -4.76837e-06, -3.04329) - -[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +[node name="Water" type="MeshInstance3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.239327, 0) mesh = SubResource("PlaneMesh_6aebw") diff --git a/world/stylized_water_material.gdshader b/world/stylized_water_material.gdshader deleted file mode 100644 index f1c5e9c..0000000 --- a/world/stylized_water_material.gdshader +++ /dev/null @@ -1,106 +0,0 @@ -shader_type spatial; -//render_mode specular_phong, cull_disabled; - -uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap; -uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; - -uniform float speed: hint_range(-1, 1) = 0.0; - -uniform sampler2D noise1; -uniform sampler2D noise2; -uniform sampler2D normalmap: hint_normal; - -uniform vec4 color = vec4(0.0352941, 0.658824, 0.929412, 0.635294); -uniform vec4 deep_water = vec4(0.14902, 0.329412, 0.501961, 1); - -//depth-fade var -uniform float beer_law_factor = 2.0; -uniform float _distance = 0.0; - -//foam var -uniform vec4 edge_color = vec4(1); -uniform float edge_scale = 0.25; -uniform float near = 0.1; -uniform float far = 100.f; - -// wave var -uniform vec2 wave_strength = vec2(0.5, 0.25); -uniform vec2 wave_frequ = vec2(12.0, 12.0); -uniform vec2 time_factor = vec2(1.0, 2.0); - -float waves(vec2 pos, float time) { - return (wave_strength.y * sin(pos.y * wave_frequ.y + time * time_factor.y)) + (wave_strength.x * sin(pos.x * wave_frequ.x + time * time_factor.x)); -} - -void vertex() { - VERTEX.y += waves(VERTEX.xy, TIME); -} - -float rim(float depth) { - depth = 2.0f * depth - 1.0f; - return near * far / (far + depth * (near - far)); -} - -float calc_depth_fade(float depth, mat4 projection_matrix, - vec4 fragcoord, float beer_factor, float __distance, vec3 vertex) { - - float scene_depth = depth; - - scene_depth = scene_depth * 2.0 - 1.0; - scene_depth = projection_matrix[3][2] / (scene_depth + projection_matrix[2][2]); - scene_depth = scene_depth + vertex.z; // z is negative - - // application of beers law - scene_depth = exp(-scene_depth * beer_factor); - - float screen_depth = fragcoord.z; - - float depth_fade = (scene_depth - screen_depth) / __distance; - - depth_fade = clamp(depth_fade, 0.0, 1.0); - - return depth_fade; -} - -void fragment() { - float time = TIME * speed; - - vec3 n1 = texture(noise1, UV + time).rgb; - vec3 n2 = texture(noise2, UV - time * 0.2).rgb; - - vec2 uv_movement = UV * 4.0f; - uv_movement += TIME * speed * 4.0f; - - float sum = (n1.r + n2.r) - 1.0f; - - float z_depth = rim(texture(DEPTH_TEXTURE, SCREEN_UV).x); - float z_pos = rim(FRAGCOORD.z); - float diff = z_depth - z_pos; - - // depth-fade - float z_depth_fade = calc_depth_fade(texture(DEPTH_TEXTURE, SCREEN_UV).x, PROJECTION_MATRIX, FRAGCOORD, beer_law_factor, _distance, VERTEX); - float z_fade = rim(FRAGCOORD.z); - float fade_diff = z_depth_fade - z_fade; - - vec4 gradientcolor = mix(color, deep_water, z_depth_fade); - - vec2 displacement = vec2(sum * 0.1); - diff += displacement.x * 70.0f; - - vec4 col = mix(edge_color, gradientcolor, step(edge_scale, diff)); - - vec4 alpha = texture(SCREEN_TEXTURE, SCREEN_UV + displacement); - - - float fin = 0.0; - if (sum > 0.0 && sum < 0.4) fin = 0.1; - if (sum > 0.4 && sum < 0.8) fin = 0.0; - if (sum > 0.8) fin = 1.0f; - - // konvertier fin in vec3 um - ALBEDO = vec3(fin) + mix(alpha.rgb, col.rgb, gradientcolor.a); - - //NORMALMAP = texture(normalmap, uv_movement).rgb; - - ROUGHNESS = 0.1; -} diff --git a/world/water_simple_warping.tres b/world/water_simple_warping.tres new file mode 100644 index 0000000..fa557a5 --- /dev/null +++ b/world/water_simple_warping.tres @@ -0,0 +1,116 @@ +[gd_resource type="VisualShader" load_steps=12 format=3 uid="uid://4p6c77xksyue"] + +[ext_resource type="Texture2D" uid="uid://psahbr51jdj6" path="res://assets/textures/water_c.png" id="1_411gm"] + +[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_jdsi0"] +default_input_values = [0, Vector2(0, 0), 1, Vector2(0.1, 0.1)] +op_type = 0 +operator = 2 + +[sub_resource type="VisualShaderNodeReroute" id="VisualShaderNodeReroute_r45yy"] +default_input_values = [0, Vector2(0, 0)] +port_type = 3 + +[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_l6sy6"] +texture = ExtResource("1_411gm") + +[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_v5ed2"] +input_name = "uv" + +[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_qai4c"] +default_input_values = [0, Vector2(0, 0), 1, Vector2(200, 200)] +op_type = 0 +operator = 2 + +[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_tj5io"] +default_input_values = [0, Vector2(0, 0), 1, Vector2(0, 0)] +op_type = 0 + +[sub_resource type="VisualShaderNodeFloatFunc" id="VisualShaderNodeFloatFunc_ymjaa"] +function = 0 + +[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_wxljw"] +input_name = "time" + +[sub_resource type="VisualShaderNodeFloatFunc" id="VisualShaderNodeFloatFunc_p7aqe"] +function = 1 + +[sub_resource type="VisualShaderNodeVectorCompose" id="VisualShaderNodeVectorCompose_cka31"] +op_type = 0 + +[resource] +code = "shader_type spatial; +render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_lambert, specular_schlick_ggx; + +uniform sampler2D tex_frg_2; + + + +void fragment() { +// Input:7 + float n_out7p0 = TIME; + + +// FloatFunc:6 + float n_out6p0 = sin(n_out7p0); + + +// FloatFunc:8 + float n_out8p0 = cos(n_out7p0); + + +// VectorCompose:9 + vec2 n_out9p0 = vec2(n_out6p0, n_out8p0); + + +// VectorOp:10 + vec2 n_in10p1 = vec2(0.10000, 0.10000); + vec2 n_out10p0 = n_out9p0 * n_in10p1; + + +// Input:3 + vec2 n_out3p0 = UV; + + +// VectorOp:4 + vec2 n_in4p1 = vec2(200.00000, 200.00000); + vec2 n_out4p0 = n_out3p0 * n_in4p1; + + +// VectorOp:5 + vec2 n_out5p0 = n_out10p0 + n_out4p0; + + +// Texture2D:2 + vec4 n_out2p0 = texture(tex_frg_2, n_out5p0); + + +// Output:0 + ALBEDO = vec3(n_out2p0.xyz); + + +} +" +graph_offset = Vector2(-535.526, -182.815) +nodes/fragment/0/position = Vector2(720, 140) +nodes/fragment/2/node = SubResource("VisualShaderNodeTexture_l6sy6") +nodes/fragment/2/position = Vector2(520, 140) +nodes/fragment/3/node = SubResource("VisualShaderNodeInput_v5ed2") +nodes/fragment/3/position = Vector2(-840, 460) +nodes/fragment/4/node = SubResource("VisualShaderNodeVectorOp_qai4c") +nodes/fragment/4/position = Vector2(-420, 300) +nodes/fragment/5/node = SubResource("VisualShaderNodeVectorOp_tj5io") +nodes/fragment/5/position = Vector2(40, 120) +nodes/fragment/6/node = SubResource("VisualShaderNodeFloatFunc_ymjaa") +nodes/fragment/6/position = Vector2(-680, 40) +nodes/fragment/7/node = SubResource("VisualShaderNodeInput_wxljw") +nodes/fragment/7/position = Vector2(-1000, 100) +nodes/fragment/8/node = SubResource("VisualShaderNodeFloatFunc_p7aqe") +nodes/fragment/8/position = Vector2(-640, 160) +nodes/fragment/9/node = SubResource("VisualShaderNodeVectorCompose_cka31") +nodes/fragment/9/position = Vector2(-420, 40) +nodes/fragment/10/node = SubResource("VisualShaderNodeVectorOp_jdsi0") +nodes/fragment/10/position = Vector2(-220, 60) +nodes/fragment/11/node = SubResource("VisualShaderNodeReroute_r45yy") +nodes/fragment/11/position = Vector2(188.812, 194.775) +nodes/fragment/connections = PackedInt32Array(2, 0, 0, 0, 3, 0, 4, 0, 4, 0, 5, 1, 7, 0, 6, 0, 7, 0, 8, 0, 6, 0, 9, 0, 8, 0, 9, 1, 5, 0, 2, 0, 5, 0, 11, 0, 9, 0, 10, 0, 10, 0, 5, 0)