“Fun” with Flash
I bought a copy of Flash Pro a couple of days ago (or rather my company did). Our main business is based on QuickTime VR panoramas, and I decided it would be useful for us to have a Flash viewer. Beware: this gets a bit technical and boring for most people, but there is a pretty example.
Edit: I just realised that I have consecutive posts entitled “Ming” and “Flash”. Hehe. Retro joke.
There are many Flash panorama viewers out there, but they all look crap to me. Mainly this is because they don’t remap the panoramic images. When one creates a panoramic image, it needs to be projected so that a 3D scene can be represented as a flat image. This is the same principle as how a map of the globe can have different projections to represent a sphere as a flat image. Our panoramas (along with most others) have a cylindrical projection, which means the view is represented as if you were standing inside a cylinder. This is the same as most maps.
Anyway. Most flash viewers just use the flat image, and let you slide it around. This looks wrong. Most people will see it and know something’s wrong with it, but won’t be able to say what exactly. The thing that is wrong is that the image is not re-mapped to our view. This can be seen most obviously by the way that straight lines are curved, and there is no proper perspective at the edges of the view. Remapping an image involves some maths, which I won’t go into here, suffice to say it involves polar geometry.
I haven’t used Flash for years, and then only for making animations. I’d never really used Actionscript, so it took a bit of getting used to. I wasn’t sure if it was able to handle remapping an image in real-time, but some features in Flash 8 make it possible. It has a thing called DisplacementMapFilter, which seems to mostly be used for making water or glass effects. I’ve used it here to create a ‘lens’ that remaps the image. It’s just a proof of concept at the moment, and the mapping isn’t quite right yet, but I’m pleased with the result so far.
Click on the grey bar to toggle the filter. Notice how lines are more curved when it’s disabled.
The view is of a show apartment from a development that has the dubious claim to fame of being at the centre of a minor scandal involving Cherie Blair a year or so back.
August 30th, 2006 at 1:54 am
I want!