HowTo:FullUnwrap8Potato

From VsWiki
Jump to: navigation, search

"Starting Big" in Potato Mode

This may seem like a big contradiction, but I'll begin the work by using an automatic unwrapper: Archi's. Why? Because I've had the horrible experience before of apparently being finished with an unwrap, but some tiny polygon somewhere in the mesh is not yet unwrapped, by default unwraps across the entire UV screen, yet there's no simple way I know of to find where on the mesh it comes from. So, I'd rather start working from a fully unwrapped mesh, even if the quality of the unwrapping is for the birds...


blender_shot89.jpg


It also helps to have an automatic unwrap saved somewhere as a reference for relative sizes of islands. And to make the islands more easily identifiable, we'll do more than just save this automatically made layout, but we'll also bake a texture from it. Then, if you have a color printer, make a printout and keep it handy. Our real unwrap will look completely different from the above horror, but you never know what questions the printout might help answer at some time or other. But keep in mind that Archy does its own breakup of the mesh into UV islands; i.e.: It does NOT respect your marked seams.

If you're in doubt about the horribleness of the above layout, please refer back to the "Think Hard" chapter, where I listed the requirements for a "good UV layout", --maybe print it out--, and then go point by point and see how the layout above meets, or fails to meet, those requirements. (Hint: there's only two requirements it meets, out of my list of 14...). Otherwise just trust me: You could never make a good texture based on that, and whateve texture you would make, it would take you forever, trying to figure out where things are in that rat's nest.

But okay, how did I do that? Simple: First divide your screen. Right-click on the the top or bottom edge of the window, click on Split. Then left-click on the split to move it. By default, you get the same view on both splits. This is good because, at laast myself, I like to have a split right in the middle of the screen, for UV unwrap work; and I can get the exact center by looking at the two images and moving the split line until they are cut identically (zoom in, make sure the same details appear at the edges of both images). Then you click on the bottom left icon of the right window and choose UV Texture Edit. Then change the left window from Object or Edit mode, to UV Face Select mode, and press A to select all facets.

The right window will show a total mess of vertices and be covered in overlapping facets, giving it a blue color. Just go to the UV menu there, top item, the Scripts, and pick ArchiMap, leaving everything at the default. Let it rip. May take an hour or two. Go for a Cafe Au Lait...


Done?

Okay, first save the file. Needless to say, I save my file often, with succeeding revision numbers. That way, if a corruption in the file creeps up that seems unrecoverable, I can go back to a previous revision number. This is a good time to save, because saving UV face layout sometimes causes Blender to crash and burn. Now go to UV menu -> Scripts -> Save UV Face Layout. Unselect SVG, make it look like...


blender_shot94.png


The purpose of this layout is NOT to serve as a layout. It's a long story; but Blender requires for an image to be loaded before you can bake stuff. What you may want to tweak is the Size. The size should be the size of the final textures for the ship. NOT the enlarged size you'll be working with during texturing. The size of the reduced finals. My standard is 512 for fighters and bombers, 1024 for corvettes to destroyers, 2048 for cruisers and carriers. For space stations I prefer to use multiple sub-objects with their own textures. This ship is a corvette, and therefore I set the size at 1024. (Note that, during texturing work (next tutorial) we'll be working at 4 times the final texture size: 4096, and we'll do all our xcf operations at that high rez, --only at the end to scale it back down to 1024.)

This will save for us a TGA --in my case called "Cutter17.tga"; you might want to open it in Gimp and save again as a .png, if you want to save disk space.

Now go to the Image menu -> Load Image, click on "Cutter17.png" or whatever the name is, and click Open. Congratulations! Now you're ready to bake.

Save the file again, and now go to the top menu, Render -> Bake Render Meshes -> Texture Only. Takes a few seconds. Then Image -> Save As... and give it a name. I just append "tex" to the default name.


Cutter17tex.png


The colors in it are the diffuse colors you assigned your material. I don't know how to bake the specular colors yet...

Next, press F8 for the World panel. Make the Horizon and Zenith colors black. Make Ambient color 1.0 blue, 0.879 green, and 0.932 red. What's magical about these values? Happens to be the balance of RGB components for starlight; --at least in this region of the galaxy. Next panel on the right, Ambient Occlusion. Turn it on, put samples at 16, Dist = about the length of your ship, Add, Plain, Energy = 1.0, Bias = 0.5. Then go again to the top menu bar, Render -> Bake Render Meshes -> Ambient Occlusion, and go for dinner.

Ready? Image -> Save As... "Cutter17ao.png" (I'm just showing 512 versions here, but I AM getting 1024 textures, of course.


Cutter17ao.png


You may wonder "why are we doing all these bakings if we're going to do a different UV unwrap?" Good question. I originally intended to go straight to unwrapping, but I changed my mind. Two reasons:

  1. Producing a set of basic textures now that we can test in-game will be fun and educational.
  2. We should do this as a matter of natural course. It helps identify possible problems with the mesh or the materials.
  3. One can release the ship with pre-release textures for feedback, for a kind of milestone achievement, and so that others can begin the work of adjusting the ship's scaling factor, fitting it with weapons, docking points, shields, etceteras; kind of parallelizing the work. And the ship can be used for game-testing already. By the time you're done with the unwrapping and the texturing, all the other work should be pretty much done.

So, we've got our diffuse materials and ambient occlusion bakes. We need one more thing: Local lights' contribution. To do that we need to use the old, trusty Radio Baker. Move your ship mesh and all lights to layer 1. Save the file, save again with a new name, like temp.blend, go back to Object mode, get rid of the UV Edit window, press F5 one or more times. till you get to Radio Baker. Only half your ship shows; no mirroring here. Remove all the distant lights you might have; only leave the local lights that should be permanently there. Also, delete all lights you might have placed on the mirror side of the ship. Max Iterations = 7777, Mult = 2, Gamma is 2.0 by default; make it 1.0, click Show Lim, bring ElMin down to 1, PaMin down to 10, click Limit Subdivide, click Collect Meshes, and set up the rest of the params so it looks like...


blender_shot95.png


Click on Subdiv Shoot Element, wait, Subdiv Shoot Patch, wait, and finally Go.

During the operation (takes a fair while) your ship might look very dark or very bright. Once the operation finishes, though, you can adjust the brightness with the Mult parameter, so let it rip, and don't worry.

And the result (after raising Mult to about 50):


blender_shot96.png


The orange things are my "Hot" material. What I'm interested in is what it radiates onto neighboring parts of the ship. I had totally forgotten: Lights are not used by the Radio Baker. It only uses radiant materials. My lights, at the top and bottom of the ship, are inside boxes of the same yellow radiant material I use for the lights in the docking areas; but those boxes are tiny, so I got hardly any light from them. What I will do is make those boxes bigger, and repeat the radio baking operation. Remember, this is a temporary file, so we can do whatever we want.

So, to discard the results, click on Free Radio Data. Then I go to Edit mode, enlarge the light fixtures, and run the thing again. This time I'll leave the Mult parameter at 50, since now I know this number will work, more or less...


blender_shot97.jpg


I cheated a bit and cranked up the gamma to like 1.6 or 1.7. Thing is, my light fixtures were still not big enough, and I'm lazy, and this is not the final textures anyways. You need to adjust the Mult parameter up until the brightest light recipients begin to reach saturation (maximum brightness), and then adjust down a bit. Click Element Filter just once, then Add New Meshes. You may get a warning if you're already using all 16 materials, so it's better to use up to 15. Something to remember. I deleted 2 materials and tried Add New Meshes again, and got the same warning; but when I checked layer two, the new mesh was there. I switched to Textured mode and the baking showed. SAVE! So now you have to go through all your materials and change them to VColPaint. Then go to potato mode, open the UV Edit window, Render -> Bake Render Meshes -> Texture Only, then Image -> Save As, and I postfixed my file name with "lights":


Cutter17lights.jpg


So, what do we do with all this?

Time for some Gimp work: Close Blender; open Gimp. That last image has too bright a "Hot" material. Select regions by color. A threshold of 19 worked for me. Then bucket fill the whole selection with a dark red. Not too dark, as we're going to darken this image eventually. Save as...


Lights Base: Cutter17lights2.jpg


Close. Open the materials bake we saved, the "tex" image...


Cutter17tex.png


Use the select regions by color tool. Too bad Gimp doesn't seem to have a way to select colors by saturation... Set the threshold pretty low, like 6 or 7 and start clicking on black, shift-click one white, and shift-click on every shade of grey you see, until your selection includes everything except vivid colors...


blender_shot98.png


Go to Color Tools, Curves, and drag the bottom-left end of the curve to the top, and the top-right end of the curve to the bottom --i.e.: invert the gray scale colors. Now menu Select -> Invert, so you got all the vivid colors selected. Go to color tools, Saturation; bring saturation down to -33, then brightness up 50 or so. Save that as...


Speccol: Cutter17speccol.png


Now, open the ambient occlusion we saved...


Cutter17ao.png


Go to Color Tools, Curves, and make the curve look sort of like...


blender_shot99.png


Save as...


DiffAO.png Cutter17diffao.jpg


Open the ambient occlusion again, but this time set up the color curves sort of like this:


blender_shotA0.png


Save that as ...


SpecAO.png Cutter17specao.jpg


Without closing it, File -> Open As Layer: Speccol.png that we saver earlier. In the Layers dialog, change the blending mode to multiply. Save that as Spec.xcf, and then again as...


Spec.png: Cutter17spec.jpg


That is, indeed, our ("final" for now) specular texture. Now open again the "DiffAO.png" we saved earlier, the brightened ambient occlusion. Open as layer the original "tex" materials texture we baked, change the blend mode to multiply, save as Diffuse.xcf, and then again as...


Diffuse.png: Cutter17diff.jpg


And that's indeed our diffuse texture. Now we get to the "glow texture": Open the original ambient occlusion we baked. Open as Layer the original materials bake, like we just did for the diffuse; and set blend mode to multiply. Then open the LightsBase texture we produced as a third layer. Set its blend ratio to about 50%, then blend mode to Add. Save as Glow.xcf and again as...


Glow.png: Cutter17glow.jpg


Actually, come to think of it, it seems that the lights themselves didn't come out... Nor did the windows, for that matter... Hmm.


Let's open Blender again. Open the last revision prior to the temp file, save as "temp2 or something". Well, you don't have to do anything; I'm just telling myself what to do :D. Anyways, what I'll do is turn all my materials to black, except the windows and the green, yellow and red lights. I'll make the lights normal diffuse colors and bake a new texture. The problem was that my lights were non-treaceable, some VcolLight... Here:


Cutter17win.png


So now I open the Glow.xcf again, slap the windows on a new layer, blend mode normal, and blend factor... let me see... 50% looks just right; actually, the glow texture was too bright before...


Cutter17glow2.jpg


Done with the texturing! :D That was easy, wasn't it? Didn't even have to pick up a brush... Now we need to put our mesh into Vegastrike format... Alright, start Blender again, open the save before the temporary we saved for Radiosity, save as a new temporary, say "temp2.blend", Object mode, F9, and where the Mirror Attribute is, click on Apply. Actually, for final work, you might want to ensure that all your vertices near x = 0 are indeed exactly at x = 0, by selecting them all, pressing . (dot), Shift-C, then S X 0 [Enter]. And you might want to do a Ctrl-A also to apply any scaling or rotation that might still be left in Object mode.

You'll need to turn the ship again so that the nose points to the positive Y axis, and the top to positive Z. Sorry; have to Ctrl-A again. Save. Now File -> Export -> Wavefront OBJ. Like this:


blender_shotA1.png


Try File -> New, then Import Wavefront OBJ, see if it loads back okay. Works for me.


Alright, close Blender, Gimp, everything, and open an Explorer (Konqueror) window into Vegastrike's bin folder. Copy the obj and mtl files in there.

Open a command prompt window and navigate your way to that bin folder. Type mesher, read the help.

Ah, yes, I remember now, so: mesher Cutter.obj cutter.bfxm obc. Then mesher cutter.bfxm cutter.xmesh bxc.

Open the created cutter.xmesh with Notepad. Now we read the instructions... :D

I had to change cutter.xmesh from

<Mesh scale="1.000000" reverse="0" forcetexture="0" sharevert="0" polygonoffset="0.000000"
blend="ONE ZERO"  texture="BlackCutter17ao.png" > <Material power="96.078430" ...

to

<Mesh scale="1.000000" reverse="0" forcetexture="0" sharevert="0" polygonoffset="0.000000"
blend="ONE ZERO"  texture="cutter.png" texture1="cutterPPL.png" texture2="cutterDMG.png"
texture3="cutterGLO.png"> <Material power="22.2" ...

I don't have a damage texture yet, but that can be fixed...


cutterDMG.jpg


Will that do for now? And, oh yeah, almost forgot, all the textures have to be flipped vertically; a mesher requirement or something.

Make sure ambient is 0,0,0 RGB. I also changed diffuse and specular colors to 1,1,1.

So, save the xmesh file, then mesher cutter.xmesh cutter.bfxm xbc, and copy the bfxm and all the textures to a "cutter" folder under the units folder. Now we have to edit units.csv to add the ship to the ships list:


(to be continued)