Thursday, December 9, 2010

CATL Scholar Award and Bump-Mapped Beams

Now that the semester is almost officially over (one more final to give, to the regret of my students), I have had more time to catch up on small project minutiae and make some substantial progress on my project. One thing I forgot to mention in prior posts is the Center for the Advancement of Teaching and Learning (CATL) Scholar Award, which was announced back at the beginning of November and which will help support the DigiBahn Project as develops one complete level of a 3D digital game-based learning environment for second language acquisition. The award will provide course release time to assist in project development, purchase hardware and software, and grant access to technical training and new conference venues.

I've been making progress these last few days on getting the exposed vertical beams in the second floor of the model in place:




If you read my earlier posts below, you will recall that I complained that the color and bump maps could not be applied to all the beams after they had all been created and that I had to start from scratch again. However, I found out that if channels for color and bump maps are created in the original object, and copies of this object are then made, all subsequent changes to these channels propagate across all already-made copies of the original object. So, in a sense, copied meshes inside of Blender are object-oriented, provided that the root object of these meshes contains all the information required. In sum, changes to copies of an object cannot be applied retroactively.

I've also been having some fun with the bump map channel inside of Blender:




The color for the beams was sampled in GIMP from a photo of exposed timber work on a German building and the bump map, which was also created in GIMP, was selected from a photo of wood grain. The result, I hope, shows old rough-cut wood beams that, over numerous generations, have been painted over. I'm not sure how I can get the bump maps into Unity 3D, and this is something that I will need to work on.

Wednesday, December 8, 2010

Textured Beams On the Way!

Seems to be either feast or famine when it comes to blog postings with me. Now that the semester is officially over (besides the final I still have to administer), I have a lot more time to do game development. Wish I would just be able to spend more time on doing background research on the use of 3D digital game-based learning environments, but I figure that if I don't get the game developed I won't have anything to test anyway.

After creating the model completely, I discovered that you can't apply a texture to one instance of an object (say, a vertical beam) and expect it to be applied to all instances of vertical beams in the game object. So much for a true object-oriented paradigm. So, what I have had to do is delete all instances of vertical beams (except for one), apply a texture to this object, and then make copies of it:




To ensure that there was some variety in the textures visible to the player, I would copy a beam, rotate it 90 degrees, make another copy, and repeat the process. This ensures that at least four different faces are visible; hopefully players won't look too closely or they will discover the pattern. But at least it is better than the same face for every beam. So, in the coming days I will be working on getting all the textures applied to the model and then importing it into Unity 3D.

Full Museum Model Finished

Well, I should add that the full museum model is almost finished - I still have to add the door handles to both doors. Otherwise, how will people be able to get in and out of the building? Although I still need to get a handle on how to light a scene most effectively in Blender, I made a few quick untextured renders to provide an overall impression of the building:


Front View


Back View


Minus the door handles, the model consists of 3731 vertices, which I hope Unity 3D will be able to handle once I import the model. As this will be the only model in the game with a high vertex count, I'm hoping that the game engine won't take a big hit. We'll just have to wait and see. In the coming days, I hope to make another turnaround render of the model and post the video.

Wednesday, December 1, 2010

Exposed Timber Work (Fachwerk)

Since I started redesigning the city museum model, I thought I would add a few extra features that were not in the original. If you check my earlier posts (see below), you will notice in the screen shots that the exposed timber work (Fachwerk) on the second floor of the museum is simply painted on in the textures; there is no real 3D "feel" to this aspect of the model. I thought about adding the exposed timber work for some time now, wondering if the extra vertices would slow down the game at all. But it is exactly this feel that makes, in my opinion, the real Fachwerk so interesting when you see these buildings in Germany:




So, now that the semester is starting to wind down and I have a little extra time on my hands, I thought that I would start adding the Fachwerk to the second level of the city museum. After checking a few sources online about how these buildings were constructed, I came up with the following (untextured) addition:




I think the addition adds much more to the real "feel" of the model, although I'm not sure what type of performance hit the game engine will take with the extra vertices. Oh well, that's what prototypes of for, I suppose. I particularly like the crisp edges of the model, although this is obviously lacking in the original buildings, which have an old, weathered look to them and a more "organic" feel; as if they have grown rather randomly through the ages. The next thing for me to work on in the coming weeks.

Tuesday, November 16, 2010

Burning Down the House

These last few weeks I have been banging my head against the proverbial digital wall, trying to get my computer game -- or 3D digital game-based learning environment, which sounds more sophisticated -- to work just the way I would like. The primary problems were: (1) the door animations in the game just didn't open and close right and (2) I couldn't get two animations on the same mesh object to play independently of each other inside of Unity. Taking inspiration from a Talking Heads song, I decided to burn everything to the ground and start over. As trying to explain my problems in written format is difficult, I made a video highlighting what the problems were and the solution I found for them:



So what have I learned? Well, for starters, any changes (e.g., scaling and rotation) you want to make to a Blender object that you will eventually import into Unity *must* be done in Edit Mode, not in Object Mode. If you made these changes already in Object mode then Alt-R will clear the rotation and Alt-S will clear the scaling. Apparently, you cannot include more than one animation armature on an object, which makes animations working independently of each other difficult to create (e.g., opening and closing two doors). However, this worked example by Devin and Calin Reimer shows that it is possible, with some advanced knowledge of how Blender animations work inside of Unity and a handle on the C# programming language. Thanks, Devin! Oh, by the way, if you use Devin's script in Unity when you have the Terrain Toolkit loaded, you'll get nothing but errors.

Now it's just a question of getting the models rebuilt, working on a GUI for the player to use, and getting some of the game functionality programmed. Trying to make the deadline by end of next semester so that I can run an experiment with a beginning German language course and publish the results. Let's see if I will be able to get everything done by then.

Friday, October 22, 2010

First Blender Animation Imported into Unity

I have had my nose to the proverbial grindstone these last few days, working hard to get a Blender animation to play inside of Unity. After two solid days of coding, debugging, and scouring the Web for clues, I finally got it to work:




To summarize my findings: Unity doesn't automatically import mesh animations from Blender. Rather, what you need to do is to create an armature, make the mesh child object to the parent armature, and then animate the armature. The animation needs to be saved as an action in the Blender Action Editor, which Unity picks up once you import the file. Work on the animation spanned three development platforms, Blender, Unity and Microsoft Visual C# Express (which I configured for automatic code completion). Now that I have a rough idea of how to get objects to move within the game, I'll add some extras such as sound and screen-based text. Should be a lot of fun.

Monday, October 11, 2010

Jacked-Up .blend Files

For some reason or another, it has been a busy start of the semester, even though I have one course reduction and also minimal preps since I'm teaching a course I've already taught in the past. Getting the NEH Digital Humanities Start-Up Grant team together, the proposal written, and submitted took some time, in addition to my other committee responsibilities at the university. Pretty soon, the semester was half-way over and I hadn't done any real development work on the project directly.

To get me back into development, I formulated a project workflow that would increase my knowledge of Blender and Unity while getting a prototype game developed, which I hope to test live in my beginning German language and culture course next semester: (a) view a few videos from Blender Essential Training; (b) import models into Unity; and (c) begin programming game in Unity. Imagine how frustrated I was when, after opening the .blend file for the main building in the game, I noticed that I could not get the models to rotate while in mesh mode:




After I had checked other .blend files, which seemed to work fine, I came to the realization that the model file itself must - somehow - be corrupted. Nothing I did seemed to correct the problem, and I'm not even sure I could fix it, so I was forced to revert to a prior version. Good thing for backups! I did lose some work, which perhaps equates to about 1-2 days of recreating what I lost.