11.23.2012

The UVMapping Hurdle.

I'm actually writing this post while I'm in the middle of figuring this out.

This has actually had me stuck for a long while now, and that's model/mesh texturing. In a perfect world, I feel like you should be able to just directly paint onto the 3d object and save it as a texture file to use later. That's probably an option for the really high-end stuff, but when you use the free stuff beggars can't be choosers. I've known for a long time it's possible though, and it involves this thing called UV Mapping. I don't quite get all the technical bits about it, but the important part her is that UV maps take 3d objects and flatten them out into 2d schematics. Those 2d pictures are what you use to create textures on/with.

For a while, I thought I could get away with not doing it. I thought maybe if I could get clever enough I could make my models efficient enough that I could just do a simple material instead of a full texture. That doesn't work though, and at it's best it still wouldn't look that great. It doesn't help that it looks like it should be incredibly easy. Blender has a button that says 'Unwrap to UV' and another to 'Export UV map to png'. Over in Unity, you can apply a texture with a regular drag-and-drop directly onto the model.

I can't count how many weeks I've been stuck on trying to get this to work. Only right now do I think I may have finally cracked it, so here we go. Right now, I'm using the Y-Frame from the Unicycle as my experiment. It's a custom mesh made of 2 separate pieces overlapping. The top bar (the seat would be connected to the top) is a cylinder that flares at the bottom. That opening is normally hidden by the bottom half, which is another cylinder that's been elongated, bent into shape, and the ends have been tapered off where the axle for the wheel would go. Looks like an upside-down tuning fork.

It's also the front half of the bicycle.

The answer to my problems is a single button that says 'Mark Seam'. It's not very descriptive on it's own, but  it does exactly what it says. You pick out a line of points and click that button to create a seam in the object. Then when you go to unwrap it, Blender has a point of reference for how to unwrap it. I don't think there are any specific rules regarding how you're supposed to mark of the seams, like if you're supposed to open it top-down, or sideways, or whatever, so I went with what made the most sense.


You can ignore that one grey square. That's some dumb Blender thing.

That's a top-down view of both separate pieces of the frame. Now from here, I can export it as a png and use it as a texture template. This is extremely helpful if you have super hi-poly models, because you can craft intricately detailed models, flatten them out, save that texture, then paste it on a low-poly model to make it look identical. I haven't gotten that far yet, but I don't think I need to right now. My current vehicles are already low-poly and look well enough. It'll probably more important later when I start working on level art and assets.

Anyway, now that I have this uv map, I think I'm supposed to export it to Gimp, paint a texture file, save it, bring that back over to Blender, and replace the 'blank' uv map with the painted one. I'm still a bit fuzzy on details, but if this works it'll be a huge breakthrough. I still have to deal with getting it to work in Unity, but at least things are moving in the right direction.

There is still one other annoyance I need to solve in Blender. One of its options lets you split the screen up in many different ways, and each panel can be any combination of Uv/Image editor, Render Viewer, Animation Console, Default Workspace, and several other such choices. It's pretty handy and sometimes mandatory. The problem is that each window can be resized or created, but not deleted. Furthermore, if you shrink the window at all the other window(s) don't move to compensate, but instead just create a duplicate window. You can sort of resize it to almost-zero, but not really. The only way I know to fix it is to just save everything and restart Blender. Seriously, look at this mess. That's about a dozen different window panels of the SAME THING. Ridiculous. I wish I could say that that's the only time it's happened to me. Today.

11.14.2012

Nollij + Progress

Copyright Bill Watterson, posted with the highest respect.

Note - I was recently hospitalized and am on pain-killers while writing this. I'm aware it's not a great decision to write in this condition, but I've been putting this off for a while. In any case, should my tone get confusing or long-winded, you know why. 

It's hard to quantify the current 'progress' of the Racer project. There were a few false starts, a couple restarts, and for all the time I've found/spent, I can't say there's any tangible progress made towards it. No new models have been rendered, no level has been constructed, no scripts written. That isn't to say I've been slacking off though; I've spent as much time as I possibly can working on making this game happen.

If memory serves me right, my last post regarding the Unity book. Since then, I've read nearly every page, footnote, article, and referred link it's had to offer. With less than 100 pages to go, I'm on the chapter regarding final deployment; how to build the program, last minute efficiency-boosters, things like that. The included tutorial that's run through the book was to make a simple first-person puzzler, and each section of the book shows you basic scripting commands and their practical usages. It's been sort of slow, but the "Survival Island" game is done now. The player is stuck alone on a sizable island, and the goal is to light the campfire to signal for help. One booth has a minigame where you throw coconuts at targets and the player is rewarded with a battery. After finding the other 3 conspicuous batteries, a bunker is powered and its door open, revealing a pack of matches. Total play time is about 2 minutes. Nothing exciting at all, but it's taught me damn near everything I need to know about making the rest of my game.

If I'm honest, it was sort of boring. It was difficult to stay concentrated on it long enough to actually do any of it. I stuck with it because I knew that even though it was taking a lot longer to get to what I wanted to do, I needed a proper foundation of knowledge first. Too many screw-ups have happened, a lot of time has been wasted, and I'd rather just spend a little extra time and do it better. Righter. More correct.

I've also realized that the occasional change of pace helps me stay focused. A couple weeks ago I bought some graph paper, some folders, a clipboard and a few other things so I can work on paper. It's actually been incredibly helpful. I've plotted out several different designs for menus and gui-buttons, character sheets, and I even drew out my Dev Level.

Level 0-1, Click here for big

This is the first thing I'm going to build. It'll have every element that will get used in the game. This includes power-ups, hazards, mechanics, misc items, event triggers, and anything else I can think of. It's strictly going to exist to figure out how things work and getting everything set right. Hopefully though, if I get everything set properly here, I can drag-and-drop it into the levels afterward and not have much to do in terms of 'creating' it.

To further expedite things, I went and got a Blender Book to go along with the Unity Book. It seems a bit more geared to person-character creation (as opposed to vehicular creation) but my track record with Blender so far hasn't been great. It may take making yet another pass at building my two basic vehicles, but at least then it'll be done more correct. I've not started reading it yet; I've wanted to finish the Unity Book and the tutorial project before I tackled it, but it's about to happen.

The next update should have either new vehicle models or some semblance of a playable level. Either way, it's starting to get fun.

PS - I've also been wanting to do an entry regarding the Tower project, but I don't think that's going to happen anytime soon. I recently had some computer problems and had to reformat. I've not reinstalled Visual Studio, and frankly, I think it's been too long that I don't remember much of it. Furthermore, I can probably do it a lot better and easier in Unity later if I really had to. It'd save me the time of writing an entire simulation engine. I dunno. I just feel horrible because EVERY open source SimTower clone I've seen gets about as far as I did, stops, then disappears. I wanted to beat the curse, but maybe not.