Monday, July 14, 2008

Look At Me

My first post was about the blend tree animation system and editor I'm working on.

Since then, I haven't talked much about that, as I really haven't had the time to seriously work on it.

It's sad, but at the moment it's just a side project.

Nevertheless, its state is advanced enough that we're using it in our game. It's an improvement on using raw Ogre animation states directly, and has many useful features and potential, but that's my very subjective opinion.

Even if it is yet nowhere near what I envision, it's already easy to fake some IK controllers.

Here is an image of our player character looking at some random point in space.


This is done by mixing one-frame animations of the player looking up, down, left and right with the current animations.

The bulk of the work of setting how the animations blend can be done in the editor by an artist, by setting nodes that tell how the animations blend, and he can preview the end result there. This is in my opinion the true strength of the system.

If anyone is interested in checking it out, here it is, open source and all that.

Sorry that the blend-tree editor is not up there, but I'm hoping on being able to work on it once the master is over ( mid September ). In the meantime, I'll gladly share the binaries with anyone who asks.

MaxScript to the Rescue

Here is the Softimage XSI UV editor:


And here is the 3D Studio Max 9 UV editor:


It's just a matter of taste which one you prefer. The artists in my current project use XSI for UVW unwrapping, but I just like the neater user interface in MAX better.

One thing I like very much from the XSI Texture editor and that I haven't been able to find in Max are these fellows here:


They can be used to collapse UV coordinates in the X and Y axis respectively, and not being able to find this feature in Max was haunting me.

So I set out on a journey to my first MaxScript. Here it is, and as dumb as it may seem, I've already found it very useful.



MacroScript CollapseX category:"CustomUVW" buttonText:"Collapse X"
(
sel_vert = $.Unwrap_UVW.getSelectedVertices()
sel_vert_array = sel_vert as array
if ( 0 < sel_vert_array.count ) then
(
v1 = sel_vert_array[1]
sel_pos = $.Unwrap_UVW.getVertexPosition 0 v1
$.Unwrap_UVW.moveX sel_pos.x
)
)

MacroScript CollapseY category:"CustomUVW" buttonText:"Collapse Y"
(
sel_vert = $.Unwrap_UVW.getSelectedVertices()
sel_vert_array = sel_vert as array
if ( 0 < sel_vert_array.count ) then
(
v1 = sel_vert_array[1]
sel_pos = $.Unwrap_UVW.getVertexPosition 0 v1
$.Unwrap_UVW.moveY sel_pos.y
)
)

MacroScript CollapseZ category:"CustomUVW" buttonText:"Collapse Z"
(
$.Unwrap_UVW.moveZ 0
)



I don't even bother with finding the selection centre, as all I really care about is that they share the same value for the coordinate.

The next step: Add it somewhere in the user interface and rejoice.