And finally… after more than six months! I bring you… the Weapon Modeling Tutorial! PART FIVE! UV Mapping!

Now UV Mapping is a bitch. You WILL hate it. It will haunt your nightmares. It takes months to master, so at the end of this tutorial, I’ll be providing a cheaters download for those of you who want to skip straight to Part 6 when I post it, and spend more time learning the intricacies of UV Mapping without missing out on the animation side of things. So without further adieu, let’s get started!

Before we begin, you’ll need to make a 1024px by 1024px PSD file, filled with a 50% grey colour, name it xsi_base.psd for now, as you’ll use it again and again for all sorts of models, later on we’ll rename it within XSI and save it as a seperate file.

Here’s how we left things last time, with a complete polygon based weapon, but with no UV Map and no skin.

env_cubemap

So to get things started, we need to apply a basic material to the model, that we can work from to create our UV and skin later on. So click on Material under the Get toolbar and select Phong, to bring up a new window.

env_cubemap

Then click the little plug shown below, and select Image from the drop down menu.

env_cubemap

In the next window select New and from File, then find your xsi_base.psd file and select that.

env_cubemap

The image window will update, removing the multi coloured rainbow image, and replacing it with a nice flat grey one! Now under Texture Projection, select New; Planer YZ. Then close the window and return to the main view.

env_cubemap

Select your main model (not the clip), and press Alt+7 together to bring up the Texture Editor window. Now hopefully, it looks a little like the image below. If it doesn’t, don’t panic. Just carry on with the tutorial, it’s a not a huge issue!

env_cubemap

So what you’re seeing is a flat representation of your 3D model, except currently, you’re seeing it from only one side. What you need to do, is separate out all the sides you can’t see, onto a flat 2D plane, which you’ll then paint! So, within the Texture Editor window, you’ll see a group of six icons, labeled X+, X-, Y+, Y-, Z+ and Z. These buttons allow you to select only the parts of the model visible from those angles. Click X+ to begin with, then select the Planar Projection button (shown in the image below), and select Best Fit from the drop down menu.

env_cubemap

You’ll see that it has selected all the points on the X+ axis, and separated them from the rest of your projection. Now hit the V (move) key, and move those points away from the rest, off to the side whereever you like. Use the S key to move around, zoom in and out etc, if you need to.

Repeat this process until all the view angles are separated into different parts. You should end up with six main sections of your weapon: Left, Right, Top, Bottom, Front and Back. Make sure to keep them grouped so you know which part is which, and if you get confused, select a section and refer to the 3D view to be sure.

Now, what you need to do here, is the hard part. UV mapping is like doing a puzzle… except none of the pieces fit together and there’s no picture to work from. Argh. The principle is, to create a UV Map that uses all the available space of the 1024 image, but ensuring that high detail areas get more space than low detail areas that the player wont see. It’s the ultimate in optimisation. You need to find ways to rotate, fit, scale and move all the different pieces, so they fill up as much of the image as you can, whilst still being able to understand what the hell you’ve done when it comes to painting it!

There’s some useful tools in the Texture Editor you can use to make this easier though. For starters, you can rotate and scale selected points using C and X respectively. You can also turn on Island Select, by clicking the ISL button, as well as tearing, which allows you to separate joined vertices. There’s also Snap, which you access from Tools; Enable Snapping.

env_cubemap

Now, once you’re happy with the UV Map, from within the Texture Editor window, select Edit; Stamp. Now this is VERY IMPORTANT. Make absolutely sure, you select PSD as your file type from the drop down menu, before naming your file. Name it something like assault_rifle.psd. Now change the 3D view to Textured Decal mode, and you’ll see a bunch of yellow lines around the parts of your weapon!

Once you’re done, it should look something like this!

env_cubemap

Good? I hope so! If not, grab the download at the bottom. If all is well though, open up Photoshop and your PSD file. You’ll see your UV Map now, with all the yellow lines and grey fill.

env_cubemap

Now I recommend before you start painting, that you separate the UV Map from the unusable space, by using the Magic Wand tool, with a tolerance of 0, to select all the dead space. Then hit CTRL-I to invert your selection, and then CTRL-SHIFT-J to create a new layer via cut, from your selection. Now you can separate out the pieces of the model by using CTRL-SHIFT-J until all the pieces are on separate layers, nice and organised!

env_cubemap

Now get painting! I recommend using layer styles to fill in most of it, with colours, internal shadowing, material overlays etc. Then detailing certain parts of the model after rasterising, with scratches using custom brushes etc. Once you’re done, it should look like this!

env_cubemap

Now if something went wrong, or you just can’t take UV Mapping any longer, then feel free to download the file below. It’s contains the XSI scene file, the UV map and all the UV Coordinates ready for you to open up and continue on to the animating tutorial next week. I do recommend you give UV mapping a shot though, it’s hard, but very rewarding!

Download: Complete G36 Assault Rifle – Ready for Animating

Instructions: Install the .exp file to the following directory: C:\Softimage\Softimage_Mod_Tool_7.5\Addons\ModTool_Database\Scenes
then put the PSD file wherever you like, and link it using Alt-8 and selecting it within the Explorer view.

See you next time for the Animation Tutorial!

The steps below are a guide to setting up a dedicated Jailbreak: Source 0.6 server through SRCDS.

1: Install SRCDS

SRCDS is a stand alone dedicated server, it doesn’t run through Steam. So grab yourself the Windows version of the HLDSUpdateTool from SRCDS (sorry, this is windows only for now, once we’ve got a Linux server running, we’ll do another post) and save it somewhere.

Once it’s downloaded, run the tool and go through the installation process. You’ll need to install it to somewhere on your server (or home computer for testing), and in a location without spaces in the folder name (e.g. C:\SRCDS\ or C:\Servers\SRCDS\).

Once it’s finished installing, go to Start; Run and type cmd which opens a command prompt and enter the following:

1
2
3
C:
cd srcds
hldsupdatetool

Orange Box Dedicated Server

This gets the latest version of the HLDSUpdateTool which is used to download the server files. You then need to type the following into the same command prompt:

1
hldsupdatetool -command update -game "orangebox" -dir C:\srcds\

Orange Box Dedicated Server

This step can take a while depending on the speed of your connection as it’s downloading all the files it needs from Valve’s servers.

Once that’s finished you’ll have all the files you need, but there are a few other steps needed to get the server working.

2: Move HL2 Directory

The next step is to open the SRCDS directory and inside you’ll find two directories, one called “orangebox”, the other called “hl2″. Move JUST the “hl2″ directory into the Orange Box directory and overwrite any files it asks you about.

3: Copy your mod files

Copy Jailbreak into the “orangebox” directory, so it sits beside the “hl2″ directory.

4: Valve.rc

Orange Box mods need a file called “Valve.rc” in the cfg directory of your mod, this is already contained in the Jailbreak: Source server files. It should contain at minimum the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
stuffcmds

// One time loaded server settings

// load the base configuration
exec default.cfg

// Disabling 'wait' prevents many exploitive scripts.
sv_allow_wait_command 0

// Enable user configs
exec autoexec.cfg

// Commands for SourceTV
tv_enable 0
tv_maxclients 25
tv_name "Jailbreak Source TV"

Finishing Up

At this point the server should be good to go, so the final step is launching the server, which can be done on the command line with:

1
srcds.exe -console -game Jailbreak +map yourmap +maxplayers 16

You could create a batch file with that code in for easy server launching too!

So there you go, nice and easy, if a little time consuming!

Just a quick one today, first blog post in almost six months! We’ve been a little busy finishing Jailbreak: Source 0.6! One of bugs we had for absolutely ages was finally fixed last week after Lodle from Golden Eye: Source helped us out. So I thought I’d repost this here in case anyone else developing an Orange Box mod has the same issue.

Basically, what was happening was that instead of Steam Friends saying we were playing Jailbreak: Source 0.6, it would say we were all playing Source SDK Base. This meant that people weren’t able to join on other players, they would have to load up the game and find the server their friends were playing on. Not an ideal situation!

The fix was creating a file called Steam.inf, which you place inside the base directory of your mod. Inside this file simply put the following line.

1
appID=218

That’s it! Now when you start up your mod, and join a server, you’ll be playing… your mod!

28
Jul

Particles are awesome. They’re even more awesome when you attach them to models and launch them into the face of your enemy. To achieve this, you need to attach particle effects to your models.

The first step is to create an attachment point on the model itself, this will act as the origin for the effect when the model is spawned in game. So load up XSI, and your model, then switch to the Animation panel and the Animation Mode as shown below.

model_particles1

We’re going to create a single bone, then envelope it to our mesh. So select Skeleton; 2D Chain, and draw the bone in the location you want the particles to spawn from, in this case the center of the model. Click once to start drawing, then click again to place the end of the bone. It will look kind of like a carrot.

model_particles2

Next we need to envelope the bone to the mesh, so select the bone itself by clicking on the middle section (the triangular part), then choose Envelope; Envelope to Mesh. Left click on the mesh to select it, then right click to confirm your selection.

model_particles3

Now click the middle section of the bone (the triangular part), and hit Enter to bring up the properties, change the name to something like “origin”. With this complete, re-export your model using the Valve plugin (don’t forget to export any animations and the phys model too).

model_particles4

Now open up your QC File, as you’ll need to make some changes. You’ll be adding a new section, but to avoid confusion or something not working due to the order it’s written in, I’ve pasted the whole of an example QC file below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
$modelname "weapons/w_sticky_nade.mdl"
$model "studio" "sticky_nade.smd"
$cdmaterials "models\weapons\w_sticky_nade/"
$hboxset "default"
$scale 40.0
//$hbox 0 "sticky_nade" -1.962  -1.967  -15.650  1.962  1.962  15.650
// Model uses material "missile side.vmt"
$attachment "0" "sticky_nade" 0.00 -16.00 0.00 rotate -0.00 90.00 -0.00
$surfaceprop "metal"
$illumposition 0.000 0.000 -0.003
$sequence shell "sticky_nade_idle" fps 30.00

$keyvalues
{
particles
{
    effect
    {
        name            "sticky_particles"
        attachment_type     follow_origin
        attachment_point    origin
    }

}
}

$collisionmodel "sticky_nade_phys.smd" {

    $concave
    $mass 1.4
    $inertia 1.00
    $damping 0.00
    $rotdamping 0.00
}

The sequence we’re interested in is the following part from the above code:

1
2
3
4
5
6
7
8
9
10
11
12
13
$keyvalues
{
particles
{
    effect
    {
        name            "sticky_particles"
        attachment_type     follow_origin
        attachment_point    origin
    }

}
}

The keyvalue, “name” must match the name of a particle that you’ve created, and this particle must be precached as the mod loads by adding a new entry to the particle_manifest.txt file, located inside the particles directory of your mod.

The second keyvalue, “attachment_type” allows you to specify what the particle effect does when the model is spawned in game. In this case, we want it to follow the origin, as it’s attached to a Sticky Bomb.

Finally the “attachment_point” keyvalue specifies the name of the bone that the particle effect will be attached to, this should match the name of the bone you created in XSI.

Now just compile your model, and start throwing particles around! Fun!

Creating your mod with the new mod wizard will put it in the Source SDK Tools window in the ‘Current Game’ list, which is all well and good, but what about your mappers?

They too can have the mod listed under current games, along with ensuring Hammer is setup to use the Mod’s FGD and copies files to the right directories for easy testing. All you need do is add a section for your mod in the following file:

1
<SteamDir>\steamapps\<account>\sourcesdk\bin\orangebox\bin\GameConfig.txt

This file is for the Orange Box version of the SDK, there is a simlar one in the ep1 directory for ep1 mods.

Open either up, and you’ll see a bunch of entries for the existing games in the list, hopefully including your mod. If your mod isn’t there, just make a copy of one of the existing entries and paste it after the last entry before the last 2 closing braces.

To set your own FGD so that Hammer uses it when your mod is selected, just alter GameData0 to point at it your custom FGD file:

1
"GameData0"     "c:\projects\jb\jailbreak.fgd"

You can also alter the other paths if you need to move the map directory etc, but I’d leave all the tools alone unless you have a specific reason for needing to change them.

For reference, this is the jailbreak section:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"jailbreak-dev"
{
    "GameDir"       "e:\steam\steamapps\SourceMods\jailbreak-dev"
    "hammer"
    {
        "GameData0"     "e:\steam\steamapps\<account>\sourcesdk\bin\orangebox\bin\jailbreak.fgd"
        "TextureFormat"     "5"
        "MapFormat"     "4"
        "DefaultTextureScale"       "0.250000"
        "DefaultLightmapScale"      "16"
        "GameExe"       "e:\steam\steamapps\<account>\half-life 2\hl2.exe"
        "DefaultSolidEntity"        "func_detail"
        "BSP"       "e:\steam\steamapps\<account>\sourcesdk\bin\orangebox\bin\vbsp.exe"
        "Vis"       "e:\steam\steamapps\<account>\sourcesdk\bin\orangebox\bin\vvis.exe"
        "Light"     "e:\steam\steamapps\<account>\sourcesdk\bin\orangebox\bin\vrad.exe"
        "GameExeDir"        "e:\steam\steamapps\<account>\half-life 2"
        "MapDir"        "e:\steam\steamapps\SourceMods\sourcesdk_content\jailbreak-dev\mapsrc"
        "BSPDir"        "e:\steam\steamapps\SourceMods\jailbreak-dev\maps"
        "CordonTexture"     "tools\toolsskybox"
        "MaterialExcludeCount"      "0"
    }
}

This can also be useful if you refresh your SDK content or otherwise manage to lose the source sdk configuration.

Enjoy.

14
Jul
By Wills, under General. Tagged:

We simply haven’t had a chance to write any new tutorials lately! I know there’s a lot of you looking forward to Part 5 of the weapon modelling tutorial, but I simply haven’t had a chance to write it up yet, but as soon as I do I’ll get it posted!

Likewise, thank you to everyone who’s submitted ideas for tutorials and things they’d like us to write about via email. We’ll try our best to cover them all in future tutorials and updates, as they’re all great ideas, so keep them coming!

Also, if you’re inclined to a spot of Twittering, and you like Jailbreak, then you might find this amalgamation of the two rather interesting: Jailbreak Source on Twitter!

Once again, apologies, we’ve been slacking off lately, but it’s all for a good cause (Jailbreak!).