Monday, 4 May 2009

Program in Flash, view in 3D

In the past we've used Flash to control an X3D plugin. It worked, but was kind of limited. With the O3D plugin literally everything is exposed to javascript, and as Flash can call javascript throught the ExternalInterface it follows that is it straight forward to control the O3D plugin from Flash.

(click and drag the white circle in the flash movie and it updates the position of the 3d teapot in realtime)

I've had some problems loading tgz in Firefox from my own server, not sure why yet. Offline everthing works fine in both Firefox and IE on Windows. If you have trouble viewing the demo, or just want to see how it's done the source files are here

UPDATE: By changing the file type of the .tgz file it can be loaded in FireFox and IE and the example has been updated to reflect this. Offline, it seems the file has to be a .tgz to function properly.

Friday, 1 May 2009

Google flips the 3D web's normals!

I couldn't resist starting with this geeky, 3d way of saying that Google have turned the 3D web inside out with the preliminary release of O3D, a new initiative to attempt to bring 3D to the web. But before you go thinking "heard it all before, yet another VRML clone" let us talk about why this time it might just be different.

In the beginning there was VRML, way ahead of it's time, and certainly way ahead of it's public. Then VRML 2.0, a vital update to keep the emerging standard on track. Then X3D, the xml version of VRML 2.0. And then... well it all went very quiet indeed. From what can be gleaned from the biographies of the various authours of VRML, they all went their seperate ways to start their own companies, implemented their own versions and the momentum of a single unifying standard was lost forever.
So what was VRML/X3D's biggest flaw? Well in my humble opinion it tried to do too much as a standard. Not content with encapsulating geometry, textures and animation, it tried to define interactivity and programming structure, so if you wanted it to do something, you implemented a node in the standard to make it possible. That's fine for the people actually in the position to get their ideas implemented, but for everybody else in the universe, it sucks. Hence the ever repeating pattern of the newbie 3D web programmer on discovering X3D:

this is great, this is great, this is easy, this is great, hey I've got an idea....(3 weeks later)... this sucks.

Wouldn't it be a good idea to make a format that actually mirrored the capabilities and internal working's of graphics hardware? Wouldn't it be great to be able to move data seamlessly from one 3d authouring platform to another? Enter COLLADA, a completely new religion.

This was a very different mandate to the VRML crowd, but it proved that if you provide something useful people will rapidly adopt it, and they did. So now we have a well defined format for transfering 3D data from one program to another. How you use that data is not the formats concern.
Well in that case you could just bolt on whatever programming technology/platform/console you fancy and you're away right? And even if you're a startup, designers and artists can create content for your platform straight away, without you having to build exporters, importers, etc. for every 3d authouring tool out there. Cool! (though you'll have to think up another business model than selling your 3D Studio Max export plugin)

PaperVision3D, ironically probably the most widely seen 3D on the web, even though it's actually running relatively slowly (but still amazing job lads!) on top of the flash 2D rendering engine. How can this be? Well because Flash rocks the boat of so many talented web designers and programmers. Is there a lesson here? Yes, give the developers what they want, and they will spread your technology like wild fire, even if it isn't necessarily the ultimate in 3D technology. Easy, open and *free* are always good start points when trying to introduce a new web program/technology/service, whatever.

What is the perfect recipe for 3D on the net?
  • Standards where standards are genuinely advantageous, i.e. transfering data from one application to another.
  • Freedom to interact with, effect and combine that data however you want to.
  • Free to use and develope for.
  • As cross platform/browser/device as possible, though not allowing the lowest common denominator to dictate everything (hey, developers can downgrade stuff if necessary, can't easily add stuff that isn't there!)
  • Good tools
So how does X3D stack up, and how about O3D?

Well, the first release of O3D has proven that it's not quite there yet as far as being compatible with every set-up, but there does seem to be a movement towards this. If you compare with X3D you don't have any single plugin for all platforms, and content programmed for one plugin won't run on another. Here google's advantage is to actually provide the plugin, free of charge, rather than leaving (random) implementation to others.

Tools. For content you can of course use existing 3d tools that can export Collada, which is all the main ones.
Programming wise you use your favourite javascript editor. If the idea of O3D catches on, there will surely evolve an ecosystem of editors, and whole game libraries as has been seen with Flash.

It would be a travesty to write this entry, or indeed anything about 3d on the web without mentioning Unity3D. Currently basking in the iPhone application goldrush, like Lewis Strauss before them they are providing the miners with the tools. I hope they achieve the same turnover :O)
Unity provide and maintain their own very excellent web plugin for Mac and Windows, but who knows, maybe they could provide the ultimate authouring tool for O3D games?