Skip to content

Commit

Permalink
Make the roller knob rounder again
Browse files Browse the repository at this point in the history
Now it's pretty much spot on!
  • Loading branch information
YuriSizov committed Oct 30, 2024
1 parent 2cd58a1 commit 7ccc045
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion gui/components/knobs/RollerKnob.gdshader
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ uniform vec3 notches_color: source_color = vec3(1.0);

group_uniforms wheel;
uniform float wheel_height: hint_range(-4.0, 4.0) = 0.0;
uniform float wheel_back_offset: hint_range(0.0, 1.0) = 0.04;
uniform float wheel_back_extension: hint_range(-2.0, 2.0) = 0.4;
uniform float wheel_depth: hint_range(0.0, 1.0) = 0.1;
uniform vec2 wheel_depth_sharpness = vec2(0.2, 0.22);
uniform vec2 wheel_limits_sharpness = vec2(0.1, 0.12);
Expand Down Expand Up @@ -91,7 +93,7 @@ void fragment() {
// Draw the wheel with notches.

// Create the back side of the wheel.
float wheel_back_mask = band(uv + 0.05 + wheel_height, 1, notches_band - 1.0, notches_band_sharpness);
float wheel_back_mask = band(uv + wheel_back_offset + wheel_height, 1, notches_band - wheel_back_extension, notches_band_sharpness);
float wheel_back_limits = smoothstep(wheel_limits_sharpness.x, wheel_limits_sharpness.y, 1.0 - abs(uv.x) * 2.0);
wheel_back_mask = clamp(wheel_back_limits * wheel_back_mask, 0.0, 1.0);
// Add the back side to the output color.
Expand Down
14 changes: 8 additions & 6 deletions gui/components/knobs/RollerKnob.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,19 @@ shader_parameter/notches_frequency = 3.211
shader_parameter/notches_scale = 0.281
shader_parameter/notches_shine = 0.348
shader_parameter/notches_brightness = 1.867
shader_parameter/notches_band = 1.84
shader_parameter/notches_band = 1.6
shader_parameter/notches_band_sharpness = Vector2(0.03, 0.045)
shader_parameter/notches_limits_sharpness = Vector2(0.06, 0.26)
shader_parameter/notches_shadow_sharpness = Vector2(0.01, 0.14)
shader_parameter/notches_color = Color(0.596801, 0.60802, 0.650343, 1)
shader_parameter/wheel_height = 1.9e-07
shader_parameter/wheel_depth = 0.045
shader_parameter/wheel_depth_sharpness = Vector2(-0.21, 0.54)
shader_parameter/wheel_height = -0.0299998
shader_parameter/wheel_back_offset = 0.13
shader_parameter/wheel_back_extension = 0.4
shader_parameter/wheel_depth = 0.085
shader_parameter/wheel_depth_sharpness = Vector2(-0.21, 0.57)
shader_parameter/wheel_limits_sharpness = Vector2(0.06, 0.07)
shader_parameter/wheel_warp_power = 2.0
shader_parameter/wheel_warp_factor = 0.3
shader_parameter/wheel_warp_power = 2.578
shader_parameter/wheel_warp_factor = 1.011
shader_parameter/wheel_color = Color(0.0182191, 0.0194593, 0.0278257, 1)

[node name="RollerKnob" type="PanelContainer"]
Expand Down

0 comments on commit 7ccc045

Please sign in to comment.