diff options
| author | Akshay Nair <phenax5@gmail.com> | 2026-09-14 22:32:29 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2026-09-14 22:32:29 +0530 |
| commit | a7c26079aedf1c04563eb35a51e5903d576821b4 (patch) | |
| tree | 6c39bfd9d9ba165478335a7c164508afe4fbadf2 /src/main/resources | |
| parent | 707c8896cef6bff291f5d2f3339cf9bf46ee2242 (diff) | |
| download | art-playground-openrndr-a7c26079aedf1c04563eb35a51e5903d576821b4.tar.gz art-playground-openrndr-a7c26079aedf1c04563eb35a51e5903d576821b4.zip | |
Fun patterns for funzies
Diffstat (limited to 'src/main/resources')
| -rw-r--r-- | src/main/resources/shaders/warping.glsl | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/resources/shaders/warping.glsl b/src/main/resources/shaders/warping.glsl new file mode 100644 index 0000000..044e324 --- /dev/null +++ b/src/main/resources/shaders/warping.glsl @@ -0,0 +1,37 @@ +#version 430 +layout(local_size_x = 1, local_size_y = 1) in; + +#include <sdf> +#include <utils> +#include <noise> + +uniform float seconds = 0; +layout(rgba8) uniform readonly image2D noise_texture; +layout(rgba8) uniform writeonly image2D output_image; + +float sample_noise(in vec2 p) { + vec4 noise = imageLoad(noise_texture, ivec2(p * imageSize(noise_texture))); + return noise.x; +} + +float gen_pattern(in vec2 p, out vec3 coloring_factor, out vec3 coloring_factor2) { + float s1 = sample_noise(p + sample_noise(p) * vec2(0.5, 0.1)); + float s2 = sample_noise(p + sample_noise(p) * vec2(0.8, 0.4)); + float s3 = sample_noise(p + sample_noise(p)); + coloring_factor = vec3(s1, s2, 0.8); + coloring_factor2 = vec3(s2, 0.2, s3); + return sample_noise(p + s2 * s1 * s3); +} + +void main() { + vec2 resolution = vec2(imageSize(output_image).xy); + float aspect_ratio = resolution.y / resolution.x; + vec2 uv = gl_GlobalInvocationID.xy * vec2(1.0, aspect_ratio) / resolution; + + vec3 coloring_factor; + vec3 coloring_factor2; + float v = gen_pattern(uv, coloring_factor, coloring_factor2); + vec3 color = mix(coloring_factor, coloring_factor2, v); + + imageStore(output_image, ivec2(gl_GlobalInvocationID.xy), vec4(color, 1)); +} |
