(probably overkill) subtle grid noise
This commit is contained in:
parent
8008ecc143
commit
8c83919525
3 changed files with 23 additions and 13 deletions
|
@ -5,15 +5,20 @@ uniform vec3 light_color : source_color;
|
|||
uniform vec3 dark_color : source_color;
|
||||
// uniform float line_width : hint_range(0.0, 0.1, 0.001);
|
||||
uniform sampler2D NOISE_PATTERN;
|
||||
uniform float noise_strength : hint_range(0, 1.0, 0.01);
|
||||
|
||||
vec3 albedo(vec2 pos) {
|
||||
vec2 noise_pos = pos*vec2(textureSize(NOISE_PATTERN,1))/dims;
|
||||
vec3 noise = noise_strength*(texture(NOISE_PATTERN, noise_pos).rgb - vec3(0.5));
|
||||
|
||||
if (round(mod(pos.x/2.0+noise.r, 1.0)) == round(mod(pos.y/2.0+noise.g, 1.0))) {
|
||||
return dark_color;
|
||||
} else {
|
||||
return light_color;
|
||||
}
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 p = UV*dims;
|
||||
float noise = (texture(NOISE_PATTERN, p).x-0.5)/10.0;
|
||||
ivec2 pos = ivec2(int(p.x), int(p.y));
|
||||
vec2 sub = mod(p, 1.0);
|
||||
if (pos.x % 2 == pos.y % 2) {
|
||||
ALBEDO = dark_color;
|
||||
} else {
|
||||
ALBEDO = light_color;
|
||||
}
|
||||
ALBEDO = (albedo(p-vec2(0.01, 0.0))+albedo(p+vec2(0.01,0.0))+albedo(p-vec2(0.0, 0.01))+albedo(p+vec2(0.0,0.01)))/4.0;
|
||||
}
|
13
main.tscn
13
main.tscn
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=13 format=3 uid="uid://lrk2whqxl0w0"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://lrk2whqxl0w0"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c707s0tgd88pg" path="res://main.gd" id="1_ig7tw"]
|
||||
[ext_resource type="Texture2D" uid="uid://crahyipmcudoy" path="res://ui/undo.png" id="3_lquwl"]
|
||||
|
@ -20,11 +20,15 @@ background_mode = 2
|
|||
sky = SubResource("Sky_lquwl")
|
||||
tonemap_mode = 2
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_lquwl"]
|
||||
|
||||
[sub_resource type="FastNoiseLite" id="FastNoiseLite_lquwl"]
|
||||
noise_type = 0
|
||||
frequency = 0.0102
|
||||
noise_type = 3
|
||||
domain_warp_frequency = 0.28
|
||||
|
||||
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_7mycd"]
|
||||
invert = true
|
||||
color_ramp = SubResource("Gradient_lquwl")
|
||||
noise = SubResource("FastNoiseLite_lquwl")
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lquwl"]
|
||||
|
@ -32,8 +36,9 @@ render_priority = 0
|
|||
shader = ExtResource("5_lquwl")
|
||||
shader_parameter/dims = Vector2(64, 64)
|
||||
shader_parameter/light_color = Color(0.321254, 0.470959, 0.199863, 1)
|
||||
shader_parameter/dark_color = Color(0.308333, 0.451677, 0.191453, 1)
|
||||
shader_parameter/dark_color = Color(0.309804, 0.45098, 0.192157, 1)
|
||||
shader_parameter/NOISE_PATTERN = SubResource("NoiseTexture2D_7mycd")
|
||||
shader_parameter/noise_strength = 0.1
|
||||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_1bvp3"]
|
||||
material = SubResource("ShaderMaterial_lquwl")
|
||||
|
|
2
piece.gd
2
piece.gd
|
@ -121,7 +121,7 @@ func do_bump(move: Vector2i, old_lvel := lvel) -> Callable:
|
|||
return func():
|
||||
lvel_displayed = old_lvel
|
||||
var tween := create_tween()
|
||||
tween.tween_property(self, "position", target_pos() + pos_of_lpos(move)/2, anim_time())
|
||||
tween.tween_property(self, "position", target_pos() + pos_of_lpos(move)/2, anim_time()/2)
|
||||
tween.tween_callback(func(): lvel_displayed = lvel)
|
||||
tween_to_target(tween)
|
||||
tweens.push_back(tween)
|
||||
|
|
Loading…
Reference in a new issue