noise, but noghint working

This commit is contained in:
2025-08-03 21:40:35 +03:00
parent 761a1b63f4
commit 62a680e260
7 changed files with 106 additions and 62 deletions

View File

@@ -1,17 +0,0 @@
shader_type canvas_item;
// Snippets of code drawn from https://gist.github.com/Bleuje/1e497df4505ca24c39ab3930a95700b3
uniform sampler2D sim_texture;
float gn(in vec2 coordinate, in float seed){
return fract(tan(distance(coordinate*(seed+0.118446744073709551614), vec2(0.118446744073709551614, 0.314159265358979323846264)))*0.141421356237309504880169);
}
void fragment() {
vec3 orig = texture(sim_texture, UV).rgb;
float agent = orig.r;
float trail = orig.g;
COLOR = vec4(agent, trail, orig.b, 1.0);
}

View File

@@ -1,20 +1,21 @@
shader_type canvas_item;
uniform sampler2D sim_texture;
uniform sampler2D trail_texture;
uniform float decay_factor;
void fragment() {
vec3 orig = texture(sim_texture, UV).rgb;
float trail = texture(sim_texture, UV).g;
vec3 orig = texture(trail_texture, UV).rgb;
float trail = orig.r;
float sum = 0.0;
for(int i=-1;i<=1;i++) {
for(int j=-1;j<=1;j++) {
sum += texture(sim_texture, UV).g;
for(float i=-1.0;i<=1.5;i++) {
for(float j=-1.0;j<=1.5;j++) {
vec2 offset = vec2(i,j);
sum += texture(trail_texture, UV + vec2(i,j)).g;
}
}
trail = sum / 9.0;
trail = trail * decay_factor;
COLOR = vec4(orig.r, trail, orig.b, 1.0);
COLOR = vec4(trail, orig.g, orig.b, 1.0);
}

View File

@@ -0,0 +1,38 @@
shader_type canvas_item;
uniform sampler2D point_texture;
uniform sampler2D trail_texture;
uniform ivec2 point_texture_size;
uniform ivec2 canvas_size;
uniform float point_speed;
// Snippets of code drawn from https://gist.github.com/Bleuje/1e497df4505ca24c39ab3930a95700b3
float gn(in vec2 coordinate, in float seed){
return fract(tan(distance(coordinate*(seed+0.118446744073709551614), vec2(0.118446744073709551614, 0.314159265358979323846264)))*0.141421356237309504880169);
}
float trail_at_pos(vec2 uv) {
return texture(trail_texture, uv).r;
}
void vertex() {
int id = VERTEX_ID;
int x = id % point_texture_size.x;
int y = id / point_texture_size.x;
// This feels dumb
vec2 uv = vec2(float(x), float(y));
vec4 point_data = texture(point_texture, uv);
vec2 pos = point_data.xy;
pos += vec2(5000.0, 5000.0);
float angle = point_data.z;
VERTEX = pos/vec2(canvas_size);
//COLOR = vec4(pos, angle, point_data.z)
COLOR=vec4(1, 1, 1, 1);
}
void fragment() {
}

View File

@@ -1,6 +1,6 @@
shader_type canvas_item;
uniform sampler2D sim_texture;
uniform sampler2D view_texture;
void fragment() {
vec3 v = texture(view_texture, UV).rgb;