Posts Tagged ‘3d’

Tuesday, September 28th, 2010

Unity 3 has been released.  It was released to the world late yesterday.  I have been using it for a few beta releases and it is very nice and many great improvements.  One awesome improvement is the occlusion culling was ported from iPhone to all Unity builds. Other notable features are a unified editor for all platforms, deferrered rendering and more.

Grab Unity 3 and take a spin.

Occlusion Culling Demo

Unity 3 Feature – Occlusion Culling with Umbra from Unity3D on Vimeo.

Thursday, July 29th, 2010

Pretty sweet web racing advergame for Disney’s The Sorcerer’s Apprentice by C4RL05, made with Unity. Carlos Ulloa is of course the same dude that made the Unity HelloRacer. He is also famous for starting Papervision3D for Flash but has been doing some amazing work in Unity for more immersive 3D experiences.

The game is another example of how when you need really immersive experiences for advergames or brands, Unity is looking like a great choice. Unity isn’t perfect for many things that Flash is such as video, 2d games, mixing media, mic/cam apps, and data, but for games where 3d is required it seems to be the way to go.

Friday, July 2nd, 2010

Unity is a great and agile company that responded to the iOS4 changes with something very nice, a C++ option to develop with the Unity engine on the iOS. They will implement this if using Mono is barred which so far hasn’t happened.  I have to say I wish this was an option for the Unity Engine all the time and hope they implement it anyways. For now Joachim Ante on the the Unity blog says this:

We continue to be excited about the iPhone, iPod touch and iPod as platform targets for Unity developers. While we don’t think C++ is the best language to write game code , using C++ as a scripting language has memory and performance advantages on low-end devices. This is a great feature to have for developers who want to squeeze the last ounce of memory & performance out of their games.

We still can’t believe Apple will force developers into choosing a specific language for development. And as mentioned, Apple is still approving every Unity-based game we know of. In case the situation changes, rest assured that we are working this Plan B.

We’ll be ready to talk more about this as well as share some time-line information with you soon, while of course waiting to find out if any of this will actually be necessary.

The Unity Plan B is that the C++ engine code that mimics as closely as it can to the Mono .net C# or Javascript code. From the samples on the blog the C++ and Mono (javascript in this case) samples are really similar.

Many current engines are legacy or have lots of bloat, unless you write your own, or maybe even still then. Though this is looking really clean for C++ game engine code, at least in comparison to current industry leaders for indie engines.

It would be a beautiful C++ library to use even if Apple doesn’t require it. Compared to the other indie game engines out this would be a sweet C++ engine for indies and hope they do this no matter. C++ can be written cleanly and with influence from a simplified C#/Javascript engine and clean API it makes for a killer C++ engine that makes sense. Right now native is really attrctive on embedded for some years to come.

A very basic comparison from their blog:

Javascript Sample

function Update(){
    //Spin the object around the world origin
    transform.RotateAround(Vector3.zero, Vector3.up, 20 * Time.deltaTime);
}

C# Sample

using System.Collections;
using UnityEngine;
public class Example  : MonoBehaviour {
    void Update(){
        //Spin the object around the world origin
        transform.RotateAround(Vector3.zero, Vector3.up, 20 * Time.deltaTime);
    }
}

C++ Sample

#include "UnityEngine.h"
class Example : public MonoBehaviour {
public:
    void Update() {
        transform.RotateAround(Vector::zero, Vector3::up, 20 * Time::GetDeltaTime());
    }
};

Things I am wondering…

  • Will this help porting to Android versions if they use the NDK?
  • How much smaller will my app be if I use the C++ version (attractive feature since the mono dlls are pretty big – even though I really dig mono)?
  • Wouldn’t a C++ version be a better base with pluggable scripting in C# if you want? Maybe an option for Lua with a similar API signature for all? Ok maybe over-engineering there…
Sunday, April 25th, 2010

A new Javascript 3D Engine that can render to Canvas and SVG has been released by mr. doob.

Mr. doob is a well known Flash developer that has added many great experiments and cool contributions without being stuck to one technology, making some great interactive projects in javascript, chrome experiments and html5 (canvas/svg) in addition to the work in Flash with toolkits like Papervision 3D.  Recently the Harmony html5/javascript sketching project generated lots of interest for an html5 sketching app.

Three.js is great because it is a 3d engine built with renderers in SVG and Canvas makes to a really good base for modular, cross platform 3d engine right now (as soon as IE9 joins the party). For a while a good javascript rendering library will need to support multiple renderers for browser differences in performance and supported dependencies like canvas, svg and webgl. Three.js has that reality as part of the design.

Currently the engine only supports particles and triangles/quads with flat colors. The aim is to keep the code as simple and modular as possible.

At the moment the engine can render using <canvas> and <svg>. WebGL rendering would come at a later stage but feel free to fork the project and have a go.

Although this allows 3D for iPhoneOS and Android platforms the performance on these devices is not too good.

Sample Code:

var camera, scene, renderer;

    init();
    setInterval(loop, 1000 / 60);

    function init()
    {
        camera = new Camera(0, 0, 1000);

        scene = new Scene();

        renderer = new CanvasRenderer();
        renderer.setSize(window.innerWidth, window.innerHeight);

        for (var i = 0; i < 1000; i++)
        {
            var particle = new Particle( new ColorMaterial(Math.random() * 0x808008 + 0x808080, 1) );
            particle.size = Math.random() * 10 + 5;
            particle.position.x = Math.random() * 2000 - 1000;
            particle.position.y = Math.random() * 2000 - 1000;
            particle.position.z = Math.random() * 2000 - 1000;
            particle.updateMatrix();
            scene.add( particle );
        }

        document.body.appendChild(renderer.viewport);
    }

    function loop()
    {
        renderer.render(scene, camera);
    }

Sunday, April 11th, 2010

iTween is a tweening kit for Unity that is in the same style as TweenLite, Tweener and others in the tween format that is common for flash tween libraries in Actionscript 3. This library is available in javascript and C# for Unity 3d Projects and is quite fast and solid.

iTween is a simple one file drop in for some great scripted animation and easing that is very reminiscent of Flash using Penner equations and common libraries so it is easy to get started. It works for web player, desktop and iPhone Unity (however long that lasts).

Some sample code looks like this:

private GameObject go;
private GameObject cam;

void Awake()
{
    go = gameObject;
    cam = Camera.main.gameObject;
}

private void Start()
{
    iTween.rotateFrom(go, 1.5f, 0, null, 90, null, iTween.EasingType.easeInExpo);
    iTween.moveFrom(go, 1.5f, 0, null, 3.5f, null, iTween.EasingType.easeInExpo);
    iTween.colorTo(go, .3f, 1.5f, 3, .5f, 1.2f);
    iTween.shake(cam, .8f, 1.5f, null, .3f, null);
    iTween.scaleTo(go, 2, 2.3f, null, 2, null);
    iTween.rotateBy(go, null, 4.3f, .5f, null, null);
    iTween.moveTo(go, null, 4.6f, null, 1.2f, null);
    iTween.moveTo(go, null, 5.8f, null, 0, null, iTween.EasingType.easeInExpo);
    iTween.shake(cam, .8f, 6.8f, null, .3f, null);
    iTween.colorTo(go, .5f, 7.6f, .165f, .498f, .729f);
    iTween.scaleTo(go, null, 7.6f, null, 1, null);
}
Tuesday, March 9th, 2010

Unity is showing no signs of slowing down in making a consolidated, easy pipeline for game developers and creators to bring their wares to the masses on the top platforms. Already Unity 3D is the best 3d web browser plugin at the current time with export paths to web, desktop (mac and PC), iPhone/touch and Wii. But now we will see support for PS3, iPad (obvious as it is a iPhone/touch) and Android (most likely with the help of the C++ NDK rather than the Java SDK).  XBOX 360 support was announced last year.

This is pretty huge even for such a small and innovative company. I guess it means it will be time to buy an upgrade soon. Unity so far has been giving feature after feature for free for current license holders, this one seems big enough to justify a major version increase.

Gamasutra comments on other great features:

This third iteration will also incorporate Umbra Software’s occlusion culling product, which is designed help performance for games with large, open scenes and complex geometry. The platform’s top-end version, Unity Pro, will include both Umbra and Beast at no additional cost.

Unity Technologies updated its Unity iPhone for version 3.0 to include streaming audio support for smaller build size, Bluetooth multiplayer support, faster in-game GUIs”, and a 2D sprite engine. Furthermore, the company’s iPhone product will offer performance improvements that promise to provide faster frame rates.

The company says that with its new platform support for PlayStation 3, iPad, and Android, it offers developers an opportunity to target a larger install base than any other game engine. Unity’s game engine currently can produce games for Windows, Mac, iPhone, and Wii, with support for Xbox 360 announced last October.

Friday, February 12th, 2010

Balder was one of the first 3d prototype engines in Silverlight and it has evolved quite nicely.  Balder by Einar Ingebrigtsen is described as a “Managed GameEngine with both 2D and 3D support targetting Silverlight, Xna and OpenGL.”

The sample browser will show you what Balder is capable of and it has come pretty far since the first version showing a wireframe teapot.

You know you’ve made it as a 3D engine when there are Augmented Reality apps for it.

Here’s a glance at what some of the C# source looks like for a feel of the engine code from the Silverlight4 TestApp:

using Balder.Core.Execution;
using Balder.Core.Objects.Geometries;
using System;
using Balder.Core.Lighting;
using Balder.Core;
using Colors=System.Windows.Media.Colors;
 
namespace Balder.Silverlight4.TestApp
{
    public class MyGame : Game
    {
        public override void OnInitialize()
        {
 
            Camera.Position.X = 0;
            Camera.Position.Y = 0;
            Camera.Position.Z = -80;
 
            var light = new OmniLight();
            light.Diffuse = Color.FromSystemColor(Colors.Green);
            light.Ambient = Color.FromSystemColor(Colors.Green);
            light.Specular = Color.FromSystemColor(Colors.White);
            light.Position.X = 0;
            light.Position.Y = 0;
            light.Position.Z = -130;
 
            Scene.AddNode(light);
 
            base.OnInitialize();
        }
 
 
        public override void OnLoadContent()
        {
            var teapot = ContentManager.Load("teapot.ase");
            Scene.AddNode(teapot);
            base.OnLoadContent();
        }
 
 
        private double _sin;
 
        public override void OnUpdate()
        {
 
            Camera.Position.X = (float)(Math.Sin(_sin)*80);
            Camera.Position.Y = 0;
            Camera.Position.Z = (float)(Math.Cos(_sin) * 80);
 
            _sin += 0.05;
            base.OnUpdate();
        }
 
    }
}
Wednesday, January 27th, 2010

Tim Knip, a papervision core developer, has brought a pipeline improvement for users of Blender to import blender files directly into papervision and as3. This allows you to get at the blender objects, or blender DNA as it is called, that construct the 3d scene within Blender.

Unity3D has a great workflow that includes this where you can update your .blend file and then it updates in the Unity IDE, this work by Tim creates a similar workflow for Flash (recompile would be needed to show if embedded).

Typically exporters are made from the 3d IDE SDKs such as Blender using Python to export to COLLADA or other formats.  But here Tim is parsing the source file directly.  This also opens up the possibility to make other exporters from more simplified Flash AS3 code rather than learning a new IDE SDK just for an exporter.

I am not sure how much people want to embed .blend files with their applications as there is more information in the .blend file for the Blender app and it will add to the download.  But what this might do it inspire others to create simplified exporters from Tim’s work for Blender to COLLADA, 3ds and more that work well with papervision and flash 3d engines, directly in Flash.  So instead of learning each IDE to build an exporter that is the same, this solution could act as a proxy or middle man to simplify exporter creation, pretty much any Flash coder that understands 3d could build one from .blend files at a minimum.  If it was made as a higher level abstraction so the 3d software source could be swapped out it may open up simplified exporter tools a bit.  Since it is really just reading the binary data in the file, in theory other formats could do the same (3dsmax, Maya, Milkshape, etc).

There is a whole host of opportunities with this new tool! It is definitely nice to have this as I use Blender for Flash 3D and Unity 3D most often.  It will be interesting to see how this evolves.

Note from Tim on the tool:

I created a library to read Blender files (.blend) directly. So no
more headaches with broken exporters!

Grab the code here:
http://github.com/timknip/asblender/tree/papervision3d

Here’s a first example:
https://dl.dropbox.com/u/438592/blender/PapervisionTest.swf

And its code:
http://github.com/timknip/asblender/blob/papervision3d/src/PapervisionTest.as

ASBlender is simply a library which reads *everything* in a .blend file. So in theory you could grab materials, animations, armatures, the works… But its up to *you* to grab the relevant bits, since *all* the data is accessible.

Of course: this means you need to study the .blend format, see
http://wiki.github.com/timknip/asblender/ for more information.

Sample Code Snippet posted by Tim:

[Embed (source="/assets/crystal_cube.blend", mimeType="application/octet-stream")]
public var BlenderData:Class;

var blend:BlendFile = new BlendFile();

blend.read(new BlenderData());

if (blend.scenes.length) {
    // Blender can have multiple scenes, don't know yet how to grab the "active" scene.
  buildScene(blend.scenes[0]);
}

/**
 * Prints out the DNA as contained in the .blend
 */
private function printDNA(blend:BlendFile):void {
  var struct:DNAStruct;
  var field:DNAField;

  for each (struct in blend.dna.structs) {
    var type:String = blend.dna.types[ struct.type ];

    trace(type);

    for each (field in struct.fields) {
      trace(field.type + " " + field.name);
    }
  }
}

private function buildScene(scene:Object):void {

  var obj:Object = scene.base.first;

  while (obj) {
    // grab the Blender Object.
    // The Blender Object defines rotation, scale, translation etc.
    var object:Object = obj.object; 

    trace("Object name: " + object.id.name + " type: " + object.type + " matrix: " + object.obmat);

    //for (var key:String in object) {
    //  trace(key);
    //}

    if (object.data) {
      switch (object.type) {
        case 1:  // Mesh
          trace (" - Mesh: " + object.data.id.name);
          buildMesh(object.data);
          break;
        case 10: // Lamp
          trace (" - Lamp: " + object.data.id.name);
          break;
        case 11: // Camera
          trace (" - Camera: " + object.data.id.name);
          break;
        default:
          break;
      }
    }

    obj = obj.next;
  }
}

private function buildMesh(mesh:Object):void {
  var numVertices:int = mesh.totvert;
  var numFaces:int = mesh.totface;
  var i:int;

  trace(" - #verts : " + numVertices);

  for (i = 0; i < numVertices; i++) {
    var v:Object = mesh.mvert[i];

    var x:Number = v.co[0];
    var y:Number = v.co[1];
    var z:Number = v.co[2];

    trace(" - - vertex: " + x + " " + y + " " + z);
  }

  trace(" - #faces : " + numFaces);

  for (i = 0; i < numFaces; i++) {
    var f:Object = mesh.mface[i];

    var v1:int = f.v1;
    var v2:int = f.v2;
    var v3:int = f.v3;
    var v4:int = f.v4;

    trace(" - indices: " + v1 + " " + v2 + " " + v3 + " " + v4);

    if (mesh.mtface) {
      // UV coords are defined
      var tf:Object = mesh.mtface[i];

      trace(" - - - uv: " + tf.uv);
    }
  }
}
Wednesday, December 2nd, 2009

If the question is if Unity can do interactives as smooth and stylish as Flash I think you may soon find out.  Carlos Ulloa of Papervision 3D fame has kicked it up a notch in Unity 3D with this interactive very reminiscent of the Ford Focus demo that helped bring in Papervision 3D for flash in style. Gotta say though a mini is much better than a Ford Focus.

Flash is still the leader in web interactives and even marketing interactive 3d, Unity largely replaced Director and tools like it and high-end hardware rendered required interactives and games. This interactive by HelloEnjoy has loads of polygons, unity physics system, lighting, environment mapping, showroom cameras, reflection, skid decals, highly detailed mesh and more.  Just take a peek inside the vehicle and at the rims for the detail that is impossible with the 2000 poly limit of Flash 3D software rendered engines.

Web interactives this heavy aren’t doable in a non hardware rendered player like Flash.  Unity is looking to pretty much own this level of quality in a browser.  I don’t think I have seen another interactive looking this good with Unity 3D.

Unity still is lacking many features that Flash has in support of making interactives for the web such as webcam support, mic support, better video support, better gui system, html support (although flash barely) and a larger install base but Unity could easily take the high-end advertising market in addition to owning highly immersive games that need hardware rendering which it is already doing for web gaming.  It is 2010 soon, most computers have a decent video card.  Put them to use!

Wednesday, December 2nd, 2009

If you are looking to get into Unity 3d coding/creating a book is a good place to start to get the full overview. Recently, the first Unity book has been released by Will Goldstone via Packt Publishing.

The book is written in a simple yet rapid pace but starts out from beginner level 3d introductions and really explores all areas needed to give someone the handrails to start tinkering on their own in the dark of their labs with Unity. The book explores an introduction to 3d (the biggest hurdle for most in moving to unity although it also does 2d), terrrains (terrains aren’t supported in iphone yet keep this in mind if those are your aims), moving players and cameras, collision detection with colliders and rays, working with prefabs, creating HUDs, creating menu screens and working with the the GUI system in Unity (which can be strange for people coming from flash with event based user interfaces), loading/instantiating objects in the 3d world, particle systems, physics and lots of examples and minigames showing off these areas.

The book is alot like Unity itself in that it gets up and running quickly, gives the tools to do some damage and then opens the door to developing with Unity. After you develop longer in a platform you learn how to dig deeper into all these areas including scripting to do lots of what the Unity Editor can do for you but there is so much to take in that a good starting point to catch onto is needed.  Unity Game Development Essentials, the first Unity book, fills that role easily.

I have been using Unity as a hobbyist then at work at a game company starting in 2007 since it started to invade and take over from Director in 2007 ish then infiltrating the Papervision 3D and flash 3D developers, even with that experience this book still did a great job of exploring the tools and is approachable for almost anyone with some basic scripting skills and a desire to make some creative stuff.

Even if you have been doing Unity for a while a book is always good to see techniques and support authors and community members that give back to help others learn. Pick it up! (Amazon) (Packt Publishing)

If you aren’t ready to make the leap to Unity just yet there is also a great book from Paul Tondeur called Papervision Essentials for 3D in Flash, he has also done some projects in Unity to Flash communication.