-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcave_mat.tres
39 lines (33 loc) · 1.14 KB
/
cave_mat.tres
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
[gd_resource type="ShaderMaterial" load_steps=4 format=2]
[sub_resource type="Shader" id=1]
code = "shader_type spatial;
render_mode unshaded;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular;
uniform float metallic;
uniform float roughness : hint_range(0,1);
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void fragment() {
vec4 wrld_vertex = CAMERA_MATRIX * vec4(VERTEX, 1.0);
vec4 albedo_tex = smoothstep(0.0, 1.0, texture(texture_albedo, wrld_vertex.xz * 0.001));
vec3 normal = NORMAL * mat3(INV_CAMERA_MATRIX);
ALBEDO = hsv2rgb(vec3(albedo_tex.x, 0.7 + 0.2 * normal.y + 0.1 * normal.x + 0.1 * normal.z, 0.6 - 0.3 * normal.y));
METALLIC = metallic;
ROUGHNESS = roughness;
SPECULAR = specular;
}
"
[sub_resource type="OpenSimplexNoise" id=2]
[sub_resource type="NoiseTexture" id=3]
seamless = true
noise = SubResource( 2 )
[resource]
shader = SubResource( 1 )
shader_param/specular = 0.0
shader_param/metallic = 0.5
shader_param/roughness = 1.0
shader_param/texture_albedo = SubResource( 3 )