Adding all things done so far
This commit is contained in:
parent
f48c1d84a8
commit
bc09e1f8db
46
shaders/soap.gdshader
Normal file
46
shaders/soap.gdshader
Normal file
|
@ -0,0 +1,46 @@
|
|||
shader_type spatial;
|
||||
render_mode cull_disabled, blend_add;
|
||||
|
||||
uniform sampler2D gradient;
|
||||
uniform float thickness : hint_range(0, 1500.0) = 500.0;
|
||||
uniform float alpha : hint_range(0, 1.0) = 0.5;
|
||||
uniform float metallic : hint_range(0, 1.0) = 1.0;
|
||||
uniform float roughness : hint_range(0, 1.0) = 0.0;
|
||||
uniform sampler2D noise;
|
||||
|
||||
uniform float gravity_strength : hint_range(0, 1500.0) = 300.0;
|
||||
|
||||
void vertex() {
|
||||
vec3 dir = normalize(CAMERA_POSITION_WORLD - VERTEX);
|
||||
float val = abs(clamp(dot(NORMAL, dir), -1, 1));
|
||||
COLOR.b = abs((NORMAL.y - 1.0) / 2.0);
|
||||
COLOR.r = (val + 1.0) / 2.0;
|
||||
COLOR.g = val;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
//ALBEDO.rgb = vec3(1, COLOR.g - 0.1, 0);
|
||||
|
||||
vec2 line_uv = vec2(UV.x, UV.y * 2.0);
|
||||
|
||||
vec3 noise_pix = texture(noise, UV).rgb;
|
||||
vec2 new_uv = vec2(UV.x + noise_pix.r, UV.y);
|
||||
noise_pix = texture(noise, new_uv).rgb;
|
||||
new_uv = vec2(new_uv.x + noise_pix.r, new_uv.y);
|
||||
noise_pix = texture(noise, new_uv).rgb;
|
||||
|
||||
float height_disp = COLOR.b + (noise_pix.r * 0.2);
|
||||
|
||||
float new_thickness = clamp((thickness * COLOR.r) + (gravity_strength * height_disp), 0, 1499.0);
|
||||
|
||||
float v = new_thickness / 1500.0;
|
||||
vec2 uv = vec2(v, 0);
|
||||
|
||||
ALBEDO = texture(gradient, uv).rgb;
|
||||
//ALBEDO.b = COLOR.b;
|
||||
ALPHA = alpha;
|
||||
METALLIC = metallic;
|
||||
ROUGHNESS = roughness;
|
||||
CLEARCOAT = 0.7;
|
||||
CLEARCOAT_ROUGHNESS = 0.75;
|
||||
}
|
Loading…
Reference in a new issue