Normal and Specular maps with CrazyBump

Here's a little tutorial on using CrazyBump to generate Normal / Specular maps for the Source Engine. It's a nifty program, which can make awesome normalmaps and speculars for you quickly (just don't try it with UVmap textures. They tend to confuse it a lot)

A few notes on Maps, before we begin:
Source doesn't natively support Parallax Mapping (it's there, but disabled unless you have a coder come in to re-enable it), so the Displacement Map option can be safely ignored.
Specular maps from Crazybump will be used as $envmapmasks by the engine. See here for info on adding Specular cubemap reflections, and here for info on the $envmapmask options (which you'd be using CrazyBump to generate)
Normalmaps will be saved in a separate texture. They're referred to by the material vmt file (which you'll need for any texture anyway). See here for how to add bumpmapping to textures
Source does not support Ambient Occlusion, but you can still 'bake' it into the texture by copying it into a top layer and setting it to 'Multiply'

Map Generation / Workflow
I use Photoshop and CBump when making Source Engine textures. Usual pipeline is thus:

  • Make the Diffuse texture in photoshop. This could be as simple as a touched up photo, or something built entirely in photoshop.
  • Flatten the Image, select all, copy it and then paste it into Crazy Bump
  • Go back into Photoshop and undo the flatten command to get all your layers back.
  • Fiddle the sliders around in CrazyBump as necessary. Then start copying maps by right-clicking and selecting 'Copy <Map> to Clipboard'
  • Return to photoshop. The Ambient Occlusion map usually goes in a top layer set to Multiply, with the opacity fiddled with until I'm happy with it.

This is where things diverge, depending on what we're doing.

  • If you just want a Normalmap, then that's saved as a seperate VTF file. Usual naming conventions is yourtexturename_bump, but it doesn't really matter what you call it. You'll have to reference it in the .vmt file for Source to know it's there. Again, see $bumpmap for more info
  • If you just want a specular map (which you'll be using as an $envmapmask), then you can save it to your texture's alpha channel (assuming it's not already using it for transparency). Due to a bug, you'll have to invert this for it to be read correctly. Save the diffuse texture as an ordinary Compressed Texture with Alpha, and use $basealphaenvmapmask 1 in the vmt to specify that's where it is.
  • If you want to have both a Normalmap and Specular map, you MUST save the specular map to the alpha channel of the Normalmap. Source won't read it otherwise. Save that as yourtexture_bumpspec (naming conventions don't really matter, I just find it helps to mention in the name of the texture if the normalmap also contains a specular map) using the Normalmap with Alpha preset. In the vmt, use $normalmapalphaenvmapmask 1 to specify you're using the normalmap's alpha channel as the envmapmask

Because Specular maps are greyscale, it's best to save it as an alphamask rather than as a separate, standalone texture. If it's saved as standalone, it'll be in RGB format (you can't save as Greyscale with vtf, unfortunately) with three channels, whilst as an alpha channel for another texture, it only takes up one, which reduces filesizes.

NOTE: Due to bugs with the Photoshop VTF plugin, bear in mind these two things:
Once you've used the Normalmap or Normalmap with Alpha preset, the exporter will be 'stuck' on that preset, always saving in that format (specifically, with the 'Normalmap' and 'Trilinear' flags) whatever you set it to, until you restart Photoshop. It's a pain in the neck, to be honest, and can really break things if it's anything other than a normalmap. Fortunately, you can uncheck those two flags in VTFEdit.
The plugin will not save alpha channels if you haven't flattened the image beforehand.

A good way of knowing if Source knows about your specularity texture is in Hammer. If you set the 3d view to 'Textured' (as opposed to 'Textured, Shaded', which has a few bugs and won't display certain texture shaders correctly), you'll see the texture is visibly 'shiny'. It doesn't load the $envmapmask, so you'd have to use some debugging methods ingame to check those.


View comments ( 12 )

Back to top