Recently I’ve had a bit of a thing going on with the Lament Configuration box from the Hellraiser series of films. It’s purely platonic, I assure you, but something compelled me to make one. It’s been an interesting little exercise in mesh building, scripting and texturing and I think it makes a good base for a tutorial in texturing.
I’m going to skip over the mesh building and scripting since that’s not so interesting and concentrate purely on the texturing of the box. Also, of course, the Lament Configuration is a copyrighted entity, so just pretend you never heard me mention it and from now on we’re building the entirely original Lachyrmose Combination box.
Mesh components in Lightwave
The designs on each face of the entirely original cube are picked out in brass inset into dark wood. In order to represent this in SL with the materials system we’re going to need to control the diffuse channel (colours), the shine (specular channel), the glossiness (specular exponent), the reflectivity (environmental intensity) and bumpiness (normals) of the surface. This sounds like a lot but in this tutorial all of those textures are derived from just three original images : A brass texture, a wood texture and the pattern on the face.
The Wood Texture
I created this texture in Lightwave – most 3D and texturing packages will have a “wood grain” or similar texture that you can use to make this kind of image. If you don’t have access to that then feel free to use this one under a CC Attribution license or there are plenty that can be acquired on the internet under similar terms.
I’ve played with the colours a little in a bitmap editor and added a little hint of rippling light on top of the original render, just to give the surface a little more life.
The Brass Texture
This texture is derived from an image on Flickr by Jay Hilgert, author of the cool BittBox blog/site. The original is available under a CC Attribution 2.0 license.
I’ve reworked it a fair bit from the original, mainly adjusting the colouring to reflect a weathered brass rather than the original steel. This derivative image is, likewise, available for use under a CC Attribution 2.0 license.
Both this texture and the wood are at 1024 x 1024 pixels – this is larger than the final resolution I want but it’s always wise to work in a higher resolution than you need.
The Face Design
The Lachyrmose Combination box needed an entirely original design for its faces. I made three but we’ll concentrate on just one since the techniques used are the same for all. To produce this image I busted out Adobe Illustrator and the wacom tablet to produce a plain black and white image of the design.
This is it for the artistic part of the build – from now on it’s just going to be mashing these three textures up in different ways to produce the effects we need.
For the rest of the post I’ll be using GIMP, the GNU Image Manipulation Program, and a couple of other utilities to create images from the three original textures. I’m using the GIMP since it should be available to everyone, but other bitmap editors should be able to do all the same things.
The Normal Map
The normal map controls the bumpiness of the surface in SL. As I’ve mentioned in a previous tutorial on materials we can create a normal map from a height map using utilities like xNormal or Knald. xNormal is a free package; Knald is now $99 for a single user license – I used Knald to generate my normal map, but I’ve verified that xNormal does the job just as well.
Since I want the effect of the brass standing just slightly proud of the surface of the box the original pattern image does just fine as a height map. Running it through Knald or xNormal got me a suitable normal map:
We’ll be seeing this image again later when we combine it with an alpha layer to control the specular exponent.
Ambient occlusion is a good way of adding some depth to a surface without having to think too much – it’s almost as good as having radiosity without the huge computational hit. In my workflow, Knald will generate me an AO map along with the normal map – it’s a big time saver. If you don’t have Knald there are a couple of alternaitves:
xNormal has a tool that will generate an AO map from a height map. This tool is nowhere near as good as the height map to normal map tool and the AO textures it makes are pretty poor.
The other alternative is to roll your own in GIMP:
- Drag the original pattern image into a GIMP window.
- From the menus select Colours / Invert to change it to a black on white image. Go to Filters / Blur / Gaussian Blur on the menus and apply a 10px blur to the image.
- Drag another copy of the original pattern into the GIMP window – it’ll add it as a new layer on top of the blurred one
- Change the blend mode of the new layer to “Lighten Only” (just “Lighten” in most bitmap editors)
- Save the resulting image as a PNG
You can change the look of the image by altering the blur radius, or fade it out a little by adjusting the opacity. This won’t produce a true ambient occlusion map, but it’s pretty close.
The Diffuse Layer
This layer takes the wood texture, brass texture, ambient occlusion and the original pattern and layers them up to produce a final texture. The procedure in GIMP runs along these lines:
- Drag the wood texture into GIMP to open it as a new image
- Drag with brass texture into the new image to add it as a new layer
- Drag the original pattern into the new image to add it as a new layer
- Ctrl+A, then Ctrl+C to select all of the pattern layer and copy it to the clipboard
- Hide the pattern layer by clicking on the eye icon next to its entry in the layers palette
- Select the brass layer and right-click on it. Select Add Layer Mask…
- GIMP will pop-up a dialogue – select any option and click Apply.
- GIMP will automatically be in mask editing mode at this point
- Do Edit / Paste from the menu or Ctrl+V to paste the copy of the pattern layer from the clipboard to the brass layer’s mask
- The layer palette will show the pasted selection as a floating layer
- Right-click on this layer and select Anchor Down
This will produce an image with the wood texture as a background and the original pattern rendered in brass over the top. This looks OK but some more life can be added with the ambient occlusion layer. Drag a copy of this image into the image to add it as a layer and set the blend mode to Multiply. This will add an effect of darkening the image around the edges of the brass as if it’s been burned into the wood.
I ended up adding several copies of the AO layer, all with the Multiply blend mode, to deepen the effect further.
This technique of adding one layer over another with an alpha mask (or Layer Mask in GIMPspeak) is one we’ll be using again to create the other images. I won’t go through all the individual steps again, so refer back to the steps in this section for applying the pattern image as a mask to the brass layer.
The Specular Texture
The specular texture is a greyscale image that controls how much light bounces off each point on the surface. In this example I want the wood areas to be a bit shiny and the brass areas to be a lot shiny. This would be easy enough to achieve but I also want to let a bit of the original dirtiness of the brass texture come through to affect the shine so we need to take a little more time over it.
To produce a greyscale image that reflects the original brass surface is simple enough:
- Load the original brass texture into GIMP
- From the menus select Colours / Desaturate to produce a greyscale image
- Adjust the brightness and contrast of the image to produce one where the lightest parts are white (add brightness) and the darker parts aren’t too dark (lower contrast).
Save this image then create a new one at the same 1024 x 1024 resolution in GIMP. Fill this image with a mid-grey colour (RGB 127,127,127 or similar).
Drag the specular brass image in as a new layer and then apply the original pattern to it as a mask. This produces a light textured pattern over a grey background. This will have the effect of adding a middling, smooth shine to the wooden parts of the surface and a bright but slightly dirty shine to the brass parts.
The Environmental Intensity
The environmental intensity controls how reflective each part of the surface seems. The SL engine doesn’t do true reflection, of course, it uses something known as Environment Mapping. This is the old-style metallic shine SL used to have before the materials project.
For this surface we want to confine these metallic reflections to just the brass. The procedure for creating this image is the same as for the specular map above only fill the background of the image with black instead of mid-grey.
The Specular Exponent
The specular exponent controls how glossy each point on the surface is. In this case I wanted the wood to be a bit glossy and the brass to be very glossy. In fact, the requirements mirrored the specular map exactly, so there was no need to create a separate specular exponent map for this project; I just re-used the specular map.
Bringing it all together
Now we have four textures that we have created from the wood/brass/pattern originals:
- The diffuse texture
- The normal map
- The specular and specular exponent map
- The environmental intensity map
With the exception of the diffuse texture these images still aren’t quite ready for uploading to SL. The materials system uses single images for more than one thing, so you have to pack information into both the colour and alpha channels of an image.
The normal map’s alpha channel controls the specular exponent and the specular map’s alpha channel controls the environmental intensity, so we will need to take some of these images and apply them to others as an alpha map.
Using the procedure outlined above for applying an image as a layer mask to another layer in GIMP, load up the normal map and apply the specular map to it as a layer mask.
Resize the image to the final output size using Image / Scale Image, then save the resulting image as a PNG file.
GIMP will have you click through two export dialogues. In the first, Export File, dialog select Merge Visible Layers (the default) and then click on Export. In the second ensure that Save colour values from transparent pixels is selected and click on Save.
This will produce a final normal / specular exponent texture that can be uploaded to SL.
Do the same with the specular map, applying the environmental intensity map to it as a layer mask.
The diffuse mask requires no alpha, just resizing down to an appropriate size.
I have a tendency to forget which maps go in the alpha layers of which other maps, so I wrote myself a little app to streamline this part of the process. It’s nothing you can’t just chew through in GIMP, though – just remember to keep it straight which image goes on which alpha layer. The SL Wiki contains information on the texture channels for reference.
My cheat-sheet app
The final results
So, how does it look in SL with two more companion sets of textures for the other faces?
Well, pretty cool, I think. It’s hard to get a real flavour of it in a still image but seeing it in a well lit area it really sells the metal-embedded-in-wood flavour of the thing. The combination of specular reflections and environmental intensity can really make metals look like metals at last.
I hope this tutorial has given you some ideas, or at least shown how you can quite easily go from a simple black and white pattern to a deeply detailed materials surface in SL.
Every image in this post is available under a CC Attribution 2.0 license – remember to credit the original author of the texture from which my brass one is derived – so feel free to take copies and have a play around with them yourself.