Archives

All posts by Dom

I already reported about prior attempts. Now one of the Unity developers uses his "do-what-you-want" Fridays to experiment with a visual scripting system.

Unity VLE proto

That 'development experiment' is currently called "Visual Logic Editor". You will notice that it's purely event-driven plus it contains low-level logic-components. Thus it looks more in the style of Crytek's Flow Graph and maybe a bit like Unreal's Kismet.

This kind of system are also used a lot in procedural content generation like found in .werkkzeug, mapzone/substance air and genetica. Or for Shader creation like with ShaderFX or mental mill.

Virtools hierarchical graph works quite differently as data and program flow are modeled separately – Kismet seems a bit like like a hybrid in that area, but as I never tried I don't know for sure. I hope at one point VLE at least goes in the direction of encapsulated hierarchical flows, because otherwise it may become quite messy with growing logical complexity – most systems add that at a later point anyways.

Example of how messy a Flowgraph can look like (found on the web):

Messy Flowgraph

The key for visual scripting system are hierarchical ones. It's like a LOD – level-of-detail system or programming functions/methods plus it facilitates re-usability. Personally, I prefer modeling state-machines that defines behaviour with these kind of of hierachical visual-scripting systems, as you can *look* at the relations and patterns. In code it's not that visible at a glance, in my humble opinion – even when using Co-Routines.

Rant mode: on.

I just read that somebody again has been condemned to 3 months jail for sharing 15 songs. This makes me sick. The finance industry in co-operation with governments burned trillions of dollars, trillions !!! And not just money from one industry sector … no … from entire nations ! Everybody, due the bailouts activities, is involved. And did they all go into jail? Surely not. They even got plenty of additional cheap money and made even more fortune. So who is criminal? Who doesn't stop throwing false data to the public in order to justify actions or new laws?

So where are our highly celebrated values? Western societies are shifting them to all the time to match their likes.

Imagine you want to open your mouth, create some sounds that encodes information that you want to be picked up by another ear for that your thought ends up in being copied into another mind. Quickly, your eyes scan the face of the other person in order to anticipate the response. Now imagine each time you do this, your credit card gets charged for technology and "IP" license fees! Or:

"I'm sorry, you can't say 'hello' to the other person. You have a license of the concept 'greetings' but the other person has not not and the license is not transferable!" D'oh !

Communication needs to copy information and communication is the base of all. Imagine a water molecule that connects to a license server in order to prove it has a valid license to swing to the incoming wave!

I totally understand that creative people need to earn money – I really do! And therefore we need a good – BUT NEW – solution!

The old concepts are biased. The globalization is ok for finance, production and tax-optimization, but sharing your music CD with your  neighbor (who might be on the other side of the world) is suddenly not! Yes, the Internet connects us to plenty people around the world – this is very different than before and a different aspect of "Globalization"! How did they say? "You can't stop it – it's just like it is." Hah! But then they declare all kind of stuff illegal – where is the difference in "their" globalization and the information and community globalization?! Where?!

I just recently saw an interesting speech. Don't remember who that was – maybe from the "Joel On software" guy. 10 years ago, most companies tend to hide their knowledge, hoping to profit even more from it. Nowadays people share their knowledge and help each other. What a productivity boost!! Your code-compiler spits around an error, that you haven't ever seen before? Google it and often you find the solution within minutes, instead of doing research for hours! And it's not just for coders, people help each other in the forums on all kind of topics! That's a real added-value on a society level!

So while it's totally fine to exclude 'toxic' financial papers from bank's balance, it's totally illegal to share digital (copyrighted) content with others. It is said, that the estimated damage due file-sharing is in the millions – maybe even a few billion. In contrast is the real, verified damage of the legalized, irresponsible gambling on the finance-market which is in the trillions!!!!!!!!!!

I once talked to a hotel manager. Hen told me that with 15 minutes each day in front of the computer and the internet, he is able to save 2 full-time employees which he needed before. Every heard of somebody talking to you how his productivity has been boosted by "new innovative financial products"? Or did innovative information-technology had an intense impact on your life?

Hmmm….

Last time I gave an overview on what VBuilder is and how it improves iteration times. This time I'll give a small example by showing some extracts of what it takes to setup a project.

VBuilder is driven by commands coming from an XML file. Here is an how this can look like:

<!– register data resource –>
<register_dataresource xsrc="demoproject.rsc"/>

<!– load the cmo –>
<load_cmo xsrc="../CMOs/main.cmo"/>

<!– execute build process –>
<execute_script name="INIT"/>
<execute_script name="Load Buildings"/>
<execute_script name="Load People"/>

<!– set the save options for images and sounds –>
<set_save_options name="images" value="IMAGEFORMAT"/>

<– save to VMO –>
<save_changes name="content/demo.vmo"/>

So first one or more data resources are registered. Basically it's adding the search paths for external resources like textures and audio. Then a CMO is loaded. It contains the import and processing logic which then gets triggered. Usually you have textures outside but if you want to include them for the final file, this can be done like shown above with the save_options commands. At the end the new VMO, that includes freshly imported assets, is saved and can be started ie.e with the webplayer.

Btw. VBuilder also supports commands like setting values for script-parameters – very useful for making sure that debug-information is turned off for release builds!

So how does the assets import looks like? Well, this is adjustable to your needs but here is how I often do it:

So basically it's a scriptable build pipeline. Some people asked in the past years what we do and here you got it finally unveiled. It's actually a pretty simple concept and similar to bigger gamedev projects. I could bring it even closer to traditional gamedev projects: a future version could detect what files changed and only process those. That could be VBuilder V2.

Feel free to contact me about it, if you're interested to use these tools. I say tools, because I would add BBs like the Directory-Parser which is especially useful for projects that did not license the XE player.

In early 2006 I started to rethink the build-process for 3DVIA Virtools projects. It's a topic where many people from the Virtools community dive into one day or the other.

The problem

The standard method of doing an assets update for your project is, to let the 3d artist export the new assets versions, then a Virtools developer drops them into the CMO from the resource database and chooses what to replace and what to keep. One by one….

Some developer used custom scripted loading processes and so did we. We used text files and assets loading buttons for some projects. Text contained data of what material or mesh uses what shader and what attributes. But it came out that updating/maintaining those text files was quite error-prone and somehow not really artists friendly. Moreover building the final product for testing still required a bit of the time of a Virtools developer … time that was better spend on bug-fixing or adding features.

The solution

So, the new iteration was a command-line tool we created. Currently I am thinking about a new, better name. For now I will refer to it as "VBuilder". It's a one-click processor that is able to produce VMOs from CMOs using a list of simple processing-commands inside a XML file. A different XML file can be passed to the tool via the arguments, so it's possible batch-build for different VMOs.

We started to use directories as rough top-level for classifications of 3D assets: roads, buildings, cars, people. Adding a new car or a new building became a simple task: the 3D artist exports his new car as NMO to the "cars" directory, then he triggers VBuilder and within minutes a deliverable VMO file is available for testing.

What it requires though, is some up-front import-pipeline coding inside Virtools for each project (which might be reusable for different projects) and – in our case – naming conventions for objects and materials inside 3ds max etc.

What effect did we achieve with this?

Initially we had an iteration time of aprox. one day. This has to do with the fact that a Virtools programmer is not always available or ready to interrupt his development work for an assets integration-cycle.

So the artist may come to him and say: "Hi, I updated some buildings and some cars, can we have a look at it?". The programmer responds: "Let me just finished this little script first. It will only take 20 minutes" … … … then 2 hours later: "Ok, took me longer but now I am read… ???!! Hello?" – the artist went home as he comes to the office a lot earlier than the programmer!! He then does the integration and writes a notification about it. Next day, similar procedure. You see, this scenario really may happen and if you have a lot more Gfx ppl than coders it might get worse. I remember one project, where we had a junior Virtools developer doing mostly one thing: reimport new iterations from the graphics team.

With VBuilder the iteration cycle, for already available content-types, went from worst-case one-day to worst-case 5 minutes. Sometimes it only took 1 minute including startup of the player for testing. The best thing is, it even scales. I was able to support eight 3d artists while having time for adding features or doing bug-fixing. They were doing their stuff and it only needed my involvement when new item-types had to be created.

So with that team and VBuilder we were able to theoretically have several hundreds of content-update iterations or content-extension iterations per day! No idea how many they really did but they did plenty. That's a boost, ain't it?

Interested?

So, after 3 years beeing in use I am considering making it commercially available. It's no magic tool but it allows what I have described above. If you have several 3D artists in your team and you want to free programmer resources, this might be something for you! For me the effort to make it available only makes sense, if there are several teams or people willing to buy this. Thus if you think this is something for you, get in touch with me. Write me an eMail with "VBuilder" as subject. Also let me know what you think of what would be a fair price for you and on how many machines you would like to run it on.

Making it even better

I have a couple of interesting ideas of how to bring VBuilder to the next level. Currently it's focus is triggering the import and processing and building VMOs. This has some backdraws when working with the CMOs inside Virtools "Dev" and I think there are some interesting ways to make it even more efficient. If there is commercial interest, I would bring VBuilder to a new level!

To be continued …

Now this gave you a rough idea what VBuilder is about. In the next part I'll go into some details on how exactly it works.

It's already 2 weeks now that we left Sicily. We had a wonderful time on a wonderful isle. The people there are very friendly and helpful. I can only recommend it – though it started to be very hot already! I love sun and warm weather but sometimes it was a bit much.

Here a few snapshots from our cheap camera, I hope they give some impressions…

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".

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.

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…

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).