blender web plugin

Out-of-date warning...

Also the updated article shown below is now several years old! I only checked links and marked them as broken when putting it online (again) in 2007.

This is an updated and partly rewritten version of an article I wrote for blender.org, and which has been published there (link now broken!) on October 17th 2002. It has been enriched with some new content, links to other information, and incorporates some of the comments users made on the article at blender.org

The blender web plugin

I only made it to the conference in Amsterdam for Saturday afternoon, but nonetheless I managed to participate in three sessions. One of them was about the future of the web plugin, held by Maarten Gribnau.

In this article I want to give you some reasons for continuing the plugin development, outline what we talked about during the session and tell you why blender really sticks out from the masses when it comes to portable web 3D.

One of the questions that came up during the session was: Who needs this? Is there a use for the plugin? Is it worth it? Yes! Let me tell you.

Using the plugin?!?

There are a lot of possible uses for 3D on the web. True, the real killer application still needs to be come up with and all the 3D web hype, the talk about VRML (or lately X3D) and friends pretty much disappeared. But still...

One of the problems with VRML (or 3D in general) might have been the lack of good content. Why did HTML succeed? Everyone can create a web page, you need nothing more than a text editor. But VRML? Sure, you *could* write that the same way, but honestly - what can you expect then? 3D is complex, so one needs a good tool for creating content. With blender you get that for free, so this could make a difference.

So what? Where to use it?

  • Information systems for buildings or fairs
  • Presenting your newest product in 3D
  • Embedding 3D in MS Office (remember, it's ActiveX as well)
  • A revolutionary navigation on websites
  • Or architecture
  • As an alternative to Flash
  • If you come up with a good idea maybe even advertising or porn
  • Maybe just art, for the sake of it, as pointed out by greasyScott:

I recenly attended an event on Machinima and Transformative Play at the Dig.It Festival here in Minneapolis; or look at http://www.machinima.com/.

Something that has been around in game culture for quite a while is the creation of cinema using a game engine's record feature. These are short movies about gamers by gamers for gamers. They've hacked into Quake and Half Life to create entertainment. Quite ingenious but lacking greatly in story or plot development. However, tons of people watch these movies.

Having very little exposure to level creation and building skins for FPS games I can only assume that making these game movies would be exceedingly easier with Blender. What's more, as the popularity of these types of movies increase, Blender could be on the forefront of its explosion into the mainstream.

  • Or, as has been pointed out in some comments on this article, online gaming. Online gaming might be a profitable market, as code2663 wrote:

The real killer app for this is online gaming. It's not a new idea, but everyone has just noticed it again. There are something like 40 or more MMRPG games currently running for PCs and Macs on the internet. The largest of those, Everquest, states in a recent article in games magazine EDGE that they have a subscription base of over 400,000 users.

All the games consoles are just launching broadband interfaces so that they can take advantage of the online gaming market.

The one common thread with all these games is that the player/member of the gaming public has little or no control of the creation of the world, but has to play in a fixed, dictated environment.

What is needed is the development of a multiplayer/MMRPG backend and construction kit that utilises the plugin for the client-end and builds on the already excellent blender creator for the develpoment environment.

That way you can:

  1. Provide the tools for people to create games in a persistent multiplayer world
  2. Allow the players the same access to the tools that the developers have and let the playes help design their own world (this policy has worked very well in a single player RPG environment for Morrowind: The Elder Scrolls)
  3. Take advantage of a key and rapidly expanding market in time for it to become readily accessible (Recently published stats from Gartner group on www.zdnet.com suggest that broadband will have large scale take up in the next 3 or so years. By that point it will be hard to buy a game that isn't (massively) multiplayer)

The final reason why? Also from the latest issue of EDGE. For the first time the games industry has a larger turnover than that of cinema and video put together. Games are big business and sooner or later, it'll ALL be online.

...

Oh, and for online games that work, look at Warhammer Online, Neocron, Phantasy Star Online (link now broken!) 1&2, Halo etc. And having broadband makes one hell of a difference too...

  • Or, for the more serious among you, education.

    This is a field that slipped my mind when writing the original article, but I added it as a comment to it. There are a lot of projects revolving around e-learning, virtual classrooms and such things, as well as producing course material on CD. All those could benefit from the possibility to have interactive 3D content, be it for physics simulation, biology, computer classes, art education...

    And as pointed out by certron, there were a lot of people talking about using the Quake II engine for educational purposes (DNA was used as an example) due to the software render capability, the scripting support, and ... and ... well, i don't remember, but blender has those, too.

  • And finally quoting kayakdog24:

Here is an additional point of interest for Blender component. I work for a company that develops motion controllers for soft-tool (plasma, oxy, waterjet) cutting. I was seriously considering using Blender as a visualization tool for a multidimensional (6+ degrees of freedom) plasma cutting control right up until NaN went under. And Blender was definitely stacking up very good against many alternatives available on http://www.componentsource.com.

Unlike other components blender:

  • did not require OpenGL or DirectX knowledge
  • it came with it's own content editor
  • and it was powerful enough to carry some of the functionality inside while getting some data from the outside via python libraries.

I believe Blender component should be extended to make such an integration even simpler and in addition to that if used as an ActiveX component as oppose to source code, Blender component can be used in commercial systems.

A case study

I once worked on a university project having the goal of developing a building information system. We had a model of the buidling made with Microstation, and wanted to use a 3D room metaphor to link to various information about this building. Microstations VRML export sucked (20 MB data, and of no use), and building the model from scratch with a dedicated VRML editor was no alternative (aside from us not having one). So we decided to use a commercial product from a company named RealiMation (link now broken!). That could be used within Microstation to export the model to a stripped down (removed duplicate vertexes and meshes, etc.) version which could be displayed using their proprietary RealiWeb browser plugin. That worked fairly well.

But we needed to call links from within the model. It turned out we could click on an object in the export tool, and add a link to it, we even could call JavaScript from within the model. But we needed to do this manually for each and every object we wanted to link from. Now think about a system with more than just one room...

So we spent quite some money, time and thinking for a solution that we could present on a conference at Stanford University (which was great fun!), but besides that we didn't gain much.

How comes blender into play here?

With blender, all this could be a bit easier, especially now, since it is open source. We could have built or imported the model into blender. Maybe give each of the important objects an unique name once. And then write some Python to check the named objects against a database, and create a link if there is some data associated with it. Should be doable, no?

And after you have done this, you could even call blender from the command line, and have it update the links if need be. This automation would otherwise only been possible by learning yet another proprietary language (a variant of Java plus yet another API) used inside Microstation. If at all.

With the blender plugin you could even go further and make it highlight objects in the 3D view, when you click on them in a list on the web page. Wow!

So this should be at least one more good reason for continuing to work on the plugin. Read on if you want to learn about the current status of the plugin.

Where does the plugin stand?

What I learned from the session (read: from listening to Maarten) is this: The plugin is basically the standalone blender player, with some wrapper code to make it into a browser plugin. There are two APIs one needs to support nowadays: ActiveX and the Netscape API (link now broken!).

As soon as you have this working, you get all the improvements in the blender engine for free, just recompile and you have a new plugin. Of course there are issues (Python must be sandboxed, versioning, etc.) but mainly this is it.

So, what do we have? The plugin runs, it can be used on Windows and Linux. It runs in MSIE and Netscape, as well as Mozilla (with the exception of LiveConnect, see below) and friends. On Windows you can emebed the ActiveX component in Office documents (and more). It has (almost) all the features of the standalone blender player. This is indeed a good starting point for the future.

Browser issues

The ActiveX thing is easy, the API is nicely designed. Not too many big problems on this way. The Netscape API is horrible, compared to that. This is why the NS plugin took longer to develop, and never was as stable as the IE plugin. Anyway, if you want to support Opera, Mozilla, Konqueror, ... you need it. Or?

Actually the vast majority of plugins using the NS API still work, but most of those using LiveConnect broke. LiveConnect was the way to make your plugin scriptable through JavaScript, something very useful for some plugins (including the blender). But this doesn't work any longer in Mozilla versions later than 0.9.2 (and Netscape later than 6.1). Why? The main reason for this is that there is no guarantee of Java compatibility on a binary level due to the jri/jni switch. You can give that back to your plugin, this is explained in Scripting Plugins in Mozilla. If you want that to work in both directions, read Bi-directional Plugin Scripting as well. There are few more things to read at http://www.mozilla.org/projects/plugins/

Sound like there must be a better way to write plugins for Mozilla. Maybe you heard about XPCOM already, the component cross-platform component object model developed for Mozilla. I didn't really dig into this, but it seems as if all of you would like to hack away on the plugin in the future should read at least chapter 8 of Creating Applications with Mozilla. There even is a Python binding for XPCOM called PyXPCOM...

Maarten told us, that there were discussions about dropping support for the NS plugin, and focus on the ActiveX development. I strongly disagree, and hope you follow me in that thinking: With blender having it's roots in the Un*x world, seeing many of it's users use Linux or MacOSX, and the momentum Mozilla is gaining, this would be a step back. Especially since the blender plugin (even though it was labeled beta for Linux) was better working than any VRML viewer I have ever seen on Linux.

Think about AOL and CompuServe flirting with Mozilla. This alone would give a huge user base. And if blender would be one of the earlier applications to make use of XPCOM to create a (really cool) plugin, we might even talk them into including the blender plugin in the default Mozilla packages, like Flash. Sounds good, eh?

And eventually the remaining browsers (Opera and friends) will adapt to that new API as well...

Conclusion (sort of)

There were some other issues brought up in comments to this article on blender.org. One mentioned that the plugin was too big, weighing in at 1 M. I looked into my Mozilla plugin dir, and this even shows 4.2 M for the blender plugin. But hey, the RealiWeb plugin mentioned above is a download of 3.9 M, think about what blender brings in a download that size... Anyway, there might be ways to improve this.

Someone mentioned that using 3D in education is hard because of the lack of computing power. Well, at least I see onboard Nvidia chips even on the cheapest motherboards. Wait a bit, and this will spread even wider. After all, what we are talking about now needs some time to be developed...

Anyway, let's see how far we (you) get with compiling this beast. Then make the physics part work again. And if the plugin keeps working in it's current way - fine. If not, don't worry. After a while hopefully there will be some people with the time and knowledge to actively maintain it again, maybe port it to XPCOM, and enhance the plugin's feature set (mainly JS scriptability). Given the progress that has been made in the short time after the source release, I am very confident!

And Maarten said he would gladly help anybody wanting to work on the plugin to get a grip. He worked on the ActiveX version of it, and sure knows the ins and outs. Raymond de Vries is another developer involved the plugin development. Might be good to look at his Web Browser Plugin (link now broken!) part of the NaN documentation as well, it has some more notes on options and problems.

If time has come, I'll sure be there to help with testing and whatever else I can do. Hope you will be there as well.

About the author

Karsten Dambekalns studies media science and computers at the Technical University of Braunschweig and co-owns a small company named fishfarm netsolutions specializing in dynamic internet sites and related technologies.

He likes to climb, is married to a beautiful woman and wishes he could use blender more often...