lighting

Lighting with Read Pixels (Composition by gtoledo3)

Author: gtoledo3
License: (unknown)
Date: 2011.04.11
Compatibility: 10.5, 10.6
Categories:
Required plugins:
(none)

This is a composition that takes the depth buffer from a QC scene, using the GL Read Pixels from GL Tools, and the color buffer, and composites them using a GLSL normal map shader (cwright's Normal Map Demo I). A normal map is derived from the depth image provided by Read Pixels, to create the lighting effect, using a custom CI patch.

One of the cool byproducts (to me at least), of doing this, is that it shows the "flat lighting"/non smoothed version of the QC scene when you read the actual Depth and convert to normals.

It used to be possible to read the color buffer using GL Tools Read Pixels; this broke in SL. So, this also shows how reading the depth buffer can still work, and how one can still get color by employing RII.

It does a pretty good job of painting pixels that should be occluded darkly. It's a sort of fragile setup, and it's possible to break it by changing it (eg. adding extra processing at different points, flipping various non-published params, layers, etc.).

CINormalMap_gt (Composition by gtoledo3)

Author: gtoledo3
License: (unknown)
Date: 2011.01.18
Compatibility: 10.4, 10.5, 10.6
Categories:
Required plugins:
(none)

This is a core image filter that takes a greyscale heightfield (bump map) image, and outputs a normal map, in the style of nVidia Normal Map Filter plugin for photoshop, or NMG.

This allows one to create greyscale imagery in Quartz Composer, run image through this filter, and generate normals that can be rendered in the GLSL shader. This example uses Christopher Wright's Normal Map 1.qtz as a rendering destination, to show how it works.

Normal mapping is used to fake the appearance of a higher poly mesh than is actually being used when using GL Lighting.

http://en.wikipedia.org/wiki/Normal_mapping

GL Lighting (Composition by gtoledo3)

Author: gtoledo3
License: (unknown)
Date: 2010.10.08
Compatibility: 10.4, 10.5, 10.6
Categories:
Required plugins:
(none)

This is a composition I came up with in the middle of setting up a shadow method (apart from the built in one) for QC.

I realized it was a pretty good display of some of the functions of the built in Lighting patch. The premise is this - one light is located in front of an object at z=1, another behind at z=-1. This lighting environment rotates around the object, along with a bisector. The composition utilizes a kind of dual box mode and a sprite mode for that.