Unity3D vs. Three.js
Why is this important knowledge? You may be looking into both options as whether you're planning to build online games, a plugin for your website, etc. Unity3D and three.js are certainly both great options that can accomplish similar things but definitely very different. I've fortunately been able to dip into both a bit. Hopefully you'll find this useful...
Unity3D
Unity is a 2D/3D full out game engine with a complete visual editor/level designer, networking/multiplayer support, physics system, particle system, post effects GUI and more. Unity's strengths are it's productive workflow (to be able to build something pretty substantial quite quickly) and it powerful capabilities.
It has an easy to use and lean user interface and component system. It also takes care of most of the heavy lifting when dealing with game development. You could even potentially make working game without touching any code but that's not to say it's customization ability doesn't run deep and any commercial game would always take advantage of it.
Having said that, when doing anything 3d there is a certain amount of functionality that you'll need to deal with at one time or another and having that available if you need it is a huge asset. That's why Unity is also a great tool for building 3d apps or visualizations as commercial game engines tend to be over prepared for doing anything 3d even if it's not a game.
About Unity3D
Most of it's user base codes in C#. Here is a good indicator of the percentage of languages to users. Unity to date has been run on the browser as a plugin but as of Unity5 there is the added capability for deploying it as an html 5 webGL application. One may ask how this is accomplished if webGL is javascript based and Unity is built using C/C++ and runs off of other non webGL related scripting languages?
It's an interesting process. Basically everything gets compiled into c++ then converted into javascript with a few other steps. This came to them with the help of someone at Mozilla. The results though are surprisingly good.
Here is a good video that explains the background behind it:
Some things to consider in terms of weaknesses may be that it may be overkill if you plan on just making an interactive 3d object on your website for example. In order to develop for it, Unity must be downloaded and installed along with Visual Studio (with the .net framework) or MonoDevelop.
Also in terms of interacting with a web page, it is possible but you'd have to go through unity's exposed functions whereas three.js would easily have access to the DOM, other javascript on the page, etc.
Additional information on Unity3D
Been around since
2005
Users
Unity is a full out gaming platform with nearly 2 million active users across the world.
Code base
Unity3D is scripted using C#, Unityscript (modified javascript) and Boo (a language I’ve never heard of until using Unity).
Support
Lots of online articles videos and documentation out there for this.
Usage
Unity3D is used mainly for games but can be used for 3d visualizations or web applications
Platforms
PC, Mobile (BlackBerry 10, Windows Phone 8, Windows, OS X, Android, iOS), Web (via plugin or webGL), Consoles (PlayStation 3 & 4, PlayStation Vita, Xbox 360 & One, Wii U, Nintendo 3DS and Wii)
Cost
personal addition is free, pro version starts at $75/month
Three.js
Three.js is a javascript based webGL framework that runs right from the browser and integrates well into existing website code.
I’d say it’s more of a framework than an engine. It handles things like mouse events, shadows, rendering, post effects, vertex processing, shaders, etc. and takes car of most of the “hard stuff” involved in webGL programming. You can make something like a 3d product configuration site without having to worry a lot about the two things that have slowed down 3d for the web in the past: browser support without a plugin and hardware acceleration. It really shines as a lightweight library that can bring some powerful real time 3d effects to web pages.
Food for thought… It was first developed in ActionScript then ported to JavaScript in 2009. Initial development consisted of Ricardo Cabello,?Branislav Ulicny and? Joshua Koo. There are now over 390 contributors.
This video by Jaume Sanchez Elias at JSConf Budapest 2015 has some great examples of it’s capabilities:
Downsides? I'd say that since it's still has somewhat early in development and it's open source, is still some work to be done in terms of documentation and code base.
The framework it's self is changing rapidly and because of that, it can be difficult to commit to building anything really major on it until the the code reaches more of a consistency in terms of what to expect. There are already a lot of engines built on-top of the framework but since it's changed so much, they've tended to branch it off in their own direction somewhat. Also, since it's not really a full fledged engine there's nothing but a limited editor at the moment to work with so making something like a AAA game using just three.js without an engine would be quite a challenge.
Additional information on Three.JS
Been around since
2010
Users
Three.js is gaining traction. It’s much newer than Unity but and there are no statistics that I know of stating the amount of users, but I’m guessing it’s somewhere in the thousands.
Code base
Javascript. But there is an interesting optional layer called tQuery for those who would like to use a jQuery style workflow
Support
Not as good. Again, it’s gaining traction in terms of blog articles, book and videos, but the official documentation still needs a bit of work.
Usage
Any web browser that can run webGL (almost all browsers as of this time). It’s designed for the web so it wouldn’t be something that’s downloaded an installed as an app or PC game for example
Cost
open source! (MIT License)
Hope that helps. They really are both great platforms from my experience. It all depends on your needs. I’d say for lack of a better example, you could think of Unity as a train and three.js as a car. Unity is bigger and heavier but once it get’s going, it can carry a lot. Three.js is less equipped, but is convenient and easy to get in and out of.
For more tutorials on getting started in three.js you can find some tutorials here.