How to Get a Half-Life 2 Model into a Real-Life Picture

Australian Nick Bertke came up with a cool idea: What if you could place those life-like character models from Half-Life 2 into real-life photos? Through a series of posts at the Garry's Mod forums of Facepunch Studios, he detailed a process that resulted in some amazing images. (The posts also earned 17-year-old Bertke not a little fame in Half-Life 2 circles; read this interview with him at Deathfall.com.)

If you'd like to try it yourself, we've put together this how-to article based on Bertke's posts as well as other tutorials. We don't want to scare anyone, but this is NOT an easy thing to do. Anyone looking to learn about 3D modeling should get a book or two. If you already know a little about 3D, then you should definitely look into HDRI. It's a great way to make your objects look real without having to deal with "global illumination" or "radiosity" render times.
 
If you want to experiment with HDRI without having to create your own HDR image, at the end of this article, you'll find an HDR file of our studio and some images to pose your models in.
 
First, let's get all the programs we need and download/purchase them.
 
GCFScape extracts Half-Life 2 models from GCF files
 
MDLDecompiler decompiles Half-Life 2 models  into SMD files so you can import them into 3D Studio Max
 
VPK-Tool converts Valve's texture files into TGA files, so that you can properly apply the Model's texture.
 
SMD Importer is a 3D Studio Max plugin that lets you import SMD files (Half-Life 2 models).
 
3ds Max 7 (Free 30-Day Trial)
 
HDR Shop (ver. 1.0)
 
Half-Life 2 and the Half-Life 2 SDK from Valve
 
GIMP or Photoshop

That's right. You'll need EIGHT programs to pull this off.
 

EXTRACTING YOUR HALF-LIFE 2 MODEL
 
1. Using GCFScape, extract the model you want to use from "Steam\SteamApps\source models.gcf"

2. Use MDLDecompiler to turn the MDL file into an SMD file that Max can read.

3. Install the SMD Importer in Max by moving the DLI file to Max's plugins folder.

4. Extract the HL2 model's VTF files from "Steam\SteamApps\source materials.gcf" using GCFScape. We used GCFScape's search feature to find "combine" and extracted the VTFs we wanted (Combine_Elite.vtf AND Combine_Elite_Normal.vtf) by right-clicking and selecting "extract". We use the Normal texture for our bump map inside Max, so that's why we extracted that one too.

5. Open the model's VTF files in VPK Tools (use the texture tab). Convert the VTF file to a TGA file by pressing the VTF to TGA button.

You should create a 'reflection map' in an image editor like Photoshop for your model. You can create it from a copy of your texture map. The more reflective a surface is, the whiter the map should be. If a portion of the map is completely white, that area of the model will be as reflective as a mirror. Reflection maps should be grayscale (only black & white).

6. Import the model in 3ds Max (make sure you select "import", NOT "open") and apply the TGA texture. Don't apply the "Normal" texture at this point, use the main texture. Max will prompt you for it.
 
 
CREATING YOUR OWN HIGH DYNAMIC RANGE IMAGE
 
We can't explain High Dynamic Range Imaging any better than Wikipedia, so why try? 
 
We're going to make our Half-Life 2 model reflect the colors and lights in our scene by lighting him with an HDR image of our scene. After the model is rendered, we can paste him into a picture of our scene and he should look like he belongs because his lighting and coloration will match the image's environment.
 
If you want to create your own HDRI file, you'll need a camera that can be set to different exposure times. Most digital cameras will do this. You'll also have to use a tripod because each image needs to be of the same thing and the camera can't move when taking long exposure images. You also need a ball with a mirrored finish. The mirrored ball is what you're going to be taking fourteen pictures of because it reflects all the colors and lights in your image. You can use a silver christmas ornament or get a garden ornament called a "gazing ball." We picked one up for about $10. The ball needs to reflect everything in the room or outdoor environment perfectly, so make sure it's round and has a metallic, mirrored finish.
 
We took seven pictures of the front of the ball and then moved our tripod to the side (90 degrees from our starting point) of the ball and took seven more pictures from approximately the same distance. Each picture was taken with a different exposure setting (each picture about 1 stop apart). Exposure is the length of time that the shutter stays open. You'll hear the shutter response take longer as you increase the exposure time. Your images should gradually get brighter and brigher as you increase the exposure time. The first image should be dark, but not so dark that you can't still see the brightest object in the image. Your last image should be bright, but not so bright that the entire image is washed out. We set our f-stop to 5.6 and did not change the camera's f-stop during this process.
 
NOTE: We took a few pictures of our scene without the ball in it so that we'd have some images to put our models into.
 

HDR SHOP
 
Next, follow these tutorials on the HDR Shop site to create your own HDR image:

For HDR Shop, we followed the tutorials pretty closely. However, after loading in our images, instead of calibrating our camera response curve, we left "Gamma" at the default value of 2.2. Being the trusting souls we are, we allowed HDR Shop to "calculate scale increments" by pressing the calculate button. We did not press any of those f-stop buttons on the right side of the dialogue.
 
For the second HDR Shop tutorial, we were perfectionists and decided to assemble our HDR image using two different views of our globe. However, we're pretty sure we could have just used one view of our reflective globe and called it a day. It would not have been perfect, but we're pretty sure it still would have worked and would have saved us an hour of our lives that we will never ever get back.
 
We found that our final HDR image was a little dark. To correct this, we opened our HDR file and used our keyboard's plus key to brighten it up. When it looked about right, we selected IMAGE>PIXELS>SCALE TO CURRENT EXPOSURE and resaved our HDR file.
 

PUTTING EVERYTHING TOGETHER
 
Moving on... back in 3ds Max, use this tutorial to set up your model to accept HDR lighting

For an even more convincing image, use Mental Ray and HDRI in 3D Studio Max (Mental Ray is one of Max's renderers).
 
After rendering out your model, save the render as a TIFF so that the model's mask is saved. In your image editing application (Gimp or Photoshop), select the model in Photoshop by control-clicking the model's ALPHA channel (channels palette). Copy the image and paste it into your scene. Finally, add shadows with the BURN TOOL and maybe do a little color correcting if necessary.
 

hl2 in real life

Here are some pictures you can play with and the HDR file we created in our studio:

Scene 1

Scene 2

Scene 3

Scene 4

HDR File
 
 
Happy rendering!