124 lines
5.9 KiB
Plaintext
124 lines
5.9 KiB
Plaintext
[gd_resource type="ShaderMaterial" load_steps=10 format=3 uid="uid://b3wybjajg4dr3"]
|
|
|
|
[ext_resource type="Texture2D" uid="uid://dg241b0ow4owm" path="res://base-environments/transition/import/textures/StationTiles_Albedo.png" id="1_oop75"]
|
|
[ext_resource type="Texture2D" uid="uid://dst0u5b51mx4h" path="res://base-environments/transition/shaders/water_color.exr" id="1_s12gp"]
|
|
[ext_resource type="Texture2D" uid="uid://bvlldp00ytilp" path="res://base-environments/transition/shaders/water_noise.png" id="2_iwcvf"]
|
|
[ext_resource type="Texture2D" uid="uid://bm4pr3sryasif" path="res://base-environments/transition/import/textures/garage_floor_diff_4k.jpg" id="2_ux2m1"]
|
|
[ext_resource type="Texture2D" uid="uid://d3n5urysf7rt6" path="res://base-environments/transition/import/textures/garage_floor_nor_gl_4k.png" id="3_ri2fp"]
|
|
[ext_resource type="Texture2D" uid="uid://dap8d5cqrgv3p" path="res://base-environments/transition/import/textures/StationTiles_normal.png" id="4_iweet"]
|
|
[ext_resource type="Texture2D" uid="uid://cuplhny5m7xc3" path="res://base-environments/transition/import/textures/StationTiles_MR.png" id="5_g44lk"]
|
|
[ext_resource type="Texture2D" uid="uid://dftbief6ti1ct" path="res://base-environments/transition/import/textures/garage_floor_rough_4k.png" id="6_neiec"]
|
|
|
|
[sub_resource type="Shader" id="Shader_wl6o1"]
|
|
code = "// NOTE: Shader automatically converted from Godot Engine 4.3.stable's StandardMaterial3D.
|
|
|
|
shader_type spatial;
|
|
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx;
|
|
|
|
uniform vec4 albedo : source_color;
|
|
uniform sampler2D texture_albedo : source_color, filter_linear_mipmap, repeat_enable;
|
|
uniform float point_size : hint_range(0.1, 128.0, 0.1);
|
|
|
|
uniform float roughness : hint_range(0.0, 1.0);
|
|
uniform vec4 metallic_texture_channel;
|
|
uniform sampler2D texture_roughness : hint_roughness_g, filter_linear_mipmap, repeat_enable;
|
|
|
|
uniform float specular : hint_range(0.0, 1.0, 0.01);
|
|
uniform float metallic : hint_range(0.0, 1.0, 0.01);
|
|
|
|
uniform sampler2D texture_normal : hint_roughness_normal, filter_linear_mipmap, repeat_enable;
|
|
uniform float normal_scale : hint_range(-16.0, 16.0);
|
|
|
|
uniform sampler2D emission_texture : source_color, filter_linear_mipmap, repeat_enable;
|
|
uniform sampler2D emission_colors : source_color, filter_linear_mipmap, repeat_disable;
|
|
uniform sampler2D texture_detail_albedo : source_color, filter_linear_mipmap, repeat_enable;
|
|
uniform sampler2D texture_detail_normal : hint_normal, filter_linear_mipmap, repeat_enable;
|
|
uniform sampler2D texture_detail_roughness : hint_default_white, filter_linear_mipmap, repeat_enable;
|
|
|
|
uniform vec2 uv2_scale = vec2(1.0, 0.5);
|
|
|
|
varying vec3 world_pos;
|
|
|
|
// https://github.com/Norrox/GodotShaders/blob/master/Shaders/Voronoi-Worley/Voronoi.shader
|
|
vec3 RNGV3(vec3 p) {
|
|
vec3 a = fract(vec3(p.x, p.y, p.z) * vec3(111.11,333.33,444.44));
|
|
a += dot(a, a+33.51);
|
|
return fract(vec3(a.x*a.y, a.y*a.z, a.z*a.x)); //outputs a random vec2 between 0 and 1
|
|
}
|
|
|
|
vec4 voronoy(vec3 loc, float scale){
|
|
loc = loc*scale;
|
|
vec4 output = vec4(0., 0., 0., 10.);
|
|
for(float y=-1.; y<=1.; y++){
|
|
for(float x=-1.; x<=1.; x++){
|
|
for(float z=-1.; z<=1.; z++){
|
|
vec3 offs = vec3(x,y,z);
|
|
vec3 n = RNGV3(floor(loc)+offs)*2.0-1.0;
|
|
vec3 p = offs+sin(n) * .5;
|
|
float d = length((fract(loc)-0.5)-p);
|
|
if(d<output.q){
|
|
vec3 rng = RNGV3(floor(loc)+offs);
|
|
output = vec4(rng.x, rng.y, rng.z, d);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return output;
|
|
}
|
|
|
|
|
|
void vertex() {
|
|
world_pos = VERTEX;
|
|
}
|
|
|
|
void fragment() {
|
|
|
|
vec4 albedo_tex = texture(texture_albedo, UV);
|
|
vec4 detail_albedo = texture(texture_detail_albedo, UV2*uv2_scale);
|
|
|
|
ALBEDO = albedo.rgb * albedo_tex.rgb * mix(detail_albedo.xyz, vec3(1.0), 0.5);
|
|
|
|
SPECULAR = specular;
|
|
|
|
vec4 roughness_texture_channel = vec4(0.0, 1.0, 0.0, 0.0);
|
|
float roughness_tex = dot(texture(texture_roughness, UV), roughness_texture_channel);
|
|
float rougness_detail = dot(texture(texture_detail_roughness, UV2), roughness_texture_channel);
|
|
ROUGHNESS = (roughness_tex + rougness_detail*0.1) * roughness;
|
|
|
|
vec3 normal_combined = texture(texture_normal, UV).rgb + (texture(texture_detail_normal, UV2).rgb - 0.5);
|
|
NORMAL_MAP = normal_combined;
|
|
NORMAL_MAP_DEPTH = normal_scale;
|
|
|
|
vec3 caustics_disp = (texture(emission_texture, world_pos.xz*0.1 + TIME * vec2(-0.05, -0.1)).xyz - 0.5) * vec3(2.0, 2.0, 0.0);
|
|
float caustics_hue = (texture(emission_texture,world_pos.zy * vec2(0.01,.02)- TIME * vec2(0.05, 0.2) )).z * 0.2 + 0.6;
|
|
vec3 light_colors = texture(emission_colors, vec2(caustics_hue, voronoy(caustics_disp.xzy + world_pos * 2.0 + TIME*vec3(2.0, -1.0, 0.0), 1.0).w * UV2.y * 0.5 + (1.0-UV2.y)*0.3)).xyz;
|
|
EMISSION = pow((1.5-normal_combined.y)-UV2.y, 2.0) * ALBEDO * light_colors * 3.0;
|
|
|
|
EMISSION += max(0.0, sin(1.0-normal_combined.y*2.1)) * texture(emission_colors, vec2(caustics_hue, 0.5)).xyz * (1.0-UV2.y);
|
|
|
|
//EMISSION = light_colors;
|
|
//EMISSION = max(vec3(0.0), texture(emission_colors, UV2.yx).xyz);// * ALBEDO;
|
|
}
|
|
"
|
|
|
|
[resource]
|
|
resource_name = "station_tiles"
|
|
render_priority = 0
|
|
shader = SubResource("Shader_wl6o1")
|
|
shader_parameter/albedo = Color(1, 1, 1, 1)
|
|
shader_parameter/texture_albedo = ExtResource("1_oop75")
|
|
shader_parameter/point_size = 1.0
|
|
shader_parameter/roughness = 1.0
|
|
shader_parameter/metallic_texture_channel = Vector4(0, 0, 0, 0)
|
|
shader_parameter/texture_roughness = ExtResource("5_g44lk")
|
|
shader_parameter/specular = 0.5
|
|
shader_parameter/metallic = 0.0
|
|
shader_parameter/texture_normal = ExtResource("4_iweet")
|
|
shader_parameter/normal_scale = 1.0
|
|
shader_parameter/emission_texture = ExtResource("2_iwcvf")
|
|
shader_parameter/emission_colors = ExtResource("1_s12gp")
|
|
shader_parameter/texture_detail_albedo = ExtResource("2_ux2m1")
|
|
shader_parameter/texture_detail_normal = ExtResource("3_ri2fp")
|
|
shader_parameter/texture_detail_roughness = ExtResource("6_neiec")
|
|
shader_parameter/uv2_scale = Vector2(1, 0.5)
|