Sketchup - Make Normal Map plugin

Sketchup - Make Normal Map plugin
This is a plugin for Google Sketchup to generate normal maps, primarily intended for Valve based games. *Note, works with v7 Windows, Mac with SketchUp 8, should work with all recent versions

A few caveats.

1. YOUR ENITRE MODEL is used to generate the map, EVEN HIDDEN geometry!

The model.raytest method used to intersect the model is dumb like that. I could code around it but manually walking the ents and testing takes forever so, you'll need to live with it.

2. While it's good for trim, it lacks actual texture. You could always overlay another bump over it of texture in Gimp/Photoshop, but for now, that's the breaks.

Unfortunately Sketchup doesn't provide a method to retrieve a texel from a material, if it did, then you could actually paint your model with other normal maps, and I could average it all together, and it would be much more useful, but alas, at the moment, it's not happening.

Your basic shape should represent your texture, so if you want a 512x512 bump map, you should probably draw a 512x512 plane to begin with. It doesn't have to be the "right" size, it doesn't even have to be the right aspect ratio, the plugin "fits" it to the dimensions of the bump map, but it's a good idea to have it at least match the aspect ratio.

Let's start with a simple example. (This assumes you have l4d2).

Where going to be using the "Metal/metalhull009b" texture, use GFCScape or what-have-you, to extract it as a BMP or TGA file.

Draw a square in Sketchup (it should be perpendicular to the XY axis (or Red-Green in Sketchup terms)

Load the "Metal/metalhull009b" texture you extracted and apply it.

Normal Map Plugin: Step 1

Now draw the geometry on it. *Note, you don't have to use a plane, you could use a TIN mesh instead and push and pull dents in it. But to keep it simple....

Normal Map Plugin: Step 2

Normal Map Plugin: Step 3

Now remember, EVERYTHING in the model counts and can be "hit", points, construction lines, etc.. If you want to see how the texture will look, CTRL-A to select everything. That bounding box, is the outline of the normal map.

Now when you're ready, go to the Plugins Menu and select Make Normal Map

You'll be presented with this screen..

Normal Map Plugin: Step 4

A little bit about the options.

Normal Width - The width of the texture (power of 2)

Normal Height - The height of the texture (power of 2)

Scale - This is the "depth" of the normal/bump map. Normals on a face, facing you cannot be "facing away", so basically the values of 0-128 are not capable and receiving light. In practice, values below 160 exhibit weirdness, they may look good up close but as soon as you move back a bit, the MipMapping goes screwy and you'll get unlit artifacts on your face.

So..., the minimum value (ie the bottom of your model) is considered to be the height of 160. So that leaves us 96 units to work with.

So what determines the range in the model? Again, the bounding box. Basically the top of the model is considered to be equal to the Scale and the bottom of the model is considered to be the min_map_height (160)

I probably should just change this to a floating point number 0 < FACTOR <= 1, I'll probably do that in the next version, I don't know why I never got around to it, but for now, that's the deal ;)

Invert Y (Valve) Source games use the opposite Green (Y) Normal direction than everybody else, so on the oft chance someone wants to use it for a different engine, I've provided the option of NOT inverting it. So if you're making a normal for Source, leave it set to yes

For this example, the texture I'm bumping is 512x512. Pick your options and hit "OK" to proceed.

You'll be prompted for a location to save the output BMP and a name. I chose for this example "metalhull009b_normal.bmp"

Depending on your geometry and texture size, this could take seconds, or minutes.

If all goes well, you'll get a dialog saying Normal Map Done

If you don't get that, something wrong has happened, open the Ruby Console (under Windows) and re-run the plugin to see what the error is, and let me know.

You should have something like this...

I threw together a VMT for it and here it is in game...

And finally.... I wanted you to read all that first ;)

Download: MakeNormalMap.rb Version 1

Right click and "Save as" the file to your Sketchup Plugins directory (usually C:\Program Files\Google\Google Sketchup 7\Plugins) and the start (or restart Sketchup)

Scroll to top