Sunday, November 14, 2010

XNA 3D Models



Creating a character from start to finish requires a game plan. I used to work with a content artist that would spend about 8 hours working on a single plant. So, when you're talking about a fully rigged and textured character with multiple animation sequences you start measuring the task in days. And, if it's a main character it may be a few weeks.

This model above is of John Crighton from the Sci-fi Show FarScape. By the way, if you haven't already, I highly recommend it. Give it a few episodes to get over the puppet factor and it's a really good storyline (Thanks Matt!). Anyway, this character is fully rigged and textured (1900 polys). It took around 8 hours to complete.

I used a simple mirror tool (In my editor, Artismo) to keep the character symmetrical. And, used extrude and line-flip and line-split functions to shape the character. After finishing the basic shape you want to save a copy for future models to add to your 3D tool box. Note: If you want a copy of my basic model let me know.

Once you are finished with the shape of the character, you should begin building a basic skeleton. While you're making the skeleton, add some extra bones for the lungs and for the neck as shown here:


You now have a base skeleton and character for any of your characters. You just need to customize them. Note that I didn't attach the model to the skeleton at this time. Since this is a generic character you may end up changing the shape before you're ready to rig it to the bones.

After doing the rigging, then it is time to paint the character. One mistake I've been guilty of is painting too many of the shadows especially around the neck and face. These fake shadows turned out looking really bad. It is better to use the model geometry and a light shading to augment the character shape. It's not like 2D drawing. This model started looking a lot better after I removed those shadows.

One tip to keep in mind when texturing is to lay out your geometry on the texture so you can line things up. You don't want to have the backs of the legs pointing upside down if you have to wrap some detailed clothing around it. By the way, next time you're walking around take a look at the patterns on people's clothes and how they wrap. You may notice that none of the patterns line up correctly on the seams. But, they're good at hiding the seams where you won't notice! Keep that in mind when you do your textures.

That's about it for now. I've got work to do on my 3D tank game and my next character is Dargo from Farscape. If you want a copy of Artismo let me know.

Jason

Monday, November 08, 2010

C# .NET Asynchronous Sockets Tank Game



First, let me say that this project was not about the graphics and game play. I wanted to try out some Asynchronous Client Sockets in C#. Getting sick last week was a good opportunity to try it out since I wasn't going anywhere. I came up with this little Tank Wars game.

I kept the client really simple by using GDI+ to draw the bitmaps on the screen. It just communicates the key events to the server. All of the game logic and scoring is handled by the server. Add some basic scoring and sound effects and we have Tank Wars!

I did hit a roadblock when I decided to add some sound. I used a simple class called SoundPlayer in C#. This was great for the Tank shot but was unable to play multiple sounds at the same time. So, I think it is time to call this exercise finished and move on to the next version.

Overall, it was a fun little couple hour project that got me exposed to what happens behind the scenes.

For the next version:
- DirectX Client.
- Really good sound support.
- Polish up the full GUI.
- Make the Server Public so Client can be downloaded.
- Support a SinglePlayer mode.

Feel free to leave any questions or comments. I can even post some code up here if anyone is interested.

Happy Coding!
Jason

Related Links:
Asynchronous Socket Programming in C#
PlaneShift Video on MMORPG Design.

Sunday, July 11, 2010

DirectX 2D Sprite Animation



I've been working on my first plug-in for Artismo 0.11.5 (dev). The Sprite Capture Plug-in will take the current animation sequence and export the animation to a bitmap as a 2D sprite map for import into any 3D Isometric engine.

The benefit of this plug-in is to quickly generate realistic 3D animations and run them in 2D. Several games use this technique. For example Diablo, WarCraft III, StarCraft, and other 2D sprite engines.

I had written a program in the past to allow me to create these animations by hand, but I had to draw every frame. So, a walk sequence which had 10 frames had to be drawn in 8 directions which was 80 frames for one animation sequence. So, if you wanted to have the character swing the sword while walking, that was an additional 80 frames.

With this tool, I create the 3D model with animation, and export any sequence I want. The penguin above is the test model. There are a few minor tweaks but this plug-in is almost ready.

Happy Coding!
Jason

Sunday, June 27, 2010

DirectX 3D Modeling in Beta Testing


I released the beta of my editor this weekend. This evening I began working on the car shown above. I'll post a finished shot when I'm done.

I'm looking for a few 3D projects that I can supply my software to for feedback. It exports animated .X files and I have working examples of how to animate the meshes in XNA and DirectX. If you have a 2D or 3D project, this may be the tool for you. I'm working on a tool right now that will export all the animations in a 2D format for sprite engines. If you're interested in beta testing please let me know.

Happy coding.
Jason

Friday, June 11, 2010

Think out of the Box


Just a short thought on solving hard coding problems. We all know that when it comes to writing code, there are usually several ways you can do something. If the way you're doing something seems really difficult, try stepping back and attacking it from a different angle.

We're not talking about code snippets here. If you're searching for specific code, you can probably find a sample out there. But, as Dex from Starwars would tell you, there's a difference between knowledge and wisdom. Applying the knowledge is where the money is! Do some research and see how people are solving similar problems. And, carry some paper with you so you can doodle designs on the go.

Most importantly, don't be afraid of failure. Just because you think it will work doesn't mean that it will, but it brings you one step closer to fully understanding the problem. Prototyping is your friend.

Happy Coding!
Jason

Friday, May 14, 2010

Bevel Algorithm


I've been working on this bevel algorithm for about a month now. Actually, this is the second bevel algorithm I've written for this. The above box was beveled three times in a row. I added some colors just to show off the geometry.

So, with this algorithm there were two challenges. First, was writing an algorithm that worked on all primitives multiple times. The other was support for the bevel gizmo that allows the user to bevel the object in realtime.

This is also the first modifier I have that displays text next to the gizmo so no panels with controls are required to perform the task. Slightly off subject, I tried using blender the other day and my editor is SO much more user friendly! If you use blender, you'll love mine.

I still have a lot of work on it but it's nice to be heading in the right direction.

Happy Coding!
Jason

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