From f48c1d84a8f07efafce1d574e2f44d4bf0bb46ca Mon Sep 17 00:00:00 2001 From: Rodolphe Houdas Date: Wed, 19 Oct 2022 09:47:38 +0100 Subject: [PATCH] First commit --- .gitattributes | 2 + .gitignore | 2 + Test.tres | 169 ++++++++++++++++++++++++++++++++++++++++++++++++ icon.svg | 1 + icon.svg.import | 37 +++++++++++ main.tscn | 38 +++++++++++ noise.tres | 6 ++ project.godot | 15 +++++ 8 files changed, 270 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 Test.tres create mode 100644 icon.svg create mode 100644 icon.svg.import create mode 100644 main.tscn create mode 100644 noise.tres create mode 100644 project.godot diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8ad74f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Normalize EOL for all files that Git considers text files. +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4709183 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Godot 4+ specific ignores +.godot/ diff --git a/Test.tres b/Test.tres new file mode 100644 index 0000000..6129c76 --- /dev/null +++ b/Test.tres @@ -0,0 +1,169 @@ +[gd_resource type="VisualShader" load_steps=19 format=3 uid="uid://dotlcmfer5kxw"] + +[ext_resource type="Texture2D" uid="uid://dxcmick7pytlf" path="res://noise.tres" id="1_xedsf"] + +[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_t5mfi"] +operator = 2 + +[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_fe2rm"] + +[sub_resource type="VisualShaderNodeVectorFunc" id="VisualShaderNodeVectorFunc_2nasc"] + +[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_tlsga"] + +[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_dmwkg"] +operator = 2 + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_4q2x3"] + +[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_kcfii"] +as_normal_map = true +bump_strength = 32.0 +noise = SubResource("FastNoiseLite_4q2x3") + +[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_lbuo3"] +output_port_for_preview = 0 +expanded_output_ports = [0] +texture = SubResource("NoiseTexture2D_kcfii") + +[sub_resource type="VisualShaderNodeVectorFunc" id="VisualShaderNodeVectorFunc_5as1c"] + +[sub_resource type="VisualShaderNodeMix" id="VisualShaderNodeMix_enygi"] +default_input_values = [0, Vector3(0, 0, 0), 1, Vector3(1, 1, 1), 2, Vector3(0.5, 0.5, 0.5)] +op_type = 3 + +[sub_resource type="VisualShaderNodeFloatParameter" id="VisualShaderNodeFloatParameter_wp5jp"] +parameter_name = "Mix" + +[sub_resource type="VisualShaderNodeFloatParameter" id="VisualShaderNodeFloatParameter_tetda"] +parameter_name = "Scale" + +[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_w328u"] +input_name = "normal" + +[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_7j14n"] +input_name = "vertex" + +[sub_resource type="VisualShaderNodeMix" id="VisualShaderNodeMix_vyit1"] +default_input_values = [0, Vector3(0, 0, 0), 1, Vector3(1, 1, 1), 2, Vector3(0.5, 0.5, 0.5)] +op_type = 3 + +[sub_resource type="VisualShaderNodeVectorOp" id="VisualShaderNodeVectorOp_gb7li"] +operator = 2 + +[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_b0p1s"] +output_port_for_preview = 0 +expanded_output_ports = [0] +texture = ExtResource("1_xedsf") + +[resource] +code = "shader_type spatial; +uniform float Mix; +uniform sampler2D tex_vtx_5; +uniform float Scale; +uniform sampler2D tex_vtx_19; + + + +void vertex() { +// Input:3 + vec3 n_out3p0 = VERTEX; + + +// VectorFunc:14 + vec3 n_out14p0 = normalize(n_out3p0); + + +// FloatParameter:23 + float n_out23p0 = Mix; + + +// Mix:22 + vec3 n_out22p0 = mix(n_out3p0, n_out14p0, vec3(n_out23p0)); + + +// VectorOp:15 + vec3 n_out15p0 = n_out22p0 + n_out3p0; + + +// VectorFunc:21 + vec3 n_out21p0 = normalize(n_out15p0); + + +// Texture2D:5 + vec4 n_out5p0 = texture(tex_vtx_5, UV); + float n_out5p1 = n_out5p0.r; + + +// VectorOp:11 + vec3 n_out11p0 = n_out21p0 * vec3(n_out5p0.xyz); + + +// FloatParameter:27 + float n_out27p0 = Scale; + + +// VectorOp:16 + vec3 n_out16p0 = n_out11p0 * vec3(n_out27p0); + + +// VectorOp:12 + vec3 n_out12p0 = n_out22p0 + n_out16p0; + + +// Input:29 + vec3 n_out29p0 = NORMAL; + + +// Mix:30 + vec3 n_out30p0 = mix(n_out29p0, n_out21p0, vec3(n_out23p0)); + + +// Texture2D:19 + vec4 n_out19p0 = texture(tex_vtx_19, UV); + + +// VectorOp:31 + vec3 n_out31p0 = n_out30p0 * vec3(n_out19p0.xyz); + + +// Output:0 + VERTEX = n_out12p0; + NORMAL = n_out31p0; + + +} +" +graph_offset = Vector2(-1143.06, -151.487) +nodes/vertex/0/position = Vector2(1580, 120) +nodes/vertex/3/node = SubResource("VisualShaderNodeInput_7j14n") +nodes/vertex/3/position = Vector2(-1340, 260) +nodes/vertex/5/node = SubResource("VisualShaderNodeTexture_b0p1s") +nodes/vertex/5/position = Vector2(-220, 580) +nodes/vertex/11/node = SubResource("VisualShaderNodeVectorOp_t5mfi") +nodes/vertex/11/position = Vector2(280, 580) +nodes/vertex/12/node = SubResource("VisualShaderNodeVectorOp_fe2rm") +nodes/vertex/12/position = Vector2(700, 560) +nodes/vertex/14/node = SubResource("VisualShaderNodeVectorFunc_2nasc") +nodes/vertex/14/position = Vector2(-980, 60) +nodes/vertex/15/node = SubResource("VisualShaderNodeVectorOp_tlsga") +nodes/vertex/15/position = Vector2(-200, 300) +nodes/vertex/16/node = SubResource("VisualShaderNodeVectorOp_dmwkg") +nodes/vertex/16/position = Vector2(440, 860) +nodes/vertex/19/node = SubResource("VisualShaderNodeTexture_lbuo3") +nodes/vertex/19/position = Vector2(-20, -620) +nodes/vertex/21/node = SubResource("VisualShaderNodeVectorFunc_5as1c") +nodes/vertex/21/position = Vector2(20, 400) +nodes/vertex/22/node = SubResource("VisualShaderNodeMix_enygi") +nodes/vertex/22/position = Vector2(-500, 100) +nodes/vertex/23/node = SubResource("VisualShaderNodeFloatParameter_wp5jp") +nodes/vertex/23/position = Vector2(-1100, 460) +nodes/vertex/27/node = SubResource("VisualShaderNodeFloatParameter_tetda") +nodes/vertex/27/position = Vector2(-440, 1080) +nodes/vertex/29/node = SubResource("VisualShaderNodeInput_w328u") +nodes/vertex/29/position = Vector2(-1120, -40) +nodes/vertex/30/node = SubResource("VisualShaderNodeMix_vyit1") +nodes/vertex/30/position = Vector2(-500, -260) +nodes/vertex/31/node = SubResource("VisualShaderNodeVectorOp_gb7li") +nodes/vertex/31/position = Vector2(780, -80) +nodes/vertex/connections = PackedInt32Array(3, 0, 14, 0, 3, 0, 15, 1, 11, 0, 16, 0, 16, 0, 12, 1, 15, 0, 21, 0, 5, 0, 11, 1, 21, 0, 11, 0, 23, 0, 22, 2, 22, 0, 15, 0, 22, 0, 12, 0, 14, 0, 22, 1, 3, 0, 22, 0, 27, 0, 16, 1, 29, 0, 30, 0, 23, 0, 30, 2, 12, 0, 0, 0, 21, 0, 30, 1, 30, 0, 31, 0, 31, 0, 0, 1, 19, 0, 31, 1) diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..adc26df --- /dev/null +++ b/icon.svg @@ -0,0 +1 @@ + diff --git a/icon.svg.import b/icon.svg.import new file mode 100644 index 0000000..4ea13b6 --- /dev/null +++ b/icon.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dmwkxmukjv6fb" +path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://icon.svg" +dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +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=1 +svg/scale=1.0 +editor/scale_with_editor_scale=false +editor/convert_colors_with_editor_theme=false diff --git a/main.tscn b/main.tscn new file mode 100644 index 0000000..d9677ad --- /dev/null +++ b/main.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=7 format=3 uid="uid://domnt68rssk3o"] + +[ext_resource type="Shader" uid="uid://dotlcmfer5kxw" path="res://Test.tres" id="1_l2uej"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ei6qd"] +render_priority = 0 +shader = ExtResource("1_l2uej") +shader_parameter/Mix = 1.0 +shader_parameter/Scale = 0.1 + +[sub_resource type="BoxMesh" id="BoxMesh_xmok6"] +material = SubResource("ShaderMaterial_ei6qd") +subdivide_width = 100 +subdivide_height = 100 +subdivide_depth = 100 + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ob31l"] + +[sub_resource type="BoxMesh" id="BoxMesh_ch7qc"] +material = SubResource("StandardMaterial3D_ob31l") + +[sub_resource type="SphereMesh" id="SphereMesh_b1xo6"] + +[node name="Node3d" type="Node3D"] + +[node name="MeshInstance3d" type="MeshInstance3D" parent="."] +mesh = SubResource("BoxMesh_xmok6") + +[node name="DirectionalLight3d" type="DirectionalLight3D" parent="."] +transform = Transform3D(0.999797, 0.0157707, -0.0125257, 0, 0.621941, 0.783064, 0.0201397, -0.782905, 0.621815, 0, 8.5855, 14.3557) + +[node name="MeshInstance3d2" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -2.08947) +mesh = SubResource("BoxMesh_ch7qc") + +[node name="MeshInstance3d3" type="MeshInstance3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1.86506) +mesh = SubResource("SphereMesh_b1xo6") diff --git a/noise.tres b/noise.tres new file mode 100644 index 0000000..d12734e --- /dev/null +++ b/noise.tres @@ -0,0 +1,6 @@ +[gd_resource type="NoiseTexture2D" load_steps=2 format=3 uid="uid://dxcmick7pytlf"] + +[sub_resource type="FastNoiseLite" id="FastNoiseLite_66eei"] + +[resource] +noise = SubResource("FastNoiseLite_66eei") diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..c50e4c3 --- /dev/null +++ b/project.godot @@ -0,0 +1,15 @@ +; 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=5 + +[application] + +config/name="Shaders" +config/features=PackedStringArray("4.0", "Forward Plus") +config/icon="res://icon.svg"