Misc shader things
This commit is contained in:
parent
013e340edc
commit
43189892a0
|
@ -0,0 +1,8 @@
|
|||
|
||||
Images:
|
||||
https://www.freepik.com/free-photo/painted-relief-texture_1037471.htm#query=watercolor%20paper&position=9&from_view=keyword&track=ais
|
||||
|
||||
Shaders:
|
||||
Watercolor: https://c-chen99.github.io/watercolorShader/final.html
|
||||
CMKY: https://www.shadertoy.com/view/MltBW4
|
||||
Fresnel: https://godotshaders.com/snippet/fresnel/
|
|
@ -0,0 +1,19 @@
|
|||
// Source: https://www.shadertoy.com/view/MltBW4
|
||||
|
||||
vec4 RGBtoCMYK(vec3 rgb) {
|
||||
float K = 1.0 - max(max(rgb.r, rgb.g), rgb.b);
|
||||
return vec4(
|
||||
(1.0 - rgb.r - K) / (1.0 - K),
|
||||
(1.0 - rgb.g - K) / (1.0 - K),
|
||||
(1.0 - rgb.b - K) / (1.0 - K),
|
||||
K
|
||||
);
|
||||
}
|
||||
|
||||
vec3 CMYKtoRGB(vec4 cmyk) {
|
||||
return vec3(
|
||||
(1.0 - cmyk.x) * (1.0 - cmyk.w),
|
||||
(1.0 - cmyk.y) * (1.0 - cmyk.w),
|
||||
(1.0 - cmyk.z) * (1.0 - cmyk.w)
|
||||
);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
// Source: https://godotshaders.com/snippet/fresnel/
|
||||
|
||||
float fresnel(float amount, vec3 normal, vec3 view) {
|
||||
return pow((1.0 - clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0 )), amount);
|
||||
}
|
||||
|
||||
//void fragment()
|
||||
//{
|
||||
// vec3 base_color = vec3(0.0);
|
||||
// float basic_fresnel = fresnel(3.0, NORMAL, VIEW);
|
||||
// ALBEDO = base_color + basic_fresnel;
|
||||
//}
|
|
@ -0,0 +1,44 @@
|
|||
[gd_resource type="VisualShader" load_steps=3 format=3 uid="uid://dmfe4o4ct2vgh"]
|
||||
|
||||
[sub_resource type="VisualShaderNodeExpression" id="VisualShaderNodeExpression_np6v0"]
|
||||
output_port_for_preview = 0
|
||||
size = Vector2(513, 448.4)
|
||||
expression = "out_color = vec3(1.0, 1.0, 1.0);"
|
||||
|
||||
[sub_resource type="VisualShaderNodeColorConstant" id="VisualShaderNodeColorConstant_p160o"]
|
||||
output_port_for_preview = 0
|
||||
constant = Color(0.873209, 6.54578e-06, 0.551742, 1)
|
||||
|
||||
[resource]
|
||||
code = "shader_type spatial;
|
||||
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_lambert, specular_schlick_ggx;
|
||||
|
||||
|
||||
|
||||
|
||||
void fragment() {
|
||||
vec3 n_out2p0;
|
||||
// Expression:2
|
||||
n_out2p0 = vec3(0.0, 0.0, 0.0);
|
||||
{
|
||||
n_out2p0 = vec3(1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
// Output:0
|
||||
ALBEDO = n_out2p0;
|
||||
|
||||
|
||||
}
|
||||
"
|
||||
graph_offset = Vector2(-567.36, -225.354)
|
||||
nodes/fragment/0/position = Vector2(400, 120)
|
||||
nodes/fragment/2/node = SubResource("VisualShaderNodeExpression_np6v0")
|
||||
nodes/fragment/2/position = Vector2(-400, -100)
|
||||
nodes/fragment/2/size = Vector2(513, 448.4)
|
||||
nodes/fragment/2/input_ports = ""
|
||||
nodes/fragment/2/output_ports = "0,4,out_color;"
|
||||
nodes/fragment/2/expression = "out_color = vec3(1.0, 1.0, 1.0);"
|
||||
nodes/fragment/4/node = SubResource("VisualShaderNodeColorConstant_p160o")
|
||||
nodes/fragment/4/position = Vector2(-580, 440)
|
||||
nodes/fragment/connections = PackedInt32Array(2, 0, 0, 0)
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://6c8232l2x1jw"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://dmfe4o4ct2vgh" path="res://shaders/watercolor_frag.tres" id="1_kgucu"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7kqph"]
|
||||
render_priority = 0
|
||||
shader = ExtResource("1_kgucu")
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_ywpec"]
|
||||
|
||||
[node name="test_watercolor" type="Node3D"]
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
material_override = SubResource("ShaderMaterial_7kqph")
|
||||
mesh = SubResource("BoxMesh_ywpec")
|
Binary file not shown.
Loading…
Reference in New Issue