| SPXL.TVblog | contactgallery | videoflash | processingmyspace | facebook

Category / Colour

spxlConeWheel 12 March, 2009 at 2:29 am

Processing sample: spxlConeWheel


View sketch page for source code.

I’ve been thinking about adding pointy bits to some 3D models, instead of making everything from boxes and/or spheres. Maybe still a bit boxy (eg a square pyramid), but maybe also some nice cones. I saw a while back that one of the geometry-creating modes was a triangle fan, which looked perfect for making cones and pyramids.

Clearly, having just one cone is n’t enough, so I made a spiky ring whcih went through various changes (with varying animations) until I arrived at this. I quite like it when the “cones” drop down to having only 2 sides,  so they are then just flat. Maybe a bit boring if just a triangle, but the arrangement of base-to-base cones here instead leaves a rather pleasant kite shape, reminding me of a blade, perhaps. When there are heaps of them – more than would at first seem sensible, a nice rippling/fluttering effect occurs. Overall it reminds me of an assignment I had in a class on colour to make a colour wheel – the name ConeWheel being a reference to that.

I’m surprised at how fast this runs in the P3D mode (faster than OpenGl in this case?), even with a seemingly large number of “cones”. It is more bright and cheery in P3D mode at any rate, and was chosen to allow posting to


Radial Gradient Array 28 November, 2008 at 6:08 pm

Processing sample: RadialGradient_mod_by_spxl

based on RadialGradient.pde by Ira Greenberg

Source code: RadialGradient_mod_by_spxl.pde

Here’s another Processing sketch I’ve been fiddling about with for more time than is probably reasonable… this one is just 2D, and, once again, based on one of the basic examples provided with the Processing Development Environment. The original program painted some nice circles with gradient fills. Just once. No animation or anything tricky. Looking under the hood I was curious about a comment that didn’t seem to reflect the behaviour of the code:

// hack to ensure there are no holes in gradient
// needs to be increased, as radius increases
float gapFiller = 8.0;

The gapFiller wasn’t changed anywhere, and the implication of this value is that 8 points are plotted per degree rotation around the circumference of each circle, regardless of the radius (note that one solid disc in the final image is generated by plotting successive rings of increasing radius). Anyhow, since the circumference is linearly proportional to the radius, I figured that replacing this constant with some other constant divided by the radius (of the current ring) would be a good idea. I ran the program a bunch of times trying to find the smallest such constant that seemed to produce “gapless” discs up to a reasonable size. I also played with the idea of interpolating the radius step (eg step by 0.5 pixels instead of 1 pixel per ring) with a reduced angle interpolation – by this method the number of plots can be reduced, but finding an optimum pair of values seemed like a pretty hit-and-miss affair and was never going to be as sensible as a properly optimised circle drawing algorithm anyway. Having int-based parameters to specify exact pixel locations seems “close enough” for this sketch, and reduces a fair amount of confusion!

I quickly became tired of having to wait for the entire scene to be rendered before getting to see any of it, so decided to replace the array-filling loops with a draw() method that produced only a single disc on each invocation, and effectively moved the loop outside that by using some global variables to keep track of where we’re up to. I also switched over to using radians directly instead of needlessly converting between degrees and radians all the time, and of course did away with the duplication of the angle calculation (in the original program, j and angle are almost the same, differing only in when they are incremented, and should effectively cover the same circle’s-worth of angles) and moved the colour calculation out of the angle loop, since the colour is the same for a given radius. I’ve also replaced the manual colour calculations with the colorLerp() function provided by Processing. Yay for easy. It does make me wonder, though, on what basis the examples provided are included. This example has quite a few problems!

I also decided it would be nice to space the discs out a bit, and then started becoming heavily involved with working out how to space the discs evenly, especially so that the gap between the discs was the same as the gap between the discs and the edge(s). From there I moved on to asking, what if I want the gap to be proportional to the size of the disc? What size should the discs be, and where should they be centred? Than further still, what should that proportion be if I want the area covered by the circles to be some proportion of the total area? (For this case I’m talking about the average coverage of a single square “unit”, where one unit can be formed as a square whose corners are the centres of four adjacent circles. That is, I decided the visual average over the majority of the space was important, not at the edges where I simply want uniform spacing, especially since, if the rectangle to be filled is not square, the spacing to the edges in the shorter dimension will mostly not be uniform with the rest of the spacing – instead the arrangement is simply centred, keeping the circle-to-circle spacing uniform). Eyes glazed over yet? ;o)

I’ve kept on with the theme of making the sketches interactive to some degree as well, so have inclded keyboard controls for various parameters. After much playing around, eventually getting away from annoying calculations for those obscure ratios and moving towards “what makes this fun and interesting to look at?” the sketch is now in it’s present almost VJ-able form… well, in a winamp visualisation kind of way, only I haven’t sussed out audio reactivity yet – guess what my next plans are? :o)


Blackle holes? 24 April, 2008 at 7:13 am

I’ve been reading about black holes recently, you know, those things that Hawking eats for breakfast, but Blackle is something else: a rebadged Google search, painted black “to save energy”, because the white background of the usual Google search pages uses too much power.

What the?.. Sounds like the kind of pseudo-scientific slight of hand or turn of phrase that might make the writings of the Saturday-morning-doorknocking witnesses on evolution (or lack thereof) seem plausible.

An LCD panel uses less power than an equivalent CRT (well, let’s say most of the time – there may be some extreme examples where this is not the case, but not that I know about). LCD = good. LCD screens work with a backlight – a white light behind the (sub-)pixels, which produce the coloured display we see by blocking some of the white light: if you block the red and the green, you’re left with blue. As a side note, now that I think of it, it’s ironic that this ‘emissive’ colour mixing property we typically associate with screens is, in a sense, actually an absorptive colour mixing technology! Perhaps it is better to think of it as transmissive, as opposed to reflective colour mixing (eg CMYK printing). Actually, though, the LCD’s white backlight is separated into red, green, and blue subpixels before the ‘liquid crystal’ part, so each LC cell only deals with one of red, green, or blue light, and it is our eyes that do the actual mixing (this is called optical mixing), such as is with pointillism or divisionism (chromoluminarism) of the impressionists in the art world.

An LED display (think big, like an outdoor display) has red, green and blue lights (maybe white as well), so is an RGB(W) display, for which one might expect having less lights on (ie more black and dark colours) to require less power. A LCD screen (such as in most laptops and most flat-panel displays) is, in a sense, a minus-RGB, or anti-RGB device, but does blocking the light take more or less power than letting it through? That I wasn’t so sure of, so I had a quick read of the technology behind LCD displays before keying the following message to Blackle via their contact page:

On LCD technology…

“The optical effect of a twisted nematic device in the voltage-on state is far less dependent on variations in the device thickness than that in the voltage-off state. Because of this, these devices are usually operated between crossed polarizers such that they appear bright with no voltage (the eye is much more sensitive to variations in the dark state than the bright state).”

Given that most (if not all) LCD screens are probably twisted nematic devices, and producing black on such a device requires application of a voltage (, then surely displaying black instead of white uses MORE power, not less.

I’m sure you are already well aware of this, so am wondering why you don’t just drop the pretending that black screens use less power.

Do you really just not give a shit and it is about making money from the advertising?

Excuse my French (and, to the French, excuse my English; I’m aware that swearing in French is so much more expressive) – a liberty taken as this Blackle caper is apparently Aussie (based in Sydney), and it only seemed proper to show some local concern.

With a little more reading I got to the part about ‘vertical alignment’ LCD’s, which are black in the natural (no voltage applied) state. At this moment I don’t know if that is common, as compared to the opposite voltage requirement suggested earlier as being the most common. It is doubtful that I’m the first person to have such musings (maybe if I now go and do a search… just to, you know, save some energy). I’m supposing it is similarly doubtful that I will receive a particularly meaningful reply. If you ask me, using a bunch of computers (Blackle’s) to process and re-serve search results that have already been provided by a bunch of other computers (Google’s) sounds like using more power than any perceived, perhaps even imagined, display wattage saving.

Meanwhile, on the subject of black holes, I’m currently confused by the notion that a black hole is something that exhibits extremely high entropy. Evidently I wasn’t paying enough attention at some point… If an ice cube has lower entropy than the ice cube when it is melted (water), how can something even more dense, more localised (the probability of a particle being found far off in the universe), less able to change its arrangement with respect to the particles around it (er… this is a pretty vague assumption, given that things are supposed to be ‘weird’ in a black hole!), have higher entropy? Sneaking a peek just now on Wikipedia, I read,

Jacob Bekenstein and Stephen Hawking have shown that black holes have the maximum possible entropy of any object of equal size. This makes them likely end points of all entropy-increasing processes, if they are totally effective matter and energy traps. Hawking has, however, recently changed his stance on this aspect.

Hmm… I don’t know/understand Hawking’s original stance, nor his new one, but it’s nice to know I’m not the only one that isn’t so sure! :o)

-subpixel (subtractive-RGB!)