Friday, 29th May, 2009

I am OFF for 2 weeks

Filed under: Site News — dominique @ 02:49

Holidays here we come !!! :) :)

Remember, if you write a comment and it doesn't appear then it's stuck in my anti-spam mechanism. I will unlock them when I am back!

cya !!

Bookmark and Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Technorati
  • Digg
  • Reddit
  • Google Bookmarks
  • YahooMyWeb
  • Live-MSN
  • Facebook

Wednesday, 27th May, 2009

Simple DebugData output for the lazy Unity3D coder

Filed under: C# and Dot.Net, Unity3D — dominique @ 01:55

I am becoming a .Net/C# fan ;-)

With it's reflection ability, you can do some nice things. For example output all public data values of an object onto your screen. A little minimal example for Unity debugging/tweaking purposes …

Let's say we have two classes with public data we are interested in

    class MyDataOne : Object
    {
        public float AirDensityRo = 1.225f;
        public float LengthInMeters = 2156.33f;
        public float MetersPerSecond  = 2.0f;
    }

    class MyDataTwo : Object
    {
        public int Iteration = 0;
        public float Offset = 13.0f;
        public float Affinity  = 2.0f;
    }

We then save both instances into a list

List<Object> DisplayedDataObjects = new List<Object>();

void Start()
{

   DisplayedDataObjects.AddRange(new Object[] { new MyDataOne() , new MyDataTwo () });

(…)

 And in the OnGUI context you can draw the values for example like this

        (…)

        float yOffset = 15;
        foreach (Object obj in myDisplayedObjects)
        {
            yOffset += 5;
            GUI.Label(new Rect(5, yOffset, 240, 20), "== " + obj.ToString() + " ==");
            yOffset += 15;
            FieldInfo[] fields = obj.GetType().GetFields();
            foreach (FieldInfo field in fields)

            {
                if (field.GetValue(obj) != null)
                    GUI.Label(new Rect(1, yOffset, 240, 20), field.Name + ": " + field.GetValue(obj).ToString());
                yOffset += 15;
            }
        }

The nice thing is that you can rename (refactor) member names and classes without worries as changes will visible immediately. With the list you can also modify quite quickly in what objects you're actually interested in.

The reflection stuff is in "System.Reflection".

Bookmark and Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Technorati
  • Digg
  • Reddit
  • Google Bookmarks
  • YahooMyWeb
  • Live-MSN
  • Facebook

Monday, 25th May, 2009

Axis orientations from 3ds max to Unity3D (pt.1)

Filed under: Unity3D — dominique @ 01:34

Just a little note, mostly for that I remember it better in the future ;-) . Like Virtools, Unity's coordinate-system is Y-Up, unlike 3ds max where it's Z-Up.The Virtools exporter does all the conversion for you under the hood (except for Characters).

Looks like for Unity you need to pay attention. Currently my level in Unity is rotated 180 degrees around the up-axis, compared to the 3ds max scene. I realized that a bit late …  Anyways, for characters, car and the like one can do the following to get the same Z-Axis alignment as forward orientation in both applications:

Go into pivot-edit mode ("Affect Pivot Only" in the Hierarchy of the Command Panel) and rotate the pivot so that Z-Axis (blue) points forward, the Y-Axis points upwards and the X-Axis points to the side (left side). Then in the FBX export dialog choose "Z-Up" under "Axis Conversion". This way, it's very close to the Unity system - only the X axis is mirrored.

Bookmark and Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Technorati
  • Digg
  • Reddit
  • Google Bookmarks
  • YahooMyWeb
  • Live-MSN
  • Facebook

Sunday, 24th May, 2009

Rendering roads ontop of terrain in Unity3D

Filed under: Unity3D — dominique @ 04:13

I've already my roads most of the time hovering above the terrain but still sometimes the terrain temporarily "shines" through depending on distance and view angle. I guess it's due the terrain's LOD, so some polys might become higher than intended on some LOD levels.

Terrain and roads intersection

In Virtools there is something called "Render Priority": a per-object settings that can be adjusted in the hierarchy manager. It can help for these kind of situations. I was looking for something similar in Unity. The editor itself doesn't seem to have anything related but the shader framework, called ShaderLab, itself has.

So you have to download the built-in shader sources, and create a derivate. First I thought it's the SubShader RenderQueue-Tag, but that didn't had any visual impact. You have to adjust/bias the z/depth buffer value via the Offset state.

Less intersection due Offsetting the depth

In my case I went through the "diffuse" shader and added an "Offset -1,-1" to any spot where RenderStates where set. Like you can see from the image above, it helped a lot. Unfortunately it's not perfect, I am still having tiny but annoying cracks here and there when driving or flying along the roads:

still some small artefacts

I guess I've no choice and adjust further the terrain heights manually to get rid of them…

Bookmark and Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Technorati
  • Digg
  • Reddit
  • Google Bookmarks
  • YahooMyWeb
  • Live-MSN
  • Facebook

Tuesday, 5th May, 2009

Old Alias Research Videos and Mixed Reality

Filed under: Ergonomics and Usability, The World of 3D — dominique @ 02:25

When I recently read about something called "R-Screen" on Dassault Systemes blog "3D Perspectives", it reminded me of something I saw a couple of years ago.

R_Screen

R-Screen is a VR installation created with 3DVIA Virtools (VR pack) and is basically a rotating stereoscopic (rear-pro) screen that aligns towards the viewer based on head-tracking data. It allows to move around a virtual object which increases the feeling of immersion.

Something of similar purpose is Alias Research's "Boom Chameleon" from 1998/99 or so. You basically move a screen attached to a boom around it's center center like a window to the VR world. Nowadays with camera tracked markers, we have this even as Augmented Reality on portable devices! Interesting though how old these concepts are. Another demo shows a Mixed Reality example where objects are staged and affect a virtual scenario. This is called a Tangible Interface.

Alias_Boom Alias Staged Interface

There are a few more (old but interesting) videos online from Alias Research (they take a while to load).

Bookmark and Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Technorati
  • Digg
  • Reddit
  • Google Bookmarks
  • YahooMyWeb
  • Live-MSN
  • Facebook