Hi!
I am kind of new with openRNDR and I am experimenting with the compositor in olive.
In the following code I have a bunch of lines being animated and then perturbed.
When not in the compositor (nocomposite.kt), the animation looks fine and I can see all the details. As soon as I insert it in a compositor (composite.kt) the level of detail goes away.
What am I getting wrong here?
// Nocomposite.kt
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.*
import org.openrndr.extra.compositor.blend
import org.openrndr.extra.compositor.compose
import org.openrndr.extra.compositor.draw
import org.openrndr.extra.compositor.layer
import org.openrndr.extra.fx.blend.Add
import org.openrndr.extra.fx.distort.DisplaceBlend
import org.openrndr.extra.fx.distort.Fisheye
import org.openrndr.extra.fx.distort.Perturb
import org.openrndr.extra.fx.edges.EdgesWork
import org.openrndr.extra.olive.oliveProgram
import org.openrndr.math.IntVector2
import org.openrndr.math.Vector2
import org.openrndr.shape.Circle
import org.openrndr.shape.contour
import kotlin.math.PI
import kotlin.math.cos
fun main() = application {
configure {
width = 800
height = 800
position = IntVector2(1920 / 2, 20)
}
oliveProgram {
val c = contour {
moveTo(0.0, 0.0)
curveTo(100.0, 0.0, 200.0, 70.0)
continueTo(50.0, 20.0)
continueTo(50.0, 70.0)
continueTo(30.0, 20.0)
lineTo(30.0, 0.0)
lineTo(100.0, 0.0)
curveTo(0.0,30.0, 0.0, 0.0)
close()
}
val filter = Perturb()
val unfiltered = renderTarget(width, height) {
colorBuffer()
depthBuffer()
}
val filtered = renderTarget(width, height) {
colorBuffer()
}
val composite = compose {
draw {
drawer.fill = null
drawer.stroke = ColorRGBa.BLACK
drawer.strokeWeight = 350.0
drawer.circle(Circle(width / 2.0, height / 2.0, 650.0))
}
layer {
blend(DisplaceBlend()) {
}
draw {
}
}
}
extend {
drawer.stroke = ColorRGBa.WHITE
for (y in 0 until 50) {
for(x in 0 until 50) {
drawer.isolatedWithTarget(unfiltered) {
drawer.translate(x * 11.0, y * 50.0)
val o: Double = cos(seconds) * 0.35 + x / 0.01 - y * 0.01
filter.phase = cos(seconds) * 0.5
filter.decay = 0.168
filter.gain = cos(seconds * 2) * 0.5
drawer.contour(c.sub(o, o + 0.023))
}
}
}
filter.apply(unfiltered.colorBuffer(0), filtered.colorBuffer(0))
drawer.clear(ColorRGBa(0.0, 0.1, 0.6))
drawer.image(filtered.colorBuffer(0))
composite.draw(drawer)
}
}
}
// Composite.kt
fun main() = application {
configure {
width = 800
height = 800
position = IntVector2(1920 / 2, 20)
}
oliveProgram {
val c = contour {
moveTo(0.0, 0.0)
curveTo(100.0, 0.0, 200.0, 70.0)
continueTo(50.0, 20.0)
continueTo(50.0, 70.0)
continueTo(30.0, 20.0)
lineTo(30.0, 0.0)
lineTo(100.0, 0.0)
curveTo(0.0,30.0, 0.0, 0.0)
close()
}
val filter = Perturb()
val unfiltered = renderTarget(width, height) {
colorBuffer()
depthBuffer()
}
val filtered = renderTarget(width, height) {
colorBuffer()
}
val composite = compose {
draw {
drawer.fill = null
drawer.stroke = ColorRGBa.BLACK
drawer.strokeWeight = 350.0
drawer.circle(Circle(width / 2.0, height / 2.0, 650.0))
}
layer {
blend(DisplaceBlend()) {
}
draw {
drawer.stroke = ColorRGBa.WHITE
for (y in 0 until 50) {
for(x in 0 until 50) {
drawer.isolatedWithTarget(unfiltered) {
drawer.translate(x * 11.0, y * 50.0)
val o: Double = cos(seconds) * 0.35 + x / 0.01 - y * 0.01
filter.phase = cos(seconds) * 0.5
filter.decay = 0.168
filter.gain = cos(seconds * 2) * 0.5
drawer.contour(c.sub(o, o + 0.023))
}
}
}
}
}
}
extend {
filter.apply(unfiltered.colorBuffer(0), filtered.colorBuffer(0))
drawer.clear(ColorRGBa(0.0, 0.1, 0.6))
drawer.image(filtered.colorBuffer(0))
composite.draw(drawer)
}
}
}