Wednesday, December 23, 2009

3D Modeling: Mech Animation

My goal was to model a mech robot. When I first started this model I thought it would be a lot faster than an organic object like a human. And, my first attempt was really fast.
It took me about 5-10 minutes to make this model:


But, when I tried to texture it I found that it was quite a different process. Instead of being one model, it's more like creating a collection of models. I attempted to texture it twice before I realized this wasn't working. So, I decided to take a different approach. I created a few parts that I could reuse in multiple places and textured them individually. The result was a much nicer model.
Here is the video of the walk sequence.



Going through this process exposed a few bugs in my program that needed attention. My process involves using my tools and discovering things that need improvement or are missing. Then, fixing the tool so that things go smoother. The reward for me is not only the model but the ritual. Someone recently told me that a good programmer has to be a perfectionist. Always paying attention to every detail. There's another profession I can think of that requires that same skill. Only it comes from the other hemisphere of the brain...

Happy Coding!
Jason

Sunday, November 29, 2009

Major Tom

This weekend I worked on reproducing the "Major Tom" song by Peter Schilling. I threw some pictures together to create this video for it.


While I was making this song my computer started to wig out. It would shut down after about 10 minutes and wouldn't restart. Well, I checked to make sure everything was properly seated, accidentally dropped the whole thing, and that seems to have done the trick. Now I'll be able to finish the end of the song properly.

Jason

Sunday, November 01, 2009

DirectX Shaders - Specular Highlighting

I've been working on shader support for my editor for the last few days. So far I've been able to apply a basic vertex and pixel shader to the directx rendering pipeline. My goal is to make some basic material parameters available to the user without getting too complex.

This picture is shows a model (1900 triangles) I made in the tool and the specular highlighting I was playing with. Note how he kind of looks like he is made out of plastic.



I'm REALLY close to a beta on the editor. I'm down to wrapping up the materials and finishing up the help files and I should have a downloadable version here before the year is up. I've been really busy with a class lately so that kind of slowed things up.

Happy Coding!
Jason

Thursday, October 29, 2009

Brain Processing Theory - Processor 4 on fire!



A few years ago a friend of mine was describing his brain like a computer, which originally had four processors. And, as you get older these processors start to burn out. I thought it was a good illustration and then the other day I realized that I think I lost a processor!

I was sitting there trying to remember "The Magic Solution" I came up with for a problem at work. Although I could remember the "What" it was supposed to do, the "How" seemed to have slipped my mind. It was like I had lost a few of the essential puzzle pieces. I just couldn't walk through the thought process to come to that solution. This is when I noticed the smoke coming out of processor 4! And, processor 3 mockingly pipes in with the Brain Processing Theory.

I sit in denial forcing myself to load "The Magic Solution" back into memory only to receive negative response from processors 1-3. They reply: "We don't want anything to do with work from processor 4 or anything else that requires 4 processors! And next time you better be ready to bargain with some sugar or something."

Now, I'm missing processor four. But, maybe the Brain Processing Theory needs to be expanded just a little... Maybe its a type of self preservation? Maybe Processor 4's main purpose wasn't to process mass quantities of variables and detailed designs and it just decided that enough was enough? Maybe all the processors are in on it and they're taking turns on vacation? No... I'm in denial again. I'm just down to 3 processors at 34. But, I guess there's always a bright side......... Darn it! That must have been on processor 4!

Has this happened to you? Let me know.

Happy Coding!

Jas

Tuesday, July 28, 2009

Advertised Shortcuts: Remember the Mulder!

I ran into a strange issue with an installer the other day. I needed to update two computers so I walked over and copied a new exe into the install directory and walked away. Three days later I noticed that the old program was back on those computers. Were these the same computers? All of the settings changes I made were still there.

A week later, I ran another program and noticed that everytime I performed a task that created any kind of files, the program showed a reinstalling form when trying to run it from the shortcut. I also noticed the shortcut target was not the exe. Hmm, this sounds like something from one of those Microsoft Conferences last year that they were raving about... Something about how Word could be damaged and even uninstalled and would be automatically fixed...

Welcome to Advertised Shortcuts! This behavior is part of the "resiliency" feature of the Windows Installer. When you create a shortcut with your install package they aren't shortcuts to your program. They are shortcuts to the Windows Installer which will check the version installed and if it is modified, will change it back to the proper state. It triggers resiliency.
http://support.microsoft.com/?id=290997
newsgroup info: Clicking on created shortcut trigers...

There are definately some benefits to this feature. For example, it blows away your app if it gets a virus. And, it gives you a warm and fuzzy feeling to know that your software is not going to be abused by someone.

Now for the really bad news. This can be a problem if your program has any external files in the target directory. For example, log files, data files, config files (including changes to the exe.config), temp files, etc. If your program changes anything in there, the next time you click on it, POW! You've just triggered resiliency. Which means your user is watching an installer run and boy I hope it works because if it doesn't they won't be happy. Wait they don't have access rights to install? Oops. Time to panic.

Okay, surely there's a way to just configure the installer package to not use advertised shortcuts? NOPE!! The answer suggested is to use another utility besides Visual Studio to make the installer package such as WIX or InstallShield. Huh? Have you tried WIX? You've just turned your 1 hour install package into an 8 hour march of death. 6 months from now some other programmer will stare in disbelief at that WIX package wondering whether you were chasing the dragon on that day.

There is actually only one flag that needs to change in the install package.
It is: DISABLEADVTSHORTCUTS and it needs to be set to 1.

Now, for the really really bad news. There is no GUI support for this flag! Don't worry, there's a solution.:) What you have to do is download the "Installer SDK" from Microsoft. No, I'm not kidding... You have to install the Installer SDK! You know we all have that. :)

Then, you run ORCA which is a tool to manipulate the data tables for a package and you add this property into the Property tables manually after you build the installer.

If you want to set it up as a Post Build Event in visual studio it is possible. Follow the instructions here:
http://www.discussweb.com/c-programming/13643-advertised-shortcuts-installers-how-avoid.html

Wait, you don't like this solution? Well, some people write a custom step in their installer or even there executable to delete the advertised shortcuts and put back regular ones using IShellLink. (Refer to the last link if you want to go this route).

So, the moral of this story kids is installers are getting scary. Or rather, the Operating System you're installing on is paranoid and suffering mental disorders. Remember, Mulder from X-files? TRUST NO ONE.

REMEMBER THE MULDER!
AND
HAPPY CODING!
Jason

Wednesday, July 15, 2009

Hard at Work

It's been awhile since a post. I thought I would throw this up here. This is a picture of me hard at work at the office.



I've been working for the past few months on about 80 updates to my 3D editor. Definately a move in the right direction. I'm currently testing the registration and update system and rewriting a better UV Mapping editor/ art tool. I'm hoping to post some tutorials here on how to use the program when it is ready for download. Beta version will be done soon.

At the office, I'm working on extracting data from a word form and putting the data in another word form. Fun stuff. I have a nice little tool that uses a rules file to convert the documents.

Remember to have lots of beverages when coding! That way you get out of your chair at least once an hour whether you want to or not. :)

Happy coding!
Jas

Tuesday, June 16, 2009

What superhero am I?

Your results:
You are Superman
























Superman
80%
Green Lantern
65%
Iron Man
65%
Hulk
60%
Spider-Man
55%
Supergirl
55%
Wonder Woman
50%
The Flash
50%
Catwoman
50%
Batman
40%
Robin
32%
You are mild-mannered, good,
strong and you love to help others.


Click here to take the "Which Superhero are you?" quiz...

Sunday, February 08, 2009

XNA Game Project


I've been working on a demo project in XNA. This completes my content process for games. I first use my own model editor (going into beta this year) to create the geometry and animations and export a .x file. The level is built in a custom level editor tool we've written for this XNA project, and everything is pulled together in an XNA game engine.


My first goal for this phase of the project was to animate a .X model in XNA. I searched around on the web and found samples and found one that was close. I started with the skinning sample that is available for download from the XNA Creators Club. It animates a bald soldier ("dude") .FBX file. The issue with this code is that it rendered FBX files AND .X format, but it didn't do any blending between the key frames. This wasn't a problem for the sample model "dude" because it had a ton of frames, but for my animation that was only 10 or so key frames, it posed a real problem. So, I rewrote the code, preprocessor, and HLSL .fx files to properly load and animate .x files. After that, I had used some level editing code to create a height map and load my own model and have him walk around on the height map.


Here is a video of my western character running around on a test height map. It demonstrates character animation and basic height collision.



My next goal will be to add some objects with collision such as buildings, towers, and other objects the character can jump on. I'll also be animating a frog for an elementary school project coming up here real quick. I would love to here from anyone on ways to handle objects and areas such as a multi-floored building that the character can go into.


Happy Coding!
Jason

Friday, December 19, 2008

Hidden Text in Word

This post explains how to collapse multiple sections in a word doc.


There may come a time when you need to collapse sections of a word doc based on a checkbox. The sample form I'm using looks like this:




To create this form:

1. Create a new word doc and add a checkbox.

2. Type some text under the text box.

3. Select the area you wish to hide and add a bookmark: Insert->Bookmark. The Bookmark dialog will appear. Type "Section 1" as bookmark name and close.

4. Repeat the process two more times.



What we've done is create "Enclosing Bookmarks" around some text. There are actually two types of bookmarks. These are:

1) Placeholder Bookmarks which look like a beam.

2) Enclosing Bookmarks that will show up as graphics.

You can see these book marks by going to Tools->Options->Display Bookmarks.

(Bookmark indicators in Red)

Now for hooking up the checkboxes.
The Checkboxes need to call a function. So, first we have to write the function. The code should look like so:




Public Sub Hideit()

'unprotect the document
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
End If

ActiveDocument.ActiveWindow.View.ShowHiddenText = False

'Get the range of the bookmark.
Dim rng As RangeSet rng = ActiveDocument.Bookmarks("Section1").Range

If ActiveDocument.FormFields("Check1").CheckBox.Value = True Then

rng.Font.Hidden = 0
Else
rng.Font.Hidden = 1
End If

ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True

End Sub



Now in the Checkbox, select this function and your
done! Additional Info here: http://word.mvps.org/faqs/MacrosVBA/WorkWithBookmarks.htm

Happy Coding!

Jas

Wednesday, December 03, 2008

Line Ring Selection Algorithm

I'm thinking about adding a tool that will select a ring of lines.
Here is an example of a ring you want to select.


Okay, what I've come up so far is something pretty simple.
1. Copy the target face.
2. Check to see if the selected line is an edge.
3a. Yes, calculate all the edges that are attached to the selected edge and select. END
3b. No, remove all polys that have edges. goto 2.

This image shows how it would work on the example.


I know there are some exceptions. It seems simple enough. I'll let you know how it works.

Happy Coding!
Jas

Thursday, November 13, 2008

Character Modeling II

Picking up from the previous post, I've modeled a basic character using a billboard as a guide. See picture:

You can see the bone system residing inside of the character. For the hands I only needed the ability to move the thumb, index, and rest of fingers as a group so I used three bones.

Assigning the geometry to the bones:
In my tool I do this by selecting the desired bone. I select the geometry I want to assign to it and associate the selection tot he bone. In the following image you can see that I have part of the spine selected and I'm assigning verts to the torso.(GREEN=assigned, Yellow=assigned to another bone, BLUE= not assigned at all)

Note: In other tools, you'll be able to do this by some tool automatically, but since I haven't coded that, I alternated the model color to help in the assignment process.

After applying all the geometry to the bones, I created some test animations that ran the character through basic movments. Each joint was a different animation.

As I tested the animations, I would make adjustments to the bone assignments, applying multiple bones to influence the points. This is great in areas like the shoulders, hips, knees, and neck. You'll need to add additional geometry to improve the animations. My character jumped from 1100 polys to over 1500+ polys by the time I was done with this process.

Once the models movement looks acceptable with the test animations you're ready for texturing. (I made the mistake of texturing first and had to do it again later. Not too bad but could have saved time to wait.)

When you're finished texturing your character is ready for producing the real animations.

The picture above shows my gunslinger (Guns aren't textured yet) in his loiter pose. This guy was exported in .x format and loaded quite nicely into a demo app. Total polys (1530).

Note: I used my own editor to do this character. Let me know if you're interested in trying it out. I'm always looking for people who can give me some suggestions and feedback.

Thanks for reading and happy coding!

Jas

Monday, October 06, 2008

Character Modeling




My goal was to create a model with 1000-1500 polygons. These are the steps I followed:

1. First, I drew and scanned a finished character front and side view in standard pose. Take the time to get it as close as possible to the real thing here in pencil.

2. I took the image and billboarded it in my editor for reference and started building geometry with the same general shape.

3. Modeling: I started with a box and scaled it the size of the chest. I then worked down the torso and did the legs. Next, I worked up the neck and did the head. I then extruded out the arms on both sides, placing geometry in the proper joints to allow for animation. Doing the hands takes some time. Basically, extrude out the fingers and play with the vertices.

The head took quite some time. After adding detail to the face and moving things around I kept shrinking the head and had to readjust things at the vertex level. In your tool you probably have a way of using a select box and scaling the selections. I'm missing that tool. Doing the ears were not so bad but I had to make it look the same on both sides of the head.

4. Grouping the polygons. I went through and grouped the polygons. I'm basically associating polygons within region together for the texture mapping stage.

5. Texture mapped all the groups (faces in my editor), and sized them to a 2048 bitmap. Note, this should be done after step 6 next time. because I'll have to do it again if I change any geometry.

6. (Stopped here) Bone support: Start adding the skeleton and working on animations. Most likely in this process there will need to be some tweaking of the geometry to improve joint areas. (This version of my editor has not implement multiple weighted influences on vertices from multiple bones yet. Coming soon.)

7. Once animation is good and a few of the animation sequences are finished, the geometry is stable and the texture can be generated to the model.

8. Add additional animation sequences.

What I learned or ran into during the process:
1. I'm really needing a mirror tool, and a few other essential modeling tools.
2. I don't know how I'm going to do the gun yet. That involved attaching and detaching a bone to the animation. I'm guessing this will be handled in the engine.
3. It was way more work than I thought it would be but I can use this model as a base for later models if it works out.
4. Been playing spore and would like to add additional features to my editor that allow me to modify geometry by using the bones themselves. (Cool!)
5. I'm not sure yet if the movement (up and down, and jump height) should be coded in the animation or when rendering the animation in the engine. I'm guessing that should be handled in the engine.

Would love to hear how this process differed from your experience developing a fully animated model.

Happy 3Ding!

Jason

Monday, September 22, 2008

DirectX Mesh Loading

It's been awhile since my last post. I got a little burned out on meshes after working on the xfile format. I did recently write a little app that lets me load my walking sequence and walk the little "Jake" model around. Here's a video.

This is just a DirectX 8 application with a skinned .x file loaded. I'm going to create a really simple character and start playing with breaking up the animations by lower and upper body as well as moving the head where the camera is pointing. It will support jump, swing, run, walk, back up, sit, and lay. We'll see how it goes. After that I might start working on lighting a little. but, it would be neat to get more than one person moving things. My editor is comign along well. I have a short buglist and then its on to deployment code. If anyone is interested in trying it out let me know in the reply.

Happy Coding!
Jason

Saturday, July 26, 2008

DirectX Animated Character

This one is a fully textured version of my Jake character. It has some smoothing on it as well. Only 828 polygons.



I did notice that the new "DirectX Viewer" has some rendering issues with normals and lighting, but it still works.

Next on the list is loading this file in XNA and blended animations. I'm hoping to walk this guy around in 3rd person.

Happy Coding!
Jason

Saturday, July 12, 2008

Xfile Export Done and completed build 0.07

Yesterday I finally got my xfile exporter to work correctly. It was just a test but it worked! In this video I'm loading an xfile into the DirectX Viewer.
This model is working as designed. My next test will be a more detailed model. If it works I'll texture it as well. Fun Stuff!

Happy Coding!
Jason

Friday, June 27, 2008

Exporting DirectX Files for Animation

There are two approaches to writing DirectX files. The first is to take your geometry and animation data and stuff it into the D3DX Mesh classes and use Saving functionality. The second approach is to skip the D3DX classes and write a file directly that conforms to the .x format specifications.

I chose to write my own. I found the documentation and examples for loading D3DX classes inadequate when writing an exporter. Every book/article(msdn site, 3D Game Programming With DirectX 9.0, Managed DirectX 9 KickStart, etc.) will have a chapter on how a Bone hierarchy works and then it will show you the "Tiny.X" file and how to load it from file and animate it. But, where are the good examples (Managed code) and documentation on how to initialize and use these objects when you have all the data already? There are only a few and most are written in outdated versions. Since I didn't build my model and animation classes on D3DX classes, filling those objects did not appeal to me.

I worked on the format for a few days. I was able to export static meshes quite well. In fact, I had better results with the .x file I wrote then with the one written by the D3DX classes, which I had previously used to export static meshes. The ones from D3DX didn't load well in the newer Mesh Viewer that comes with the DirectX SDK. It only worked in the old one.

Exporting the Animated Meshes has proven more difficult but I am seeing some good results. I've been tinkering with the transformations and I got it really close. With a little time and some files I'll be exporting.

Happy Coding.

Jason

Wednesday, June 18, 2008

DirectX Character Animation II

In this animation I've upgraded the model a little. There is the stand, walk, run, and swing sequence. Here's the video:



I've also fixed the lighting as you can see in this video. The next one will be fully textured I promise!

Happy Coding!

Jason

Tuesday, June 10, 2008

DirectX Character Animation

I've made a little progress on my animation system. I made a test model I like to call Fred and attached him to an animated skeleton. See Video.


I know the character isn't that pretty but the important thing is that his skin isn't flying around the screen and he is performing the cheesy walk sequence. Although I haven't transformed the normals yet so his lighting is really bad. Next step is to fix normals and start working on weighted blends.

Later I'll support .x format so I'm going to take a close look at the "Simple Animation" demo from microsoft and utilize their AnimationController and D3DFrame structure. I did find that DirectX render state does support vertex blending with the D3DRS_VERTEXBLEND flag. You can read about it here:
http://msdn.microsoft.com/en-us/library/bb173463(VS.85).aspx

Happy Coding!
Jas
(Note I'm not DXJas anymore because microsoft stopped supporting MDX and that upset me. Their alternative was to use XNA or roll your own. XNA Rocks though! Don't get me started...) :)

Monday, May 26, 2008

DirectX Skeletal Mesh Cont.

I've been making progress on my animation. So far I can add bones and frames and animate the bones. See this video of my first animation of a hand.

This was using four key frames. My next task will be to clean up the code, and save the bone animation to file for reloading. After that I'll start working on attaching geometry to the skeleton. Woo Hoo! Can you tell I'm having lots of fun?

I'm pretty sure the attached mesh will have issues in certain areas but I'm hoping that within a few weeks I'll have my first animated mesh and shortly after that my first animated .x file. My goal here is to create a walk sequence and load the animated mesh into a demo game engine. I still haven't figured out how I'm going to let the user edit the geometry. That's going to be quite a shift in process flow. Oh well.

Happy Coding!

DXJas

Tuesday, May 06, 2008

DirectX Skeletal System



Now that I'm able to create static meshes, I've begun developing a skeletal system that will allow me to animate them. (See screenshot)

Next, I'll add gizmos to manipulate the bones, including forward and inverse kinematics, and start playing with key frames and animation.

The last stage involves attaching the mesh to the skeleton. In some areas it will be necessary to assign vertices to multiple bones to smooth the animation a little.

I would be happy to here from some of you on what features you feel are essential in a skeletal system. Is path-based movement important or is it easier to create a few key frames? Do you break up your sequences on the mesh for different body parts so they can be combined? For example, the character can play the run sequence AND the eat sequence at the same time?

Fun stuff! I'll probably be working on this area for the rest of the year.

Slightly off the subject, the best character editor that I ever saw was the character creator in City of Villains. Another good one was in the Spore Video created by Will Wright, the maker of Sims.

Happy Coding!

Jas