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.


DanAtPanache said...

Hey Peter, sorry for an off-topic comment here, but I didn't see any contact information for you.

I saw your "shirty" demo of applying lighting to a 2d bitmap in Flash based on a normal map, using PixelBender. Wow - this is awesome, and something I've been wondering how to do for a long while now.

Do you have any plans to release this shader for other people to use? I would absolutely love to get my hands on it for a game I've been toying around with.


Daniel said...

Hi Daniel, seems ur contact details are also a mystery ;)

Send me a mail: ps at videometry dot net

I will do a tutorial on normals at some point, don't seem able to find the hours right now. It's actually quite a simple technique when you know how. First you need a 3D program that can render normal maps (I use 3D Studio MAX and a normal shader I found at

Then render two versions of your video or still image. One with a neutral, ambient lighting, the other with normal mapping.

In flash combine these in a pixel bender shader taking into consideration the position of a fictive light source. That's it!

The pixel from the normal map gives you the direction of that pixel, where r,g and b are x,y and z.

Mail me, I'll send you the sources

DanAtPanache said...

This sounds great! I sent you an e-mail to the address above and appreciate the explanation.

Post a Comment