Core Image Rotate?

jersmi's picture

I'm exploring a nice core image filter by cwright that creates arcs. This comp animates the circle generating from 0 to 360, but there is a "wobble" at the start point. How can I get rid of the wobble?

PreviewAttachmentSize
CIArc000.qtz11.58 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

monobrau's picture
Re: Core Image Rotate?

This is the one I'm using, also from cwright, no wobble.

PreviewAttachmentSize
circular slider.qtz11.82 KB

cybero's picture
Re: Core Image Rotate?

Try using an LFO [instead of Interpolation] hooked up to a Smooth.

A 'smoother' result ensues, jersmi, :-) .

cybero's picture
Re: Core Image Rotate?

That is a really neat solution [from cwright, posted again by you monobrau :-)].

Like it more than my solution [posted whilst you posted yours, which is why I picked up on this latterly].

jersmi's picture
Re: Core Image Rotate?

That's really good.... Thanks so much.

jersmi's picture
Re: Core Image Rotate?

Wondering about antialiasing the edges of the circle(s) produced by this patch. Is there a way to incorporate smoothstep into the Core Image code?

cwright's picture
Re: Core Image Rotate?

@jersmi at 2011-04-15 22:00 #LoL #anachronism #kinemeistwitterific #linearrepresentationofnonlinearoperations

If you use the version with the toolsonair tweaks, and you only need to antialias the circular edges (not the angle edges), you can simply divide alpha by 2.0 (or more, or less, for more or less softening). Softening the angle edge is a bit trickier; if you need it, let me know and I'll try to sort something out.

Worst case, you can change how it evaluates to calculate corner colors (instead of pixel-center colors), and then blend. this is horribly expensive, but might actually work and might look better (though I'm not entirely convinced...)

jersmi's picture
Re: Core Image Rotate?

Thanks, Chris. Yeah, I can't see how to remove the black edges here. Turning off sprite depth testing helps, but of course then there's no depth. The angle edge here is also obviously an issue. Any advice appreciated.

PreviewAttachmentSize
CIarc_aliasing.qtz14.49 KB

gtoledo3's picture
Re: Core Image Rotate?

Using a box or gaussian blur at a really low value might not be too bad. (GPU Gems 2, ch. 22).

jersmi's picture
Aliasing Issue

Well, simply inserting a blur at low value between CI Arc filter and renderer doesn't work. Blurs the colored area, leaves the black jaggies intact. Screenshot shows a gaussian blur with a value pushed up to demonstrate the issue.

Edit: I'd love to know what is actually happening here.

PreviewAttachmentSize
Screen shot 2011-04-16 at 11.57.07 AM.jpg
Screen shot 2011-04-16 at 11.57.07 AM.jpg64.41 KB

itsthejayj's picture
Re: Aliasing Issue

Ah my core image filter we adapted from cwrights that I posted a while back! Good to see it being used. Sorry i can't be any use in the topic it was written by my old parter in crime (i'll see if he can chime in), i just built compositions with his core image patches :)

R.I.P bestbefore tv :(

gtoledo3's picture
Re: Aliasing Issue

Oh... Sorry, I didn't see what you were doing.

What is the problem is the order of drawing inside of the iterator - that's what's causing the edge funk.

Inside of the iterator, when you draw in Z, values need to progress back to front (n/a here, but I'm going somewhere with this...).

In your composition, you're drawing a bunch of stuff at exactly the same place Z... I'm not sure if there technically is depth. I guess Y ordering needs to happen going positive to negative inside of the iterator to not do that thing on the edges, in the case that everything is the same place in Z and there's overlap (after some experimentation).

This doesn't look exactly the same because of the progression of shapes, but it's the basic thing.... changed the Y ordering, and then turned off that transparency/alpha.

PreviewAttachmentSize
CIarc_aliasing__.qtz14.5 KB

jersmi's picture
Re: Aliasing Issue

Awesome. Thanks, George. In combination with this solution, Chris' suggestion to divide the alpha in the filter works to minimize the angle seam. Even though dividing alpha brings back jaggy edges, the black edge is gone, so now maybe a little blur and all is well. Great!

gtoledo3's picture
Re: Aliasing Issue

Oh dude, I'm a dud.

I wasn't getting that you wanted to close that as well.

I haven't examined it super closely, but I think there's something awry with the radians to degrees conversion, in terms of how it works with CI...maybe something with 0 values not getting accounted for appropriately somewhere, maybe not. It's technically correct looking, but maybe there's something funky w/ Core Image (a bug?) or it's expected and obscure to me why it should be expected.

Here's a parameter that should close it for you by shifting the degrees by 1. Hope it works on your end.

(... and I thought I was going to take a nap! The power of the movie "The Firm" in spooking me into being non-tired is amazing...)

PreviewAttachmentSize
CIarc_aliasing__-1_w_close.qtz15.04 KB

jersmi's picture
Re: Aliasing Issue

That's a better solution, which seems obvious now that you post it. Thanks again.

gtoledo3's picture
Re: Aliasing Issue

It does kinda seem obvious as a workaround, but at the same time it's pretty counter-intuitive that has to happen to get it to close, and I do wonder if it isn't a bug.

I haven't thought it through well enough to 100% say it's a bug, but it's surprising to me, at first glance, to have to do that. I feel like it has something to do with Core Image 0,0 pixel origin stuff and it convoluting the radians to degrees, but that's just a guess. It feels like the CI math is actually off in the way it handles this, but I'm hesitant to say that for sure.

Thanks for posting the question actually.

jersmi's picture
Re: Aliasing Issue

My original posted comp instead of idlefon's better solution might demonstrate the issue in a more pronounced way. Seemed like it could be a number resolution issue in how radians gets converted to degrees.