Friday, December 28, 2007

Frame of Reference and Animation Thoughts

Recently I have been studying the ideas of Frame Hierarchies used in graphics programming.  Specifically, with DirectX and the X file graphics format.  Listed are some of my findings:

Frame of References

Frame of References are all around us.  A typical example is someone giving directions to someone else.  These are typically given "within a frame of reference".  Meaning, if directions are given to the location (B), they are given assuming you are starting at location (A).

In the context of DirectX graphics, frames (which contain mesh(s)) are usually more complex than just a single frame / mesh.  Hence, we require a way to manipulate the "series" of frames (and corresponding meshes) in a way that will allow each frame to be manipulated, but still allow the frame objects to maintain some sort of relationship.  If we use the concept of a hierarchy and a frame of reference we can accomplish this.

Basically, we establish a root of the hierarchy and then siblings/children under this.  Each sibling will share the same parent world matrix, and each child will have a parent (which it will get its world matrix from).

The order of operation on the world matrix at the child level determines how the object is manipulated/changed.  If we apply, for instance, a rotation to the child model space matrix and then concatenate this matrix with the child's parent matrix, we can archive frame independent transformation/rotation/scaling while maintaining the overall frame hierarchal relationship.

Animation

How does this frame hierarchy business help us when we begin to use animation?  It does so by defining animation interfaces, that are called by D3DX when Animation Sets that are active (allocated to tracks in the animation mixer) are found that have frame name references that are found in our Frame Hierarchy.

The D3DX API is constructed in such a way as to allow the X file definition contain animation sets, which contain animation definitions.  These are in turn linked to frames in the hierarchy.  Animation is a much more complex subject, but to simplify it, D3DX will crawl our hierarchy as time advances looking for frames that contain animation sets/animations.  It will then do the calculations to determine what the animation should do based on passed time values and animation definition.

One key to remember is that since we are using a hierarchy we don't necessarily have to reprocess the entire tree if only a few children are affected by the change.  We just process that part of the tree.

Tuesday, November 20, 2007

XNA Game Studio 2.0 BETA released!

The second release of XNA Game Studio has been released today.  I am in currently in process of installation of this.  I will be posting my experiences with this.  Link to download.

Wednesday, November 14, 2007

Better Zuner than later :)

I have recently had the opportunity to experience the newest version of firmware and software available for the Zune.  I am the proud owner of a Halo 3: 30GB Zune.  As I have been using what is now termed the Zune 30 I have had experience with the device for about 6 months. 

Device update

New firmware is included with the release of the new Zune devices, so the users of the 30GB model are not left out.  As they are very similar in specs to the new Zune 80, sans the extra disk space and slightly smaller screen (.2" bigger) and a slight decrease in weight on the new devices.  The new devices still use 801.11b/g wireless and this is one of the biggest updates, the advent of wireless music syncing.  The menu system that is introduced with the new firmware is very similar to the prior version but is faster and transitions are more "polished".  One of the biggest improvements I have welcomed is the ability to stop a video in progress, go listen to something else, and when you return to the video, your bookmark is automatically  there.  This was one of my biggest pet peeves of the previous version.

Marketplace update

As most who are interested in the Zune know, the software that accompanies the Zune's has been totally rewritten.  Much more of a web 2.0 feel to the new version.  The myriad of settings are increased to help personalization of your device.  Podcast subscriptions are now supported.  In similar fashion of the device, the software feels much faster (asynchronous tricks ;))

Online components

Some new additions to the system are the online components.  There is now a personalized portal that functions as your zune home online.  Zune cards have been introduced.  This is very similar to gamercards for the XBox 360.  The difference is obviously that they relate to how your using your device.  The site shows users with "most plays" among other things.  Users are able to "share" their zune cards with friends.  Mine is here.  This is driving home the social aspect that was originally sought after with this device.  I personally love it!  Join this with the fact that if you are a XBox 360 user, your friends list is available here for you (as well as view of your friends zunes stats, if they choose to share the info).

Conclusion

The update has been very easy and welcome by me and many others.  I will support and add my part to keep the "social" growing!

Sunday, November 11, 2007

Posting from Windows Live Writer

This is a post generated by using a new tool recently released by Microsoft (Windows Live Writer).  I have never used a offline blog editing software, so I am looking forward to this.  Might help me stay up on my blog posts.

Tuesday, August 28, 2007

I'm back....packing reduced instruction optimization

Been a while since I posted, but I am knee deep in assembly at the moment, reviewing for game programming class. Binary divison was a recent topic for reducing instructions by using bit shifts. The interesting part is how to find the remainder on number other than factor of 2. NOTE: This works with divisors that are a factor of 2 (typical for mov(b/w/l) instructions).

These operations are used with strings alot.

Lets say we have a string with a length of 10 and we want to use movl (4 byte stride) to read the value in.

10/4 = 1010 >> 2 = 10 = 2

Now we know that 10/4 is 2.5, so to calculate the remainder simply do this.

4 - 1 = 11 10 & 11 = 10 = 2 2 of 4 bytes is .5

Bit shifting is much more efficient in terms of instructions for the cpu, which equates to better performance. This is useful when trying to optimize C++ game code to get acceptable performance.

Sunday, July 15, 2007

Bungie Day!

Bungie celebrated Bungie Day last week (07/07/2007 - 777), weird but it may well be the day when most get married (http://www.time.com/time/business/article/0,8599,1630320,00.html). They released a new theme and gamerpics on that day, and that day only. Listed below are the blades.

Monday, July 9, 2007

Modifing the size of your integer value

When moving a integer, from say a smaller size field (word) to say a doubleword, you should not just movw to the new register.

movw %ax, %bx

This should not be done because you can not be certain that the upper part of the EBX register is zeroed out ahead of time. To do this you should first zero out the EBX (destination) and then move your intended value there.

movl $0, %ebx
movw %ax, %bx

Intel provides another instruction that can do this with one instruction, movzx. It takes a source (a register or memory location) and converts to a larger size (register only) destination.

movl $300, %ecx
movzx %cl, %ebx

Just thought this was interesting.