git commit

This commit is contained in:
Tuomas Katajisto 2025-09-26 23:21:37 +03:00
parent 9bedf75e92
commit 26e49a1a5f
3 changed files with 737 additions and 427 deletions

View File

@ -1,7 +1,7 @@
#scope_file
// @ToDo do a config tweak file thing like jblow has and add this there.
CAMERA_INACTIVE_TIME_TO_ORBIT :: 20.0;
CAMERA_INACTIVE_TIME_TO_ORBIT :: 200000000.0;
MAX_CAMERA_DIST :: 25.0;
MIN_CAMERA_DIST :: 2.0;
DIST_SCROLL_SPEED :: 0.8;

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ out flat int idx;
void main() {
vec3 multisize = vec3(position.xyz * 1000.0);
gl_Position = mvp * (vec4(multisize.x, 0.0 + float(gl_InstanceIndex) * 0.001, multisize.z, 1.0));
gl_Position = mvp * (vec4(multisize.x, 0.0 + float(gl_InstanceIndex) * 0.003, multisize.z, 1.0));
pos = position;
idx = gl_InstanceIndex;
}
@ -69,6 +69,33 @@ float B(vec2 U) {
return hash(U) - v/4. + .5;
}
float random (vec2 st) {
return fract(sin(dot(st.xy,
vec2(12.9898,78.233)))*
43758.5453123);
}
// 2D Noise based on Morgan McGuire @morgan3d
// https://www.shadertoy.com/view/4dS3Wd
float noise (vec2 st) {
vec2 i = floor(st); // Integer part of the coordinate
vec2 f = fract(st); // Fractional part of the coordinate
// Four corners in 2D of a tile
float a = random(i);
float b = random(i + vec2(1.0, 0.0));
float c = random(i + vec2(0.0, 1.0));
float d = random(i + vec2(1.0, 1.0));
// Smoothstep for interpolation
vec2 u = f*f*(3.0-2.0*f);
// Mix (interpolate) the corners
return mix(a, b, u.x) +
(c - a)* u.y * (1.0 - u.x) +
(d - b) * u.x * u.y;
}
void main() {
if(planeType == 1) {
@ -80,8 +107,12 @@ void main() {
densifiedCoordinate.y += sin(densifiedCoordinate.x);
vec2 ruohokeskus = round(densifiedCoordinate);
float noiseval_fine = noise(densifiedCoordinate / 50.0);
float noiseval_coarse = noise(densifiedCoordinate / 500.0);
float h = (1.0 / 128.0) * idx;
float rand = B(ruohokeskus) + sin(pos.x) * 0.4;
float rand = (B(ruohokeskus) + sin(pos.x) * 0.4) * 0.5;
rand += noiseval_coarse * 0.4 + noiseval_fine * 0.1;
ruohokeskus.x += sin(time * 1.2) * 0.6 * h;
@ -96,12 +127,14 @@ void main() {
float thickness = 0.5;
if(idx > 0 && (rand - h) * thickness < distanceFromCenter) {
discard;
} else {
frag_color = vec4(0.0, min(1.0, h + 0.2), 0.0, 1.0);
}
if(idx > 0 && (rand - h) * thickness < distanceFromCenter) {
discard;
} else {
frag_color = vec4(noiseval_coarse * 0.5, min(1.0, h + 0.2) + noiseval_fine * 0.2, 0.0, 1.0);
}
}
}
@end