quartz composer @ daisyrust.com

quartz composer is a visual programming tool from apple. Here ian grant shares compositions, code, ideas and tutorials relating to this fantastic tool.

Quartz Composer and the Nintendo Wii Remote – QCWii a demo application » read article

posted by ian grant on February 12, 2007 at 3:14 pm | in cocoa, mac development, physical computing, quartz composer, software | 3 comments

Download Application: qcwii_v0.1.zip
Download Source Code: qcwii_v0.1_src.zip

QCWii is an application that lets a user connect a Nintendo Wii Remote to the mac and control a simple teapot.

It is a proof of concept for a digital puppet controller. The final project controls a face – where the mouth is real-time video and the eyes a pre-recorded video loops that can be controlled from the wii remotes buttons. Please see the following website for more details and the project write up.

Link: http://ellington.tvu.ac.uk/ma/computer-arts-major-project/
Qcwiimainscreen


Qcwiimainscreen Pref 01 Pref 02 Pref 03

The source code demonstrates the following:

  • how the darwiin-remote framework can be used to control a 3D model in a simple Quartz Composer patch.
  • how cocoa bindings work connecting UI elements, code and published keys from a quartz composer patch.
  • a crude ‘full screen’ mechanism.

Many thanks to Jasen Jacobsen for advice on how to make the animation smooth and to Hiroaki for the ‘Darwiin-Remote’ framework and project.

Link: http://sourceforge.net/projects/darwiin-remote/

Usage

To connect to the Wii Remote: press button 1 and 2 on the wii remote so the lights flash, then click ‘Connect with wii remote’ on the preference pane:

Pref 01

To activate sensor tracking: click ‘Track Motion Sensors’ on the same preference pane.

That should be it. Most of the buttons on the Wii are connected to do something in the Quartz Composer composition – if only signal a connection to the patch.

  • The cursor pad moves the object, left, right (x axis), forward and backwards (z axis).
  • Buttons 1 and 2 rotates the object around the Y axis.
  • + and – scale the object.

It is acknowledge that both scaling and translating on the Z axis is probably not as useful as moving up and down.

To exit full screen mode – press SHIFT – F on the keyboard.

Some Additional Information if you wish to edit the Quartz Composer Patch to do something other than move a teapot around

To find the QC composition:

ctrl-click on the QC-Wii application ‘view package contents’ and dig down to ‘resources’ that is where the QC patch – wii_to_qc.qtz – lives. You can (carefully) edit that composition to do something different other than trigger the text display and move the teapot… Just don’t change the name of any of the root level published port ‘keys’:

crucial published keys that bind the patch to the wii remote via the application
Image: The crucial published keys that bind the patch to the wii remote via the application. Do not change the published name of these – or the application will break
If you edit that composition, save it. Then when you re-launch the application, it will use the edited composition as it’s source.

This way you don’t need to use xcode or re-build the application.

The qc patch needs to run inside an application wrapper. The application handles all the blue-tooth connection wizardry provided by the wiiremote-framework, the calibration preferences etc and toggling full screen. So you can’t simply edit the composition and preview it using Quartz Composer itself and expect the WiiRemote to connect.

Ian Grant January, 2007

ian [dop ] grant [at ] mac [dop ] com

Controlling Quartz Composer with Speech Commands » read article

posted by ian grant on October 11, 2006 at 10:44 am | in creative code, digital art hacks, general, quartz composer, speech | no comments

First draft:

Here we go! I did this once then failed to remember how I did it – and I’m not surprised – because the functionality to attach a speech command to an application specific key-press can only be accessed by SPEAKING the command “Define a Keyboard Command” – highlighted below in the Speech Commands window. (more…)

Quartz Composer Video Matrix » read article

posted by ian grant on August 10, 2006 at 10:54 pm | in moving image, quartz composer | 1 comment

Here’s a screenshot of a demo patch that tiles an image (still or video) onto a user selected number of tiles. The rows/columns tiles can be fixed or animated. Three test patches are available for download.

Download link: quartz composer video matrix test files 001 – 003

Quartz Composer Screenshot 001-1

Notes: These are patches in development and (except patch 001) need some tidying – the published parameters are slightly out of order on 002 and 003, but you should get the principle from patch 001.

I have been wanting a patch that does this for a while and these are really just a proof of concept and may not be the most elegant solution. There are some limitations.

Limitations
The number of X tiles (columns) can be determined interactively. Unfortunately at the moment, the number of Y tiles is fixed. If you wish to add a row you must edit the contents of the “3D Transformation” patch and add new copies of the highlighted patches (indicated below), edit that names of published keys, plumb them in (following the pattern of the others – at this and the parent level) and set the Y position of the new row. Pain. But okay if you know what size of matrix you need.

qc screentshot

For convenience, there is an image source that switches between camera input, images and a couple of movies – you will need to remove my movies and add your own.

Development – motion detection / computer vision
I have an idea (maybe wrong) that a static matrix like this could be used as the starting point for a motion detection / camera vision thing. Imagine if you processed the video (desaturate, detect outlines for example or use the “flood fill” that appeared on the quartzcomposer-dev list recently) and had something like a kernel that could sample each cell in the matrix and output a value or a boolean dependent on the white / black balance. I don’t think the core image kernel in quartz composer can output anything other than an image – but a kernel possibly can when used in core image in a cocoa application. Interesting.

Download link: quartz composer video matrix test files 001 – 003

tiger reflections – quartz composer patch » read article

posted by ian grant on February 10, 2006 at 9:14 am | in creative code, graphics, quartz composer | 2 comments

tiger reflections icon

Download: tiger_reflections.qtz.zip

A Quartz Composer patch that will automatically produce a cool, adjustable reflection from an image, text or video input. The style is familiar from Tiger applications, particularly “Front Row” and Keynote. It is a visual style echoed across Apple’s branding and is slightly cooler than a simple drop shadow.

Control Parameters

reflection parameters

Most are self explanatory but here are some notes:

Color: this controls the background, the ‘fade to color’ of the reflection gradient and the ‘fade to color’ of the block that fades the reflections
Gradient Point 1 and 2: This numbers control the falloff / distance of the reflection The numbers relate to the size of the image measured in pixels. To get recommendations on what values to use select Gradient Advice.

Currently the recommended values are calculated like so:

Gradient Point 1: image height (px) / 1.7
Gradient Point 2: image height (px) * 1.5

Gradient point 1 should be smaller then Gradient point 2. Gradient point 2 should be around the height of the image – but different effects can be achieved by varying it. Likewise, increasing Gradient point 1 from 0 increases the brightness of the first part of the reflection – creating a nice controllable reflection fall-off.

In a cocoa application the reflection gradient parameters could be more usefully mapped to a couple of sliders. If a simpler interface is needed, you could hard wire the ‘recommended’ values into the relevant inputs.

Gap: Makes a gap between the reflection and the image. This improves the illusion that the image is sitting on a surface.

To Do
- with a little effort the patch could be used in a cocoa application or, I think, converted to an image unit for use in other applications.

- thorough testing of how images with alpha channels work.

Key Quartz Composer Techniques
- mask and alpha manipulations.
- blending modes

qc stereoscopic recorder 0.1 » read article

posted by ian grant on February 5, 2006 at 9:31 pm | in cocoa, creative code, quartz composer, software | 1 comment

qcstereoscopic recorder icon

Download Application: QCStereoscopicRecorder 0.1 (Universal Binary) OS 10.4 required

Download Source: QCStereoscopicRecorder 0.1 Source (4.0mb)

QC Stereoscopic Recorder is my first Cocoa app! It is part of my work towards an MA in Computer Arts. The app is a component of a larger project called “Anamorphica” in a class called “Experimental Digital Media”. Further documentation of this project will appear over the next few weeks. Basically, I am aiming to make a low-cost open source anaglyph recording and ‘performance’ system.

To use it you will need two firewire cameras.

Performance is improved if each camera comes in on a separate firewire bus. To effect this, I use a Lacie firewire PCMCIA card in my G4 laptop.

I needed a simple application that would capture dual camera input, export to quicktime and make an anaglyph.

I have included “stereo-pair” generation. Stereo-pair generation will come into it’s own when the application can handle full-screen and dual monitor support. Then I may create a ‘Wheatstone’ device (see http://www.stereoscopy.com/library/wheatstone-paper1838.html).

QCStereoscopic Recorder would not have happened if it wasn’t for the wonderful “Quartz Composer”. Easy and a joy to use. As I am learning Cocoa and Objective-C, the project is indebted to sample code and open source initiatives.

  • demo code from Apple – QCTV / Pierre-Olivier Latour
  • the wonderful “Sparkle” by Andy Matuschak (www.andymatuschak.org) handles software updates from within the applications.

To Do

  • full screen mode
  • improve image contrast quality
  • fully implement Apple help
  • export print resolution single frames
  • implement VJing style performance control

Notes

  • Built as a universal binary – untested on Intel
  • tested on PPC – 10.4.4

Have fun!

early recursive anaglyph experiment made with qc stereoscopic recorder
early recursive anaglyph experiment made with qc stereoscopic recorder

« previous page

(cc) ian grant some rights reserved