Shaded Material Core Image patch

cybero's picture

The Shaded Material patch


Produces a shaded image from a height field. The height field is defined to have greater heights with lighter shades, and lesser heights (lower areas) with darker shades. You can combine this filter with the CIHeightFieldFromMask filter to produce quick shadings of masks, such as text.

The resulting image can be used as a backdrop, texture, illustration, whatever.

I have found no CIHeightFieldFromMask filter anywhere :-).

That apart, this patch does a pretty tidy job and has huge scaling range on the shadings produced. I like it. I have found though that it sometimes acts up under certain construct conditions.

These always include that the image being presented to the patch are resized and that size is congruent with the size of any image input into the OpenCL kernel routine creating one part of the two image inputs into the Shaded Material patch.

However, these same conditions also apply within those constructs that work without fail. The more that the noise texture image being used changes, say through a multiplex or a movie, the more likely the snarl up is with the Shaded Material patch.

Just wondered if anyone else had found this a useful patch and if they had any insight as to why it can seemingly unpredictable, cause a graphics related crash. It's as id the resize doesn't actually stick and causes a leak. No OpenCL leaking, just mentioned as being part of the construct.

shadedci.png714.58 KB

Comment viewing options

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

cybero's picture
Re: Shaded Material Core Image patch

Well the CIHeightFieldFromMask showed up again in my Patch Library, must have been some sort of cache related problem.

Resizing image cuts out most crashes , but the amount of resizing required now seems to be the crucial stumbling block, unless I'm much mistaken.

gtoledo3's picture
Re: Shaded Material Core Image patch

That sounds really odd. I do remember that there is something counter-intuitive about what you have to enter in the search field for that patch.

As far as crashes go, I've never had a crash result from this patch.

This is the Apple provided example on how to use these patches is @ /Developer/Library/Quartz Composer/Examples/Patches/Shaded Material.qtz

I've used it quite a bit. one example.

However, apparently Vimeo has done some kind of retro-encoding on this after the fact, which is giving it this horrible blocky side effect to the upload. It didn't look like this when it was originally uploaded. Irritating.

cybero's picture
Re: Shaded Material Core Image patch

I think the crashes were directly related to the inclusion of a vertex displacement routine being fed a wide range of image sizes not being resized to a particular reference.

That's a nice example video BTW.

I too have found vimeo to block up otherwise finely detailed textures . Most of the time it does a good job of streaming a fairly faithful version of the original upload, which in itself is a couple of steps removed from how the composition renders in QC itself.