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.