29.3.11

Decals

I made some damage decals out of textures from cgtextures.com.

In game screenshot.

It's a bit more complicated than just throwing the texture in straight from the website.

The first, fairly basic step was to resize it to a power of two....size.

Then, I painted a black and white heightmap to plug into a bumpoffset node.
  
I also made a normal map, basically using the same techniques from here.
The other textures are specular and alpha. The alpha was easy, as it was provided by cgtextures. The spec was just made by manipulating the colour texture.



The height map, spec map and alpha map all went into one texture as the red, green and blue channels.
I could have put two of them into the alpha channels of the colour and normal maps, but then I'd have one map left over that didn't need a full rgb texture, so this way, if they're imported as "Compression No Alpha", there are no wasted channels.

So, because I was making a bunch of these, I made one master material to use (like this guy), so I could make a bunch of material instances, which are quicker because you don't have to set up the nodes everytime, or sit waiting for it to compile all the time.

I should probably point out that it's a DecalMaterial rather than a plain Material, because I forgot the first time and had to remake the material, because apparently there isn't a way to convert them.


Basically, because I converted the textures in the master material to texture parameters, when I make an instance of that material, I can easily add textures in the instance editor.

So anyway, I made a bunch of them, and some similar ones that weren't as complicated.


Decals are cool.


This is another one done in basically the same way. The parallax effect from the bumpoffset node isn't *super* apparent, but it does add a nice feeling of depth, and combined with the normal map means it catches the light quite nicely.

So anyway, there were a few of those.


The other thing I did today was to make a big fan.
The idea is that there's a big fan over the centrepiece of the scene, with a light going through it casting a cool shadow thats moving and so on.



So I made a crappy model and I baked a crappy normal map, and I made a crappy texture. Who cares, you won't be lookin at it.
See?

The shadow changes as the fan rotates, which is cool and badass and awesome.
The fan blades are a seperate model from the fan..housing? So anyway you need to convert the static meshes to movers (or the blades at least) and change the physics settings (in the f4 menu) to rotating instead of interpolating, and change the yaw under rotation rate to something interesting.
Then add a DominantSpotlight, play with its settings, and select the whole thing and create a prefab from it so you don't have to faff about later on when you want to import it into the actual map.

21.3.11

Centerpiece WIP

So the centerpiece of the level is gonna be this big scalar wave machine. Because scalar wave machines aren't a real thing I had to make it up myself. (although if you search for scalar wave weapons you will find a lot of very entertaining conspiracy theories).

This isn't a finished model by any means, there's gonna be a big pillar thing in the middle to throw a fancy animated material on, and lots of greebles and doo dads on the outside.



I'm also planning on painting my own skybox, including russian cold war landmarks like Duga/the russian woodpecker array.



I'm also going to make assorted props and decals that reference cool/weird/scary soviet stuff like the Lost Cosmonauts and Laboratory 12, and maybe even the A-241/BIS device.



20.3.11

Props




So I wanted to put a helmet laying around the env to imply that people/soldiers used to be there.

I'm not super bothered about historical accuracy, and tbh I haven't decided a specific timeline anyway, so I just chose a helmet that looked cool.

The high res base mesh was a doddle, as I wasn't going to put a whole lot of detail into it anyway. Tbh, with Udk's weak normals, I'm not sure how necessary the high res was anyway. Nonetheless, I did it anyway, including reshaping the model to ensure a decent bake.
The low res was dealt with similarly quickly and unwrapped. I baked normals and an amb occ map in xnormal, and used these as a base for the texture.
I painted two different mask textures: one as a mask for scratches (so scratches only showed up in scratchy places) and one as a mask for chipped off areas of paint, exposing bare metal. I combined these as two channels of one image. I could have each of them as the alpha channel of two of the other textures, which would be more efficient (one less texture to load) so I'll probably do that next time.


Anyhoo.

In UDK, I started setting up the material.
It's pretty complicated.


Basically, I'm mixing the base textures you see labelled above with three different tiling textures, controlled by masks. The first tiling texture is a bumpy normal map to simulate the surface of the helmet. If I'd baked that into the helmet's main normal map, the scale of the bumps would either be completely off, or unnoticeable. The other two textures are scratches, one for colour/spec, and one for normals.

The scratches are both tiled by the same TexCoord node, so that I don't accidentally get them scaled differently.


I'll start with the normals.


First off, the bumps texture ("Bumps") is tiled by a TexCoord node. Then, I remove the blue channel, by multiplying it by a Constant3Vector set to 1,1,0. If you don't remove the blue channel, it messes with your final normal map. Then, I use a LinearInterpolate node to mask that off, so it doesn't show up on the chipped off bits.
Then all that gets added to the rest of the normals.

Ok, then the normals for the scratches go the same way. First remove the blue channel, then mask it off (in this case using a different mask- the green channel instead of the red). I should have probably used the same Texture Sample for both, I'm not sure if that makes a difference. Probably does.

So that's the normals.

The spec is pretty simple, a scratch texture is masked off and added to the spec base texture. I also have a constant going into spec power to control the 'glossiness' of the material.

So that's the specular.

The colour/diffuse is probably the most complicated.
It has the scratches masked off in the same way as the other two textures, but it also has a reflection component.



For the reflection, you plug a reflection vector into a component mask, because afterwards you plug that into the uv's of the texture you want reflected, and RGB>UV means you have one too many.
This again gets masked off, and added to the base texture.
(oh btw the reflection texture is a fairly simple blurry render of some white columns)

It all looks a lot more complicated than it really is.

Oh yeah, one other thing. The base colour texture has been converted to a parameter. The reason for this is that I can make an instance of this material, give it a different texture as the parameter, and have multiple colour bases for the model pretty easily. The *really* efficient way to do this would be to create a master material with parameters for every slot like this, but as of now I'm still learning different things in the material editor, so I'll stick to normal materials for now.

Also, the scratches texture is pretty crap and tiles horribly, but I'll get around to changing it to something better eventually.




The in-udk view in the video is kinda crappy, to spin it has to be a mover, and mover's dont get lit by lightmass, so the lighting is pretty pish.

18.3.11

Fencing

So after getting a decent handle on UDK in general, I figured I would document the process of getting a mesh in-engine.

I needed a simple fence or railing for the interior of the bunker scene I'm building.

First things first was to check google images for a quick idea of the fence design.
Then I threw together a high poly model.






One thing to point out is that as I was making this model to bake normal maps out of, I made sure to keep clean bevels on any 90' angles, so the normal map would have enough of a ramp to actually show up on the final model.


The next step was to create the low poly model. This was simple enough, basically a case of discarding subsurf information and getting rid of a load of edge loops. The only really notable thing about the low poly was switching the modeled grating out for a simple plane, that could be alpha mapped in later.
I also mirrored a lot of geometry when uvmapping the low.


I baked out the normal map and an ambient occlusion map using blender's built in texture baking. Normally I'd use xnormal, but for some reason it couldnt read the high poly I'd exported. This meant I had to flip the green channel of the normal map before importing it to UDK, as blender uses a different coordinate system than UDK (just like maya, not like max).

I also tweaked the amb map, as blender's amb maps are always a lot darker than necessary.


Anyway, on to UDK.

One of the nice things about blender's ase exporter (which, by the way, you can get here) is that it's a lot less finnicky to use than the maya actorx plugin. Instead of typing some pish into the mel window, you just hit File>Export, like any normal person would assume. A weird thing, however, is that the scale is way off: exported objects are tiny. Because this causes problems inside UDK (collision, materials etc. get really messed up with tiny objects) it's best to scale up your model before exporting, usually by a factor of 10 or so.

So anyway, once the model was in UDK, the first step was to set up a quick material.
Because I was using an alpha map for the fence detail, I set the blend mode to masked, as well as turning on two sided. If I'd thought it through a bit more, I would have just duplicated the alpha planes and flipped the normals, as the majority of the model didn't need to be twosided. Also semi-of note, I did the alpha map the wrong way round in photoshop, so I used a 1-x node to flip it the right way round.

For the colour of the mesh/material, I used a simple seamless metal texture from another package, multiplying it with the ambient occlusion map I baked out earlier. Plugging a texcoord node with a value of 20 into the texture gave me a pretty good base texture that would still look high res when zoomed in. I did the same thing for the metal normal map I had, except this time I multiplied it by a Constant3Vector of 1,1,0 to remove the blue channel of the normal map, as otherwise it would throw off the normals I baked out earlier.


I probably should have put the alpha map into the alpha channel of one of the other textures, but I forgot.

With the model ostensibly finished, I realized I probably should have paid more attention whilst modelling it to make sure it fit well on the UDK grid, as this would make placement easier down the line. Fortunately, it was fairly close anyway, so it only took a little bit of maths and some to and fro from blender to udk to give me a mesh that was 128x4x64, which is a pretty useful sort of shape.
Whilst I was going back and forth, I also added in a couple of extra edgeloops to help with the shading. Without these few extra vertices, long polygons tend to shade strangely.


So anyway, that's the basic process, nothing fancy. Obviously a more complicated mesh would take longer to create, but the workflow is pretty sound, so I'd say this model took about an hour start to finish.

Android Phone Turnaround from Euan Mitchell on Vimeo.

Modelling Practice.

I think it's a HTC Hero phone, but I just chose it off a google image search for "android phone".



This is rendered in the blender realtime viewport., using simple reflection maps for the reflections, and a cluster of spotlights for fake soft shadows.