Visions Of Afar
The Struggles of a College Student in the Gaming Industry

Rough Edges Editor Day 3

July 3, 2009 13:30 by Garrett Hoofman

Rough Edges Editor 4

Day 3 of the Rough Edges Editor

Features Implemented :

  • XNB File Loading
    • Builds and Loads Static Models and Animated Models
  • Saving / Loading Scenes
  • Drag and Drop Models
  • Layers
  • Delete Models

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Rough Edges Editor Day 2

July 2, 2009 00:59 by Garrett Hoofman

Rough Edges Editor 3

 Day 2 of the Rough Edges Editor

Features Implemented :

  • Un's Manipulator Control
  • SkinnedModelProcessor for animated models
  • Better Abstraction
  • Code Cleanup
  • General Settings, Grid, and Camera created as an REObject

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Rough Edges Editor

July 1, 2009 14:31 by Garrett Hoofman

Rough Edges Editor

Day 1 of the Rough Edges Editor.

Features Implemented :

  • WinForms with XNA
  • Threaded On-The-Fly Model Loading
  • 3D Grid
  • Properties Control
  • Bounding Boxes (Needs Updating)
  • Mouse Picking
  • Translation/Rotation/Scaling of Models

Rough Edges Editor 2


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

XNA and Animated Models from Maya

June 30, 2009 03:02 by Garrett Hoofman

XNA comes with a great foundation for importing FBX files. There's also a fantastic sample from the Creators Website that runs through the process of an Animated FBX. However, there's a problem when exporting an animated Model from Maya. When Maya exports an FBX file, it will export the animation all in one track. This causes a problem of animating the model in your XNA games.

So, after crawling through Google and the forums, the best solution I could find, was to create a document with the individual keys and it's animation, so that the Skinned Model Processor could load the animation clips itself.

So, for example, Key 1 - 20 could be the Walk Cycle, and Key 21 - 40 could be the Jump Cycle, etc. etc.

So, the text file would look something like this :

 

"walk" 1 20

"jump" 21 40

"leftpunch" 41 45

"rightpunch" 46 50

 

To accomplish this we need to add code to the SkinnedModelProcessor.cs file in the SkinnedModel Sample from the XNA Creators Website.

Dictionary<string, AnimationClip> SplitAnimations(AnimationClip rootAnimation, string animationDefs)
{
    Dictionary<string, AnimationClip> splitAnimations = new Dictionary<string, AnimationClip>();
    StreamReader fileReader = new StreamReader(animationDefs);
    while (!fileReader.EndOfStream)
    {
        string line = fileReader.ReadLine();
        string[] parts = line.Split(' ');
        string animName = parts[0].Trim('"');

        int startFrame = int.Parse(parts[1]);
        int endFrame = int.Parse(parts[2]);
        splitAnimations[animName] = ExtractAnimation(rootAnimation, startFrame, endFrame);
    }
    fileReader.Close();
    return splitAnimations;
}
AnimationClip ExtractAnimation(AnimationClip rootAnimation, int startFrame, int endFrame)
{
    TimeSpan startTime = ConvertFrameNumberToTimeSpan(startFrame);
    TimeSpan endTime = ConvertFrameNumberToTimeSpan(endFrame);
    List<Keyframe> keyframes = new List<Keyframe>();
    foreach (Keyframe keyframe in rootAnimation.Keyframes)
    {
        if (keyframe.Time >= startTime && keyframe.Time <= endTime)
        {
            Keyframe newKeyframe = new Keyframe(keyframe.Bone, keyframe.Time - startTime, keyframe.Transform);
            keyframes.Add(newKeyframe);
        }
    }
    return new AnimationClip(endTime - startTime, keyframes);
}

 

Next, in the Process function we need to change the following line :

// Convert animation data to our runtime format.
Dictionary<string, AnimationClip> animationClips;
animationClips = ProcessAnimations(skeleton.Animations, bones);

.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

To :

// Convert animation data to our runtime format.
Dictionary<string, AnimationClip> animationClips;
animationClips = SplitAnimations(ProcessAnimations(skeleton.Animations, bones)[0].animClip, "definitions.txt");

 

Now that you have that, you need to include your definitions.txt file in your Content folder. Now you can start your animation clips by calling the animation clip name as follows :

AnimationClip clip = skinningData.AnimationClips["walk"];
animationPlayer.StartClip(clip);

 

Sources :

http://forums.xna.com/forums/t/1415.aspx?PageIndex=2

http://creators.xna.com/en-US/sample/skinnedmodel


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: C# | Game Development | Maya | XNA
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Draw Into Sound

March 23, 2009 09:43 by Garrett Hoofman

Angelo Gattuso who goes by the name evol76 on the Code Project website has used my C# Wav File Library in a unique way. He’s using images to create wave files. It’s a cool idea, and I like what he did with it.

Check it out here.

Fig6


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Windows Desktop Background

March 22, 2009 05:16 by Garrett Hoofman

Recently I decided to install Windows 7 and use it as my main Operating System of choice. I have been thrilled with Windows 7 to say the least. It’s a vast improvement over Vista.

There’s one thing that I’ve always wanted as far as eye candy. A moving desktop background. It’s such a simple thing, that I would have thought this would have easily been done by now. With a little bit of searching, I found software that could do this task for a price. However, I couldn’t find anything for free.

So, I went back to using Winamp. Winamp has had the Milkdrop visualization plug-in for years now. Milkdrop has the capability to render the visualization to the desktop, and still have the icons float overtop of it. It acts just like a moving desktop wallpaper.

So, when I moved to Windows 7, I reinstalled Winamp, and went to put my favorite visualization on, Eo.S. – Starburst 01. (With milkdrop, you can turn scroll lock on, to keep the visualization locked on) However, with the new Winamp download, they took that particular visualization out…

Luckily, I still had my XP install on my 2nd hard drive, so I simply copied the preset back over, and poof, I have a starburst moving background wallpaper, that’ll animate to my music. So, if anyone else wants the Eo.S. – Starburst 01 visualization, you can download it here. (Extract to Program Files\Winamp\Plugins\Milkdrop2\presets)

ScreenshotThumbnail


Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Windows 7 | Winamp
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Houghton Game Jam

February 2, 2009 11:47 by Garrett Hoofman

My latest project has been putting together and organizing the latest annual Houghton Game Jam.

Thumbnail via WebSnapr: http://www.houghtongamejam.com

The 2007 Houghton Gam Jam was the initial event that was hosted by Norm Nazaroff. He did a fantastic job with it and it turned out to be a complete success. Norm graduated in 2007 though, and so the 2008 Houghton Game Jam was handed off. Unfortunately very little from what happened at the 2008 Houghton Game Jam made it to the web site.

So this year I decided to take over the process of running the 2009 Houghton Game Jam. As of now the event will take place on Saturday, April 4th at 12:00 PM, and it'll last a full 24 hours over night until 12:00 PM on the Sunday April 5th.

If you're in the Houghton area then head on over to the Registration Page!


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Modeling a Face with Maya

November 27, 2008 15:26 by Garrett Hoofman

I've slowly been going over some tutorials for Maya the last semester at Michigan Tech. Now that I'm on Thanksgiving break I've had time to sit down and flesh out a model with the information I've learned. I decided to try modeling a female head.

This is so much easier said than done. Not only is it difficult to make a model look like a human head, but to also make it look feminine is incredibly difficult. So here is what I came up with, (My 2nd try) :

It didn't turn out too bad for my first attempts at modeling a head. I ended up trying out the strategy of starting with a single polygon plane and extruding the edges out. I started with the eye and worked my way outwards. I may end up working on it some more when I get back up to Michigan Tech. I may even try to create a full body and try my hand at animating it.

Not sure where I got the reference Image, most likely Deviant Art

[YouTube]


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Maya | Modeling
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

New Projects Page

November 4, 2008 09:46 by Garrett Hoofman

I finally got sick of how ugly my old projects page looked. So, I created a new one!

Check it out if you have chance.

- Garrett


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories:
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Wave File Format and C#

October 21, 2008 09:38 by Garrett Hoofman

I wanted to play around with a wave file in C# that way I could create my own procedure generated waves. So, I started searching around on Google to try and find a C# wave file generator. I couldn’t find anything. I decided to go about making my own and found a lot of information on the wave file format at  : ccrma.stanford.edu.

I created a C# library so that anybody else that wants to play with these wave files can. You can get the source code here : Wave Library

This is how you would create a wave file, with white noise, or a constant sound.

   1: WaveFile file;
   2:  
   3:         private void CreateWaveFile()
   4:         {
   5:             bool whiteNoise = true;
   6:             Random rand = new Random();
   7:  
   8:             file = new WaveFile(1, 8, 11025);
   9:  
  10:             int samples = 11025; //Creates 1 second of audio
  11:  
  12:             // Sound Data Array
  13:             // Size needs to be :
  14:             //          Number Of Channels - 1 for mono
  15:             //                               2 for stereo
  16:             //          Bits Per Sample    - How many bits are used to describe each Sample
  17:             //          Samples            - How many samples that are provided
  18:             //
  19:             // Sound Data Size = Number Of Channels * Bits Per Sample * Samples
  20:             byte[] data = new byte[file.NumChannels * (file.BitsPerSample / 8) * samples];
  21:  
  22:             if (whiteNoise)
  23:             {
  24:                 //Creates White Noise
  25:                 for (int i = 0; i < data.Length; i++)
  26:                 {
  27:                     data[i] = (byte)rand.Next(256); //256 is the max size of a byte
  28:                 }
  29:             }
  30:             else
  31:             {
  32:                 //Creates a Constant Sound
  33:                 for (int i = 0; i < data.Length; i++)
  34:                 {
  35:                     data[i] = (byte)(256 * Math.Sin(i));
  36:                 }
  37:             }
  38:  
  39:             file.SetData(data, samples);
  40:             file.WriteFile(@"C:\Test.wav"); //Writes the wave file out to the destination given
  41:         }

You can play with the for loops and create some neat sound effects :

   1: float push = 0;
   2: //Creates a Constant Sound
   3: for (int i = 0; i < data.Length; i++)
   4: {
   5:     push += 0.0001f;
   6:     data[i] = (byte)(256 * Math.Sin(i * push));
   7: }

That’ll create a nifty little whirl noise with very minimal effort.

The best part is you can then use the DirectSound framework to play your new wave file. This approach could be an easy way to limit your game size and create some neat procedurally generated sounds, all on the fly.

EDIT : The WaveLibrary had an include for LINQ, which it wasn't using. Having that in would throw an error if it were compiled in any Visual Studio below 2008. Thanks to Vulpes for catching that.


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5