Showing posts with label 3D. Show all posts
Showing posts with label 3D. Show all posts

Friday, 25 June 2010

A 3D Mandelbrot

Skytopia have a great set of pages on the search for a 3D version of the Mandelbrot Set. Or at least, for an interesting 3D version of the normal Mandelbrot.

It's easy enough to produce fractal solids that have a Mandelbrot on one plane, and if you plot the correct 3D shadows of the 4D Julia Set, you can find shapes that have Mandelbrots on multiple intersecting planes. But getting a Mandelbrot on two perpendicular intersecting planes, while having the transition between them being more interesting than simply spinning or rotating the thing on its axis, is more difficult.




The "normal" Mandelbrot has one "real" component and one "imaginary" component, set on the x and y axes. If you add another imaginary component on axis z, you simply get the sort of boring "spun" shape that you might produce on a lathe. If you distinguish the two "imaginary" axes by whapping a minus sign in front of one of them, you get a hybrid Mandebrot/Tricorn solid, but one of the cross-sections is then a tricorn rather than a 'brot.

From here, you can try hypercomplex numbers, number systems that support multiple distinct imaginary components and define how they should fit together. In a simple hypercomplex system, we have four components, r, i, j and k — “r” is real, i and j are identicallly-acting roots of minus one, but i-times-j gives a third creature, k, and k-squared gives plus one. So we can plot r, i, j to get a 3D Mandelbrot. Trouble is, as Skytopia point out, it's a bit boring … if we look down on the 'brot's side-bulbs, they show up as simple nubbins. There are other way to try to force Mandelbrot cross-sections, but they're a bit arbitrary, and the results tend to look like someone's cut them out of a block of wood using a Mandelbrot template.


Paul Nylander (bugman) then started looking at higher-powered counterparts of the Mandebrot, and realised that the boring hypercomplex solid for z^2 actually got pretty damned interesting when you jacked the power value up to eight (z^8). This gives a gorgeously intricate beast now referred to as a Mandelbulb, with bulbs that spawn bulbs all over the place. It also has Julia-set siblings. But it's not a standard Mandelbrot.


So what else? Well, the “standard” hypercomplex number system isn't the only option. There are alternative systems that give multiple imaginary components with slightly different interrelations. There are quaternions (tried them, didn't like them), and there are other potential configurations and a larger overarching system of eight-parameter octonions. The Mandelbrot-based solid at the top of this blog was made with one of those. The internal shape is also slightly reminiscent of a Buddhabrot.

The semitransparent voxel plot above isn't really able to show the shape properly, you can see there there's some fine floating ribs that connect some of the Mandelbrot features on the two planes that aren't being adequately captured by the plot, so I'll have to run off a larger version at some point, and perhaps experiment with some colour-coding. Some of the more exotic detail, like the floating network of ribbing, might also be an artefact of a technique I used to emphasise surface structure in the plot, so I'll need to spend some time playing with the thing and working out how much of the image is “proper” 3D Mandelbrot detail, and how much is an additional fractal contribution from the enhancement code.

But meanwhile … pretty shape!

Sunday, 28 March 2010

3D Audio, and Binaural Recording

Binaural recording: NIH 'Virtual Human' head cross-section, Neuman KU100 'dummy head' binaural microphone (inverted image), Sound Professionals in-ear microphone (left ear)

One of the dafter things they teach in physics classes is that because humans only have two ears, we can only hear location by comparing the loudnesses of a sound in both ears, and that because of this we can only hear "lefty-rightiness", unless we start tilting our heads.

It's wrong, of course: Physics people often suck at biology, and (non-physicist) humans are actually pretty good at pinpointing the direction of sound-sources, without having to tilt our heads like sparrows, or do any other special location-finding moves.

And we don't just perceive sound with our ears. It's difficult to locate the direction of a backfiring car when it happens in the street (because the sound often reflects off buildings before it reaches us) ... but if it happens in the open, we can directionalise by identifying the patch of skin that we felt the sound on (usually chest, back, shoulder or upper arm), and a perpendicular line from that "impact" patch then points to the sound-source.
For loud low-frequency sounds, we can also feel sounds through the pressure-sensors in our joints.

But back to the ears ... while its obviously true that we only have two of them, it's not true that we can't use them to hear height or depth or distance information. Human ears aren't just a couple of disembodied audio sensors floating in mid-air, they're embedded in your head, and your head's acoustics mangle and colour incoming sounds differently depending on direction, especally when the sound has to pass through your head to get to the other ear. The back of your skull is continuous bone, whereas the front is hollow, with eyeballs and eyesockets and naso-sinal cavities, with Eustachian tubes linking your throat and eardrums from the inside. You have a flexible jointed spine at the back and a soft hollow cartilaginous windpipe leading to a mouth cavity at the front, and as sounds pass through all these different materials to reach both ears, they get a subtle but distinctive set of differential frequency responses and phase shifts that "fingerprint" them based on their direction and proximity.

To make the colouration even more specific, we also have two useful flappy things attached to the sides of our heads, with cartilaginous swirls that help to introduce more colourations to sounds depending on where they're coming from. Converting all these effects back into direction and distance information probably requires a lot of computation, but it's something that we learn to do instinctively when we're infants, and we do it so automatically that  – like judging an object's distance by waggling our eye-focusing muscles – we're often not aware that we're doing it.

The insurance industry knows that people who lose an external ear or two often find it more difficult to directionalise sound. Even with two undamaged eardrums, simple tasks like crossing the road can become more dangerous. If you've lost an ear, you might find it more difficult working on a building site or as a traffic cop, even if your "conventional" hearing is technically fine.

Binaural, or 3D sound recording:

We're good enough at this to be able to hear multiple sound sources and pinpoint all their directions and distances simultaneously, so with the right custom hardware, a studio engineer can mimic these effects to make the listener "hear" the different sound-sources as coming from specific directions, as long as they're wearing headphones.

There are three main ways of doing this:

1: "Dummy head" recording

This literally involves building a "fake head" from a mixture of different acoustic materials to reproduce the sound-transmission properties of a real human head and neck, and embedding a couple of microphone inserts where the eardrums would be. Dummy head recording works, but building the heads is a specialist job, and they're priced accordingly. Neumann sell a dummy head with mic inserts called the KU100, but if you want one, it'll cost you around six thousand pounds.
Some studios have been known to re-record multitrack audio into 3D by surrounding a dummy head with positionable speakers, bunging it into an anechoic chamber and then routing different mono tracks to different speakers to create the effect of a 3D soundfield. But this is a bit fiddly.

2: 3D Digital Signal Processing

After DSP chips came down in price the odd company started using them to build specialist DSP-based soundfield editors. So for instance, the Roland RSS-10 was a box that let you feed in "mono" audio tracks and it'd let you choose where they ought to appear in the soundfield. You could even add an outboard control panel with alpha dials that let you sweep and swing positions around in real time.
Some cheap PC soundcards and onboard audio chips have systems that nominally let you position sounds in 3D, but the few I've tried have been a bit crap, their algorithms probably don't have the detail or processign power to do this properly.
At "only" a couple of thousand quid, the Roland RSS10 was a cheaper more controllable option for studio 3D mixing than using a dummy head in a sound booth, and Pink Floyd supposedly bought a stack of them. There's also a company called QSound that do this sort of thing: Qsound's algorithms are supposed to be more based on theoretical models, Roland's based more on reverse-engineering actual audio.

3: "Human head" recording

There's now a third option: a microphone manufacturer called Sound Professionals had the idea that, instead of using a dummy human head, why not use a real human head?.
This doesn't require surgery, you just pop the special microphones into your ears (making sure that you have them the right way round), and the mics record the 3D positioning colouration created by your own head's acoustics.
The special microphones cost a lot less than a Neumann KU100, and they're a lot easier to use for field recording than hauling about a dummy head – it's just like wearing a pair of "earbud"-style earphones. The pair that I bought required a mic socket with DC power, but I'm guessing that most field recorders probably provide that (they certainly worked fine with a Sony MZ-N10 minidisc recorder).
Spend a day wandering around town wearing  a pair of these, and when you listen to the playback afterwards with your eyes closed, it's spooky. You hear //everything//. Birds tweet above your head, supermaket trolley wheels squeak at floor level, car exhausts grumble past the backs of your ankles as you cross a road, supermarket doors --swisssh-- apart on either side of you as you enter.
"Human head" recording isn't quite free from problems. The main one is that you can't put on a pair of headphones to monitor what you're recording, real-time, because that's where the microphones are: you either have to record “blind” or have a second person doing the monitoring, and you can't talk to that person or turn your head to look at them (or clear your throat) without messing up the recording. If you move your head, the sound sources in the recording swing around in sympathy. Imagine trying to record an entire symphony orchestra performance while staring determinedly at a fixed point for an hour or two. Tricky.
The other thing to remember is that although the results might sound spectacular to you (because it was your head that was used for the recording), it's difficult to judge, objectively, whether other people are likely to hear the recorded effect quite so strongly. For commercial work you'd also want to find some way of checking whether your “human dummy” has a reasonably "standard" head. And someone with nice clear sinuses is likely to make a better recording that someone with a cold, or with wax-clogged ears.
Another complication is that most people don't seem to have heard of "in-ear" microphones for 3D human head recording, so they can be difficult to source: I had to order mine from Canada. 

Media

For recording and replaying the results: since the effect is based on high-frequency stereo colourations and phase differences, and since these are exactly the sort of thing that MP3 compression tends to strip out (or that gets mangled on analogue cassette tape), it's probably best to try recording binaural material as high-quality uncompressed wav files. If you find by experiment that your recorder can still capture the effect using a high-quality compressed setting, then fine. The effect's captured nicely on 44.1kHz CD audio, and at a pinch, it even records onto high-quality vinyl: the Eurythmics album track "Love you like a Ball and Chain" had a 3D instrumental break in which sound sources rotate around the listener's head, off-axis: if you look at the vinyl LP, the cutting engineer has wide-spaced the tracks for that section of recording to make absolutely sure that it'd be cut with maximum quality.

Sample recordings

I'd upload some examples, but my own test recordings are on minidisc, and I no longer have a player to do the transfer. Bah. :(
However, there's some 3d material on the web. The "Virtual Barber Shop" demo is a decent introduction to the effect, and there are some more gimmicky things online, like Qsound's London Tour demo (with fake 3D positioning and a very fake British accent!). When I was looking into this a few years back, the nice people at Tower Records directed me to their spoken word section where they stocked a slightly odd "adult" CD that included a spectacular 3D recording of, uh, what I suppose you might refer to as an adult "multi-player game". Ahem. This one actually makes you jump, as voices appear without warning from some very disconcerting and alarming places. I'm guessing that the actors all got together on a big bed with a dummy head and then improvised the recording. There's also a couple of 3D audio sites by binaural.com and Duen Hsi Yen that might be worth checking out.
So, the subject of 3D audio isn't a con. Even if the 3D settings on your PC soundcard don't seem to do much, "pro" 3D audio is very real - with the right gear, the thing works just fine. It's also fun.

Friday, 19 March 2010

Virtual Lego


Someone's finally come up with the "killer application" for VR and computer-augmented reality.

It's buying Lego.

You walk into a participating Lego shop, pick up a box of Lego, and walk over to the big screen. A video camera shows you your image. You hold out the box in front of you, horizontally, as if you're holding a tray.

The software sees the box, recognises which product it belongs to, and calculates the exact position of the box corners in three dimensions.

It then retrieves a 3D computer model of the assembled Lego model from its database, and projects a virtual reality image of the completed masterpiece onto the screen as if the completed Lego masterpiece is sitting on top of the box clutched in your little sticky hands.

You rotate the box, and on the screen, the 3D model rotates. Tilt the box and it tilts. Move the box around and you get to see the final Lego construction from different angles, complete with perspective effects.

Oh, and the computer-generated Lego image is also animated. If it's a garage, the little Lego cars scoot about, if it's a building, the little Lego people are wandering about doing their own thing, "Sims"-style, and if its a tipper truck, the truck drives about the top of the box, tipping stuff.

It's very, very cool.

Sunday, 20 December 2009

The Tetrahedral Triple-Helix

Tetrahedral triple-helix, Eric Baird 2009Mathematicians playing with geometrical solids tend to concentrate on the finite ones. Those provide a nice satisfying sense of closure, and they're cheaper to build with straws and pipecleaners than the infinite ones.

This is an interesting shape that doesn't fall into that category. It's a simple rigid stack of tetrahedra that generates a "column" with a triple-helix. The odd thing is, you'd expect an architect somewhere to have already used this on a structure somewhere ... but I don't recall ever seeing it.
Maybe I missed it.

The sequence rotates through [~]120 degrees and [nearly] maps onto itself every nine tetrahedra (that is, the tenth [nearly] aligns with the first). If you want to follow one of the spiral arms through a complete [~]360-degree revolution, that takes 9×3=27 tetrahedra, (#28 corresponds to #1) .

Oh, and it has a hole running right down the middle.

I'll try to upload some more images in another post.

Friday, 2 October 2009

The Michael Jackson Continuum

Grid of interpolated 3D heads of Michael Jackson, FaceGenHere's what happens if you take three single images of Michael Jackson - one as a kid (probably some time around "Rockin' Robin"), one during his "Thriller" period, and one when he was doing odd stuff on balconies – turn each one into a FaceGen head, and then use the program's ageing and tweening settings to generate a set of intermediate heads.

The three original heads are top left, centre, and bottom right. The rest are tweened and age-tweeked extrapolations, courtesy of FaceGen.

You should be able to get much better results than this with a more representative set of photos. A more useful source picture taken between the "Jackson Five" years and "Thriller", would have been handy, but the otherwise-usable ones that I turned up on the net all seemed to be in monochrome. :(

"Bottom left" is what FaceGen extrapolates for Michael Jackson as a fifty-something-yearold with no plastic surgery, top right runs the process in reverse, working backwards from the last picture. The rest are intermediates.

Saturday, 21 February 2009

My Favourite 3D Fractal

It's this one:


3D fractal solid, z^2, rear view3D fractal solid, z^2
3D fractal solid, z^2

It reduces to the Mandelbrot Set on one plane, and to the "Tricorn" or "Mandelbar" fractal on another. And there's a stream of self-similar solids emanating from the main pointy bit.

I don't only like this fractal because I don't know of anyone else having found it before me ... okay, perhaps that is a contributing factor ("It's MY fractal, Miiiiiine!"), but there are other fractal solids in the same series and I don't like those nearly so much. And according to my YouTube stats, neither do other people.


Now, if only I had access to a high-resolution 3D printer ...

Friday, 20 February 2009

Edible 3D Fractals

If you're into fractals, you've probably already heard of the Romanescu.

It's a relative of the cauliflower, and it produces a spiralling cone made up of smaller spiralling cones, which in turn are made of of smaller ... well, you get the idea. Imagine a pinecone, where each segment is a protruding mini-pinecone, composed of segments that are also mini-mini-pinecones, and you have some idea of what a romanscu looks like, up-close.
Oh, and they're a livid shade of green.

romanescu
romanescuromanescuromanescu

If M.C. Escher had designed a vegetable, this would be it.

You might now be tempted to track down lots of awfully pretty artsy photos of romanescu on the net. I'd advise you not to bother. Instead take a trip to your local chi-chi supermarket and buy some, for real.
I got a pair for about one pound fifty, at the local Waitrose. They're awfully cute, they're much more fun to stare at in real life than someone else's photo, and when you eventually get bored with them, you can eat them!

Steam them, or wet them, cover them and shove them in the microwave for a couple of minutes.
They taste a little like cauliflower. Cheese sauce is optional.

Monday, 16 February 2009

Summer Glau

Summer Glau
Here's an odd thing. I added a "Summer Glau" head to the collection at relativitybook.com, and it struck me ... if anyone runs this software, their PC will be pretending to be an actress, who is pretending to be a robot, which is pretending to be a human.

You know that you've reached a certain level of technology when things start to get this complicated ...

Saturday, 14 February 2009

Curvature is Important

Curvature allows us to comprehend views of reality that can't otherwise be seen, or appreciated without an understanding of a few basic principles. Curvature allows connections and interrelationships and juxtapositions that you may find it impossible to see if you don't have the necessary mind-set.

This doesn't just apply to theoretical physics, mathematics and abstract logical structures. it also applies to real life.

Let's suppose that we're signwriters, and we have a famous department store as a client. They'd like an impressive curved sign over their main entrance, proudly displaying their name. Wouldn't it be awful if we neglected to take into account how that curved set of letters looked from different angles, and accidentally built a sign that said a Very Rude Word?

At this point you're probably remembering the fictional Great Big Sign in Douglas Adams' "Hitchhiker" series ... the one built by Sirius Cybernetics that when collapsed to half its original size, spelt out the message "Go stick your head in a pig" ... you're probably thinking that I'm about to describe some tortured hypothetical example that would never really happen in real life ... some crazy laboured combination of store name and typeface and sign geometry that would be so improbable that it'd never ever happen.

And so, sceptical reader, I invite you to examine this real-life department store sign:

T.J. Hughes store, sign, front

It's for a store called T J Hughes. Naturally, above the store's entrance we see the words T J HUGHES proudly displayed, in large red capitals. It's on a corner, and the letter sequence follows the curve.

If we turn the corner, cross the road, and look back at the sign, we still see the final “S” facing us, and to its right we see in white, slightly shrunken by perspective, the reversed white backsides of the letters H, J and T. Unfortunately, the letter J is very narrow, and the curved base of the letter is out of sight. So the J looks like an I, and although the H and T are seen reversed, they're symmetrical and still look like a perfectly normal H and T.

At this point you should be able to take a wild guess at the problem.

Here's the photo:

That's right. Seen from the right, the sign above their storefront really does say

T.J.Hughes sign, unfortunate angle, spelling out a rude word

Unfortunate, no?


This isn't a doctored photograph. The shop is real, and the sign has been there for an awfully long time. Here's the store's website, its location on Google Maps and their wikipedia entry. This really happened.

Like the title says, curvature is important. Ignore it at your peril.

Saturday, 31 January 2009

Computer-generated 3D faces, FaceBank, FaceGen

I initially added the FaceGen page to the relativitybook.com website as a bit of fun, but it's quickly become the most popular page on the website. It seems that - strangely enough - a lot of people out there find Angelina Jolie to be rather more interesting than gravitomagnetic field theory.
Angelina Jolie, rendered using FaceGen Zhang Ziyi, rendered using FaceGen

So I've spent some time adding more sample 3D faces. There are now more than fifty of them, and I've put up a separate "face bank" page for browsing them, http://www.relativitybook.com/CoolStuff/facebank.html . There's also some jerky video on the ErkDemon YouTube channel.

Some of the sharper-eyed visitors will have noticed that apart from Albert Einstein and Barack Obama, all the faces are female. Personal preference. I suppose that I really ought to grudgingly do a few more male faces at some point, just to make thing look more balanced. One or two. Maybe.

If anyone wants to leave any feedback or comments, you can do it here, on this blog page.

Now, see if you can work out which slider to move to make Barack Obama's ears waggle ...