diff --git a/src/models/icosahedron/Icosahedron.tscn b/src/models/icosahedron/Icosahedron.tscn index b788c13..8c10ed4 100644 --- a/src/models/icosahedron/Icosahedron.tscn +++ b/src/models/icosahedron/Icosahedron.tscn @@ -17,12 +17,15 @@ render_priority = 0 shader = ExtResource("2_3wk2e") shader_parameter/cutplane = Vector4(-0.577, -0.577, 0.577, 0.794) shader_parameter/color = Color(0, 1, 0, 1) +shader_parameter/accent_color = Color(0.26, 0.26, 0.26, 1) shader_parameter/enable = true shader_parameter/outline_thickness = 0.025 shader_parameter/_center = Vector2(0.5, 0.5) shader_parameter/_zoom = 1.0 shader_parameter/_repeat = 1.0 shader_parameter/_speed = 1.0 +shader_parameter/aaa = 0.35 +shader_parameter/bbb = 0.35 [sub_resource type="PlaneMesh" id="PlaneMesh_8mu0u"] @@ -33,7 +36,7 @@ size = Vector3(1.66211, 1.56055, 1.42188) render_priority = 0 shader = ExtResource("5_al5e2") shader_parameter/enable = true -shader_parameter/cutplane = Vector4(-0.577, -0.577, 0.577, 0.794) +shader_parameter/cutplane = Vector4(0.577, 0.577, 0.577, 0.794) shader_parameter/color = Color(0, 0.5, 0, 1) shader_parameter/time_scale = 10.0 shader_parameter/noise_pattern = ExtResource("6_ai0t7") @@ -42,9 +45,10 @@ shader_parameter/noise_pattern = ExtResource("6_ai0t7") render_priority = 2 next_pass = SubResource("ShaderMaterial_4yeiy") shader = ExtResource("5_ucsrc1") -shader_parameter/enable = false +shader_parameter/enable = true shader_parameter/outline_thickness = 0.05 -shader_parameter/color = Color(0.358796, 0.73469, 0.907072, 1) +shader_parameter/color = Color(0, 1, 0, 1) +shader_parameter/accent_color = Color(0.26, 0.26, 0.26, 1) shader_parameter/pulse_speed = 12.0 shader_parameter/pulse_amplitude = 2.0 @@ -52,14 +56,17 @@ shader_parameter/pulse_amplitude = 2.0 render_priority = 1 next_pass = SubResource("ShaderMaterial_i83je") shader = ExtResource("2_3wk2e") -shader_parameter/cutplane = Vector4(-0.577, -0.577, 0.577, 0.794) +shader_parameter/cutplane = Vector4(0.577, 0.577, 0.577, 0.794) shader_parameter/color = Color(0, 1, 0, 1) +shader_parameter/accent_color = Color(0.26, 0.26, 0.26, 1) shader_parameter/enable = true -shader_parameter/outline_thickness = 0.04 -shader_parameter/_center = Vector2(0.11, 0.39) +shader_parameter/outline_thickness = 0.0 +shader_parameter/_center = Vector2(0.37, 0.89) shader_parameter/_zoom = 2.85 shader_parameter/_repeat = 6.0 shader_parameter/_speed = 0.35 +shader_parameter/aaa = 0.81 +shader_parameter/bbb = 0.905 shader_parameter/TEXTURE = ExtResource("8_h5ail") [sub_resource type="ShaderMaterial" id="ShaderMaterial_bjqtf"] @@ -69,7 +76,7 @@ shader = ExtResource("5_s1usq") shader_parameter/pulse_enabled = false shader_parameter/colorflow_enbled = false shader_parameter/cutplane_visible = true -shader_parameter/cutplane = Vector4(-0.577, -0.577, 0.577, 0.794) +shader_parameter/cutplane = Vector4(0.577, 0.577, 0.577, 0.794) shader_parameter/color = Vector3(0, 1, 0) [node name="Icosahedron" type="Node3D"] @@ -96,3 +103,12 @@ material_override = SubResource("ShaderMaterial_bjqtf") cast_shadow = 0 mesh = ExtResource("1_kd7xu") script = ExtResource("5_q8b2e") + +[node name="MeshIcosahedron2" type="MeshInstance3D" parent="."] +transform = Transform3D(30.115, 0, 0, 0, 30.115, 0, 0, 0, 30.115, 0, 0, -0.0479969) +visible = false +material_override = SubResource("ShaderMaterial_bjqtf") +cast_shadow = 0 +mesh = ExtResource("1_kd7xu") +skeleton = NodePath("../MeshIcosahedron") +script = ExtResource("5_q8b2e") diff --git a/src/models/icosahedron/components/MeshIcosahedron.gd b/src/models/icosahedron/components/MeshIcosahedron.gd index fbb39bd..2954d72 100644 --- a/src/models/icosahedron/components/MeshIcosahedron.gd +++ b/src/models/icosahedron/components/MeshIcosahedron.gd @@ -2,10 +2,12 @@ extends MeshInstance3D class_name MeshIcosahedron const ICOSAHEDRON_SHADER_V_1 = preload('res://src/models/icosahedron/shaders/icosahedron_shader_v1.gdshader') -const CUTPLANE_EFFECT_V_2 = preload("res://src/models/icosahedron/shaders/cutplane_effect_v2.gdshader") +const CUTPLANE_EFFECT_V_2 = preload("res://src/models/icosahedron/shaders/cutplane_effect_v4.gdshader") const OUTLINE_V_1 = preload('res://src/models/icosahedron/shaders/outline_v1.gdshader') const EDGE_HIGHLIGHT_V_1 = preload('res://src/models/icosahedron/shaders/edge_highlight_v1.gdshader') + const EDGE_NOISE = preload('res://src/models/icosahedron/resources/edge_noise.res') +const TEXTURE_TEST_V_1 = preload('res://assets/build/textures/texture-test-v1.png') var MATERIAL_002 @@ -55,6 +57,7 @@ func set_cutplane(v: Vector4): for i in applied_shaders.size(): ShaderUtils.set_shader_param(self, "cutplane", v, i) ShaderUtils.set_shader_param(self, "noise_pattern", EDGE_NOISE, i) + ShaderUtils.set_shader_param(self, "TEXTURE", TEXTURE_TEST_V_1, i) func set_color(c: Vector3): for i in applied_shaders.size(): diff --git a/src/models/icosahedron/shaders/cutplane_effect_v4.gdshader b/src/models/icosahedron/shaders/cutplane_effect_v4.gdshader index 522015e..ec5cd16 100644 --- a/src/models/icosahedron/shaders/cutplane_effect_v4.gdshader +++ b/src/models/icosahedron/shaders/cutplane_effect_v4.gdshader @@ -1,21 +1,32 @@ shader_type spatial; -render_mode cull_front, depth_test_disabled, unshaded; +render_mode cull_front, depth_test_disabled; #include "cutplane.gdshaderinc" #include "res://src/shaders/shader_utils.gdshaderinc" // to get vac coord a= sin^2(angle), b = sin(angle)*cos(angle) -uniform vec4 cutplane = vec4(-0.577, -0.577, 0.577, 0.794); -uniform vec3 color : source_color = vec3(0.0, 1., 0.); +//uniform vec4 cutplane = vec4(-0.577, -0.577, 0.577, 0.794); +uniform vec4 cutplane = vec4(-0.577, -0.577, -0.577, 0.794); +uniform vec3 color : source_color = vec3(0., 1., 0.); +uniform vec4 accent_color : source_color = vec4(0.26, 0.26, 0.26, 1.); uniform bool enable = true; // outline costumization uniform float outline_thickness = 0.0; // how thick is the outline? -uniform vec2 _center = vec2(0.5); -uniform float _zoom = 1.; -uniform float _repeat = 1.; -uniform float _speed = 1.; +// for cutplane = vec4(-0.577, -0.577, -0.577, 0.794); +//uniform vec2 _center = vec2(0.1, 0.15); + +// for cutplane = vec4(0.577, 0.577, 0.577, 0.794); +//uniform vec2 _center = vec2(0.37, 0.89); + +uniform vec2 _center = vec2(0.11, 0.39); + +uniform float _zoom = 2.85; +uniform float _repeat = 6.; +uniform float _speed = .35; +uniform float aaa = .35; +uniform float bbb = .35; varying vec3 ver; @@ -38,7 +49,9 @@ void vertex() { ver = VERTEX; } } - +vec4 screen(vec4 base, vec4 blend){ + return 1.0 - (1.0 - base) * (1.0 - blend); +} void fragment() { vec3 albedo_out; vec2 uv = UV; @@ -52,14 +65,20 @@ void fragment() { float dist = cutplane_dist(cutplane, ver); bool a = dist > 0.; float c = length(ver); - float b = my_tex.a; + vec4 ac = accent_color; + //float b = 1. - my_tex.a; + float d = 1. - smoothstep(.81, .9, c); + float b = (1. - d * (1. - my_tex.a)); + vec3 overlay_color = 1. - abs(color - b); //albedo_out = vec3(b); //albedo_out = vec3(fract(uv*10.), 0.); //albedo_out = min(currentColor.rgb + vec3(0, b, 0.)); - albedo_out = currentColor.rgb + vec3(b, 0., 0.); - ALBEDO = a ? albedo_out : currentColor.rgb; - ALPHA = currentColor.a; - //ALPHA = a ? 1. : 0.01; + albedo_out = min(color, overlay_color).rgb; + //albedo_out = vec4(b).rgb; + ALBEDO = a ? albedo_out : color.rgb; + ALPHA = a ? currentColor.a : 0.0; + //ALBEDO = color.rgb; + //ALPHA = currentColor.a; } else { ALBEDO = currentColor.rgb; diff --git a/src/models/icosahedron/shaders/icosahedron_shader_v1.gdshader b/src/models/icosahedron/shaders/icosahedron_shader_v1.gdshader index 6a3259b..521576c 100644 --- a/src/models/icosahedron/shaders/icosahedron_shader_v1.gdshader +++ b/src/models/icosahedron/shaders/icosahedron_shader_v1.gdshader @@ -9,7 +9,7 @@ uniform bool colorflow_enbled = false; uniform bool cutplane_visible = true; // to get vac coord a= sin^2(angle), b = sin(angle)*cos(angle) -uniform vec4 cutplane = vec4(-0.577, -0.577, 0.577, 0.794); +uniform vec4 cutplane = vec4(-0.577, -0.577, -0.577, 0.794); uniform vec3 color = vec3(.0, 1., .0); varying vec3 ver; diff --git a/src/models/icosahedron/shaders/outline_v1.gdshader b/src/models/icosahedron/shaders/outline_v1.gdshader index 737b6f4..3c13355 100644 --- a/src/models/icosahedron/shaders/outline_v1.gdshader +++ b/src/models/icosahedron/shaders/outline_v1.gdshader @@ -9,7 +9,8 @@ uniform sampler2D screen_texture : hint_screen_texture, // outline costumization uniform float outline_thickness = 0.05; -uniform vec4 color : source_color = vec4(0.0); +uniform vec4 color : source_color = vec4(0., 1., 0., 1.); +uniform vec4 accent_color : source_color = vec4(0.26, 0.26, 0.26, 1.); // pulse customization uniform float pulse_speed = 12.; @@ -24,11 +25,20 @@ void vertex() { } } +// TODO: move to inc file +vec4 color_burn(vec4 base, vec4 blend){ + return 1.0 - (1.0 - base) / blend; +} + +vec4 darken(vec4 base, vec4 blend){ + return min(base, blend); +} + void fragment() { - vec4 currentColor = textureLod(screen_texture, SCREEN_UV, 0.0); if (enable) { - ALBEDO = currentColor.rgb * color.rgb; + ALBEDO = min(color, accent_color).rgb; } else { + vec4 currentColor = textureLod(screen_texture, SCREEN_UV, 0.0); ALBEDO = currentColor.rgb; } }