-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfoliage.tscn
124 lines (105 loc) · 4.52 KB
/
foliage.tscn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
[gd_scene load_steps=9 format=4 uid="uid://dxuw8f7kwem78"]
[ext_resource type="PackedScene" uid="uid://c18d8k7yuohr6" path="res://assets/foliage.glb" id="1_76l0n"]
[ext_resource type="Texture2D" uid="uid://dsosvxhdnfry8" path="res://assets/foliage_foilage.png" id="2_e8qeu"]
[sub_resource type="Shader" id="Shader_hspsj"]
code = "// NOTE: Shader automatically converted from Godot Engine 4.2.1.stable's StandardMaterial3D.
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_disabled,diffuse_burley,specular_schlick_ggx, world_vertex_coords;
uniform vec4 albedo : source_color;
uniform sampler2D texture_albedo : source_color,filter_nearest_mipmap,repeat_enable;
uniform float alpha_scissor_threshold;
uniform float point_size : hint_range(0,128);
uniform float roughness : hint_range(0,1);
uniform sampler2D texture_metallic : hint_default_white,filter_nearest_mipmap,repeat_enable;
uniform vec4 metallic_texture_channel;
uniform sampler2D texture_roughness : hint_roughness_r,filter_nearest_mipmap,repeat_enable;
uniform float specular;
uniform float metallic;
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
group_uniforms wind;
uniform sampler2D noise_tex;
uniform float wind_speed = .1;
uniform float wind_strength = .01;
void vertex() {
UV=UV*uv1_scale.xy+uv1_offset.xy;
float offset = TIME * wind_speed;
float noise = texture(noise_tex, vec2(NODE_POSITION_WORLD.xz - offset)).r;
noise -= .5;
noise *= wind_strength;
VERTEX.x += noise * length(VERTEX.y - NODE_POSITION_WORLD.y);
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
ALBEDO = albedo.rgb * albedo_tex.rgb;
float metallic_tex = dot(texture(texture_metallic,base_uv),metallic_texture_channel);
METALLIC = metallic_tex * metallic;
vec4 roughness_texture_channel = vec4(1.0,0.0,0.0,0.0);
float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel);
ROUGHNESS = roughness_tex * roughness;
SPECULAR = specular;
ALPHA *= albedo.a * albedo_tex.a;
ALPHA_SCISSOR_THRESHOLD = alpha_scissor_threshold;
}
"
[sub_resource type="FastNoiseLite" id="FastNoiseLite_h67iq"]
frequency = 0.005
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_eamar"]
seamless = true
seamless_blend_skirt = 1.0
noise = SubResource("FastNoiseLite_h67iq")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_4tgd6"]
resource_name = "foliage"
render_priority = 0
shader = SubResource("Shader_hspsj")
shader_parameter/albedo = Color(1, 1, 1, 1)
shader_parameter/alpha_scissor_threshold = 0.5
shader_parameter/point_size = 1.0
shader_parameter/roughness = 1.0
shader_parameter/metallic_texture_channel = null
shader_parameter/specular = 0.5
shader_parameter/metallic = 0.0
shader_parameter/uv1_scale = Vector3(1, 1, 1)
shader_parameter/uv1_offset = Vector3(0, 0, 0)
shader_parameter/uv2_scale = Vector3(1, 1, 1)
shader_parameter/uv2_offset = Vector3(0, 0, 0)
shader_parameter/texture_albedo = ExtResource("2_e8qeu")
shader_parameter/wind_speed = 0.1
shader_parameter/wind_strength = 0.2
shader_parameter/noise_tex = SubResource("NoiseTexture2D_eamar")
[sub_resource type="ArrayMesh" id="ArrayMesh_iig4e"]
_surfaces = [{
"aabb": AABB(-0.5, -0.5, -0.433013, 1, 1, 0.866025),
"format": 34896613377,
"index_count": 18,
"index_data": PackedByteArray("AAADAAEAAAACAAMABAAHAAUABAAGAAcACAALAAkACAAKAAsA"),
"name": "foliage",
"primitive": 3,
"uv_scale": Vector4(0, 0, 0, 0),
"vertex_count": 12,
"vertex_data": PackedByteArray("/78AAAAAAAD/PwAA//8AAP+///8AAAAA/z//////AAAAAAAA/38AAP//AAD/fwAAAAD///9/AAD//////38AAP+/AAD//wAA/z8AAAAAAAD/v////v8AAP8///8AAAAA")
}]
blend_shape_mode = 0
[sub_resource type="ArrayMesh" id="ArrayMesh_mfx6o"]
resource_name = "foliage_Plane_002"
_surfaces = [{
"aabb": AABB(-0.5, -0.5, -0.433013, 1, 1, 0.866025),
"attribute_data": PackedByteArray("AAD///////8AAAAA//8AAAAA////////AAAAAP//AAAAAP///////wAAAAD//wAA"),
"format": 34896613399,
"index_count": 18,
"index_data": PackedByteArray("AAADAAEAAAACAAMABAAHAAUABAAGAAcACAALAAkACAAKAAsA"),
"material": SubResource("ShaderMaterial_4tgd6"),
"name": "foliage",
"primitive": 3,
"uv_scale": Vector4(0, 0, 0, 0),
"vertex_count": 12,
"vertex_data": PackedByteArray("/78AAAAAVNX/PwAA//9U1f+///8AAFTV/z//////VNUAAAAA/3//f///AAD/f/9/AAD///9//3///////3//f/+/AAD//1TV/z8AAAAAVNX/v////v9U1f8///8AAFTV/3////9/////f////3////9/////f////3////9/////fwAA/38AAP9/AAD/fwAA")
}]
blend_shape_mode = 0
shadow_mesh = SubResource("ArrayMesh_iig4e")
[node name="foliage2" instance=ExtResource("1_76l0n")]
[node name="foliage" parent="." index="0"]
mesh = SubResource("ArrayMesh_mfx6o")