aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/kotlin/org/openrndr/Preload.kt10
-rw-r--r--src/main/kotlin/trtrfr/TrtrfrProgram.kt44
-rw-r--r--src/main/resources/shaders/modules/utils.glsl7
-rw-r--r--src/main/resources/shaders/trtrfr.glsl39
4 files changed, 36 insertions, 64 deletions
diff --git a/src/main/kotlin/org/openrndr/Preload.kt b/src/main/kotlin/org/openrndr/Preload.kt
index 42bab94..0fd1656 100644
--- a/src/main/kotlin/org/openrndr/Preload.kt
+++ b/src/main/kotlin/org/openrndr/Preload.kt
@@ -9,10 +9,16 @@ import phenax.utils.*
class Preload : ApplicationPreload() {
override fun onProgramSetup(program: Program) {
println("Program: ${program.name}")
+ val fileSuffix =
+ if (System.getenv("PHENAX_FILE_SUFFIX").isNullOrEmpty()) {
+ ""
+ } else {
+ ".${System.getenv("PHENAX_FILE_SUFFIX") ?: ""}"
+ }
if (recordingEnabled) {
program.extend(ScreenRecorder()) {
outputToVideo = true
- outputFile = "video/${program.name}.mp4"
+ outputFile = "video/${program.name}${fileSuffix}.mp4"
frameRate = 60
maximumDuration = recordDuration()
quitAfterMaximum = true
@@ -20,7 +26,7 @@ class Preload : ApplicationPreload() {
}
} else if (screenshotEnabled) {
program.extend(SingleScreenshot()) {
- outputFile = "screenshot/${program.name}.png"
+ outputFile = "screenshot/${program.name}${fileSuffix}.png"
async = false
quitAfterScreenshot = true
}
diff --git a/src/main/kotlin/trtrfr/TrtrfrProgram.kt b/src/main/kotlin/trtrfr/TrtrfrProgram.kt
index 7d2f959..4d26c11 100644
--- a/src/main/kotlin/trtrfr/TrtrfrProgram.kt
+++ b/src/main/kotlin/trtrfr/TrtrfrProgram.kt
@@ -4,7 +4,6 @@ import org.openrndr.application
import org.openrndr.color.*
import org.openrndr.draw.*
import org.openrndr.math.IntVector2
-import org.openrndr.math.Vector2
import phenax.utils.*
fun main() = application {
@@ -31,33 +30,8 @@ fun main() = application {
val outputSize = IntVector2(width, height)
val outputBuffer = colorBuffer(outputSize.x, outputSize.y, type = ColorType.UINT8)
- var scale: Double = 1.0
- var offset: Vector2 = Vector2.ZERO
- var moving = false
-
- program.keyboard.keyDown.listen {
- if (it.name == "r") {
- scale = 1.0
- offset = Vector2.ZERO
- }
- }
- program.mouse.buttonDown.listen { moving = true }
- program.mouse.buttonUp.listen { moving = false }
- var lastPos = Vector2.ZERO
- program.mouse.moved.listen {
- val dimens = Vector2(program.width.toDouble(), program.height.toDouble())
- var pos = (Vector2(it.position.x, -it.position.y) - dimens / 2.0).div(dimens)
- val del = lastPos - pos
- lastPos = pos
- if (moving) offset = offset + del * 5.0 / scale
- }
-
- program.mouse.scrolled.listen { scale = scale * (1 + it.rotation.y / 3) }
-
extend {
cs.uniform("enable_antialiasing", enableAntialiasing)
- cs.uniform("offset", offset)
- cs.uniform("scale", scale)
cs.uniform("seconds", seconds)
cs.image("output_image", 0, outputBuffer.imageBinding(0, ImageAccess.WRITE))
cs.execute(
@@ -66,24 +40,6 @@ fun main() = application {
1
)
drawer.image(outputBuffer, 0.0, 0.0, width.toDouble(), height.toDouble())
-
- // val shadow = outputBuffer.shadow
- // shadow.download()
- // for (y in 0 until outputBuffer.height) {
- // for (x in 0 until outputBuffer.width) {
- // val c = shadow[x, y]
- // shadow[x, y] =
- // ColorRGBa(
- // Math.pow(c.r, (1.0 / 2.2)),
- // Math.pow(c.g, (1.0 / 2.2)),
- // Math.pow(c.b, (1.0 / 2.2)),
- // c.alpha
- // )
- // }
- // }
- // shadow.upload()
- // outputBuffer.saveToFile(java.io.File("screenshot/${program.name}.png"), async = false)
- // program.application.exit()
}
}
}
diff --git a/src/main/resources/shaders/modules/utils.glsl b/src/main/resources/shaders/modules/utils.glsl
index 090e017..f75973e 100644
--- a/src/main/resources/shaders/modules/utils.glsl
+++ b/src/main/resources/shaders/modules/utils.glsl
@@ -46,3 +46,10 @@ vec3 saturation(vec3 color, float s) {
y + s * (color.b - y)
);
}
+vec3 color_warmth(vec3 color, float warmth) {
+ color.r *= (1.0 + warmth * 0.5);
+ color.g *= (1.0 + warmth * 0.2);
+ color.b *= (1.0 - warmth * 0.3);
+ return clamp(color, 0.0, 1.0);
+}
+
diff --git a/src/main/resources/shaders/trtrfr.glsl b/src/main/resources/shaders/trtrfr.glsl
index 080aae0..a3ddcbd 100644
--- a/src/main/resources/shaders/trtrfr.glsl
+++ b/src/main/resources/shaders/trtrfr.glsl
@@ -5,6 +5,7 @@ precision highp float;
#include <complex>
#include <sdf>
#include <utils>
+#include <noise>
uniform float seconds = 0;
layout(rgba8) uniform writeonly image2D output_image;
@@ -12,26 +13,23 @@ layout(rgba8) uniform writeonly image2D output_image;
uniform float antialiasing = 0.28;
uniform bool enable_antialiasing = false;
-uniform vec2 offset;
-uniform float scale;
-
-const int MAX_ITERATIONS = 1000;
+const int MAX_ITERATIONS = 2000;
const float INF_GAP = 10000.0;
-vec3 col_blue1 = srgb(0.33, 0.48, 0.60);
vec3 col_pink1 = srgb(0.98, 0.27, 0.47);
-vec3 col_pink2 = srgb(0.84, 0.24, 0.33);
+vec3 col_pink2 = srgb(0.88, 0.22, 0.32);
vec3 col_yellow1 = srgb(0.90, 0.69, 0.18);
vec3 col_violet1 = srgb(0.26, 0.11, 0.52);
-vec3 col_green1 = srgb(0.24, 0.40, 0.33);
-vec3 col_wingpat = srgb(0.12, 0.06, 0.03);
-vec3 col_mothbody = srgb(0.12, 0.06, 0.03);
+vec3 col_green1 = srgb(0.19, 0.29, 0.16);
+vec3 col_green2 = srgb(0.05, 0.15, 0.02);
+vec3 col_wingpat = vec3(0.01);
+vec3 col_mothbody = col_wingpat;
vec3 col_bg = vec3(0);
vec3 image(vec2 uv) {
vec3 color = col_bg;
- vec2 c = (uv - vec2(0, 0.20)) * 6 / scale + offset;
+ vec2 c = (uv - vec2(0, 0.20)) * 6;
c = vec2(c.y, c.x);
vec2 z = vec2(0);
vec2 last_z;
@@ -48,23 +46,27 @@ vec3 image(vec2 uv) {
// Pat
vec2 p = (uv - vec2(0, -0.012)) * vec2(23, 72);
float buttpat = sin(-abs(p.x) - 5) * sin(abs(p.y)) - sin((abs(p.x) - 6) * p.y);
- color = mix(color, col_wingpat, (smoothstep(-0.5, 1.0, buttpat)) * step(last_dist, 0.0000003));
+ color = mix(color, col_wingpat, (smoothstep(-1.0, 1.0, buttpat - 0.05)) * step(last_dist, 0.0000002));
color = mix(color, col_mothbody, (1 - step(last_dist, 0.0000016)) * step(last_dist, 0.05));
+ float headcut = sdf_circle(uv - vec2(0, 0.146), 0.092);
+ float band = last_dist - round(last_dist / 0.4) * 0.4 + 0.22 * fbm(vec2(abs(uv.x), uv.y) * 100) + 0.15 * fbm(vec2(abs(uv.x), uv.y) * 400) - 0.12;
+ color = mix(color, mix(col_wingpat, vec3(0), 0.4), step(headcut, 0) * (1 - step(band, 0.1)) * smoothstep(-0.38, 0.38, band));
float gap = 0.504;
vec2 eyesp = uv - vec2(gap / 2., 0.093);
eyesp.x -= round(eyesp.x / gap) * gap;
- float eyes = sdf_circle(eyesp, 0.007);
- color = mix(color, mix(col_wingpat, col_bg, 0.22), step(abs(eyes) - 0.003, 0));
+ float eyes = sdf_circle(eyesp, 0.0072);
+ color = mix(color, mix(col_wingpat, col_bg, 0.2), step(abs(eyes) - 0.004, 0) * step(last_dist, 0.0000002));
// Floral
- color = mix(color, srgb(0.0, 0.13, 0.08), (1 - step(last_dist, 0.1)) * (1 - step(last_dist, INF_GAP)));
- color = mix(color, mix(col_pink1, col_violet1, smoothstep(-0.2, 0.5, f)), step(f, 0.9999));
+ color = mix(color, col_green2, (1 - step(last_dist, INF_GAP)));
+ color = mix(color, col_yellow1, step(f, 1.0));
+ color = mix(color, col_pink2, step(f, 0.2));
color = mix(color, col_yellow1, step(f, 0.016));
- color = mix(color, col_violet1, step(f, 0.008));
- color = mix(color, col_pink2, step(f, 0.005));
- color = mix(color, col_green1, step(f, 0.003));
+ color = mix(color, col_violet1, step(f, 0.0059999));
+ color = mix(color, col_pink2, step(f, 0.0024));
+ color = mix(color, col_green1, step(f, 0.0018));
return color;
}
@@ -88,6 +90,7 @@ void main() {
vec2 uv = (gl_GlobalInvocationID.xy - resolution / 2) * vec2(1.0, aspect_ratio) / resolution;
vec3 color = enable_antialiasing ? antialiased_image(uv) : image(uv);
+ color = color_warmth(color, 1);
imageStore(output_image, ivec2(gl_GlobalInvocationID.xy), vec4(color, 1));
}