Sith Holocron

Bump Mapping Tutorial Request (for novices)

Recommended Posts

I believe it's been a while since I've made a request.  I'll make this brief as I think the title pretty much covers it.

Might anyone be interested in making a tutorial for making bump maps - specifically with the novice in mind?  Granted as most of you use PhotoShop, it'll be of significantly less use to me. However I'm sure it would make those making new texture mods with PhotoShop pop quite a bit.

  • Like 3

Share this post


Link to post
Share on other sites

When talking about normal maps for 3D models like weapons, armour, placeables, etc., generally the "correct" way to do it would be to generate the map from a high poly version of the model. This is what is known as baking. In modern texture generation, this is often as much for creating the diffuse texture itself in the first place as it is for use with the final game model. Here's an example from some of my own experiments with recreating the Ebon Hawk textures from scratch. Take LEH_grwall01. This is the vanilla texture on the left, and my recreated texture on the right (lacking a grime pass):

LEH_grwall01_Vanilla.jpg.33a2e7bed8f4a37f9c1b32a8b7cfeb0c.jpg      LEH_grwall01_New.jpg.375696009aa6e2022aa04d23b2b2b236.jpg

I started by creating a 3D model of the original texture, like so:

LEH_grwall01_High_Poly.jpg.72efc40878b3fd85305832c1beb3aad5.jpg

This was the high poly model. The low poly model was a simple flat plane of two triangles. When baked out, this was the resultant normal map:

LEH_grwall01_Normal.jpg.7dd8facd6acb27ceb3eb262d39ff12b3.jpg

Obviously this approach is not always practical. Sometimes you'll want to generate a normal map directly from a diffuse image, which I gather is what you are primarily interested in. The simplest route is to create a greyscale height map. At its most simplistic, this would entail desaturating the source image and then running through any number of programs or PS filters to generate the normal map. For example CrazyBump, AwesomeBump, xNormal, etc. There are also some online tools to do this, for example NormalMap Online. Results through this approach will vary wildly depending on the quality of your source image.

As an example, let's take one of the texture sources from Sithspecter's "High Quality Blasters for Modders" modder's resource. We'll take w_blstrpstl_001 and simply desaturate it to create a pseudo-height map. Then we'll feed this into NormalMap Online:

SS_Blaster_Normal.png.5b962fec5d4657d0b9785b0b512f7a36.png

This is only about 30 seconds of effort, but the result isn't too bad considering. However if you have a look at the attached normal in closer detail, you'll see a lot of noise. This is typically very bad in a normal map, and in this case is somewhat exacerbated by NormalMap Online's lack of sufficient adjustment parameters to mitigate it. But really the root of the problem is that a diffuse is an extremely poor input source, especially in traditional textures that include baked/fake shadowing and highlights/specular. You can see in SS's source image that there are some highlights across the top of the main body, on the top of the sight back piece (bottom left corner), and along most curved edges. There is also a lot of noise in the flat areas from what I gather is the use of PS's Clouds filter, particularly noticeable in the trigger guard and surrounding area. Fortunately in this case we have some ability to quickly and easily tweak the height map, since SS's source is a layered PSD. Turning off a few of the noisy layers to create a new height map input, the revised generated normal looks like this:

SS_Blaster_Normal_2.png.eda7d5d8ae899e014c60e45b9ab5941c.png

Looking at the attached revised normal, you'll see there is now far less noise, giving a mostly crisp map. There's still a little bit of wonkiness due to the highlights - notably at the top edges of the grip/handle, the lens of the sight (top left), and the screw heads and scallops - but that's part and parcel of using this sort of image as a source. Those particular issues could be reduced or resolved with some manual adjustment of the height map. Just imagine it as a gradient where white is the highest point and black is the lowest point.

The thing to keep in mind with Odyssey is that its normal map implementation is pretty terrible. It's rarely worth the effort to create normal maps. I certainly wouldn't bother for anything small, like weapons or the like. Large floor and wall panels is probably where it will be the most notable, and these have the added benefit of typically being fairly simplistic in terms of the height details, meaning they are easy to create height maps for. Armour and bodies (like droids) can also make use of them, although this is best reserved for large details rather than lots of noisy fine detail. If you are thinking of trying it for stuff like monitor panels and the like I'd suggest you don't waste your time. Especially if it is going to be in a dark area (like the Hawk's cockpit). Stick with faked details in the diffuse for that sort of thing.

Edit: Still far from perfect, but here's a further quick adjustment of the height map to address some of the highlighted (no pun intended) problems:

SS_Blaster_Normal_3.png.068f58eb2fe818580b3bd2ce56e52a91.png

You'd actually want to vary the height of the straight panel lines I think, make them a dark grey rather than black like the scallops. And the top edge of the handle needs to be a gradient to get a nice smooth curve. Same thing for the scope lenses (see the screw heads).

w_blstrpstl_001_Generated_Normal.7z w_blstrpstl_001_Generated_Normal2.7z

w_blstrpstl_001_Generated_Normal3.7z

  • Like 4
  • Thanks 2

Share this post


Link to post
Share on other sites

Thanks for the reply even though I have no idea what this means as a non-PhotoShop user. If there are follow up questions for DarthParametric, please tag him in your response!

Share this post


Link to post
Share on other sites

PS isn't really of any relevance to this. You can use Gimp or whatever other image software you're familiar with. Actual generation of a normal map is done in other programs, as described in my post. Or via an online tool, as linked.

  • Like 1

Share this post


Link to post
Share on other sites

Something else I should address is the "direction" or "handedness" of normal maps - i.e. DirectX vs OpenGL maps. I have mentioned this before elsewhere, but for convenience sake I will recount it here. The green channel of an RGB (i.e. blue looking) normal map determines the Y direction (red is X, blue is Z) of the normal data. This is flipped/inverted between OpenGL and DirectX implementations. OpenGL uses +Y (raised details appear to rise out of the image), DirectX uses -Y (raised details appear to sink into the image). Like so:

NormalCheck_OpenGL.jpgSpacer_50.pngNormalCheck_DirectX.jpg

Images taken from here.

Odyssey uses OpenGL, so you always need to make sure your normal maps are +Y or they will look weird in-game. You can easily switch from one to the other simply by opening the normal map in your image editor of choice, going to the channels, selecting the green channel and inverting it. If we do another test example:

Example.png.bf34f9a25191d34dd9343a6bac5b8d4a.png

You can see we can easily switch between the two with a simple Y flip:

Normal_Map_OGL_DX.jpg.310560c6eb6941103750c2a6806198ee.jpg

Just make sure that if you are making normal maps for KOTOR that they look like the one on the left and not the one on the right.

Share this post


Link to post
Share on other sites

Pretty solid and comprehensive guide from DP there, nice one!

My own very limited experience of making normal maps for KotOR has been done purely in Photoshop to make them using the diffuse textures as a base as DP described above.

Like I said, I’ve only done some limited testing, but desaturating the diffuse texture and then making adjustments through levels and curves to get the right balance to been light and dark across the image depending on the level of detail you’re trying to produce.

Photoshop has limited options adjustment for the generated normal map in that you can adjust the level of detail and blur which it has. You can usually get a good balance between the two in a short space of time.

The results aren’t as good as doing it ‘properly’ and creating a high poly mesh to project the normal information from, but considering how poorly Odyssey handles and implements normal maps, the difference you see in game between the two methods is negligible to minimal at best in my admittedly uneducated opinion.

Share this post


Link to post
Share on other sites

You need to differentiate between a bump map and a normal map. A bump map is greyscale and only provides detail for a single axis (height). A normal map is RGB and provides detail for all three axes (X, Y, Z) - one channel (i.e. one greyscale map) for each axis. These typically look blue, what is known as a tangent-space normal (as you can see in my earlier posts). Unfortunately, Odyssey refers to both types as bump maps which is technically correct, albeit extremely unhelpful.

The error you are getting only occurs with normal maps. Normal maps are used in conjunction with the tangentspace flag in the model. If the model has the tangentspace flag enabled then you must supply an appropriate tangent-space normal map. For Odyssey, these must be RGBA, having a white alpha channel, and saved as a DXT5 TPC.

As far as TXI data goes, both types use the same semantics. The diffuse map requires:

bumpmaptexture xyz

where XYZ is the name of the associated bump/normal map.

The bump/normal map requires:

isbumpmap 1

at a minimum. It can also optionally have any of the following:

isdiffusebumpmap 1
isspecularbumpmap 1
bumpmapscaling 3

The first two are set to either 0 or 1 (false or true, respectively). A diffuse bump applies to the diffuse texture, a specular bump applies to the envmap (when used in conjunction with bumpyshinytexture in the diffuse). Typically you'll want to specify both of these and set them to 1 (I believe otherwise diffuse defaults to 0).

The scaling value is an integer from 1 to an unknown maximum, but I'd suggest 10 would be the upper bound. This controls the intensity of the bump. Since Odyssey's implementation is pretty poor, you can try adjusting this number to values above 1 to get more noticeable results.

Share this post


Link to post
Share on other sites
1 hour ago, DarthParametric said:

 

The error you are getting only occurs with normal maps. Normal maps are used in conjunction with the tangentspace flag in the model. If the model has the tangentspace flag enabled then you must supply an appropriate tangent-space normal map. Для Odyssey они должны быть RGBA, иметь белый альфа-канал и сохраняться как DXT5 TPC, иметь белый альфа-канал и сохраняться как DXT5 TPC.

Is it possible for especially gifted (for stupid like me)? I want to deal with the error first. And then figure out the settings. For example, I pulled out the standard LTS_Bwall04B.tga. I want to try to put it in the Override folder. I need to convert it to DXT5 TPC.

I converted it according to the following parameters:
And got the same error.

 

1.png

LTS_Bwall04B.tga

Share this post


Link to post
Share on other sites
1 hour ago, DarthParametric said:

Are you using a TXI? As I said above, both the normal map itself and the diffuse texture require the appropriate TXI data.

Here's the vanilla TXI: LTS_Bwall04B.txi

The error is understandable. It's gone. Thank you! Please tell me where all the standard .txi are stored? I don't run into them in the Kotor tool.

Share this post


Link to post
Share on other sites

TXI data is stored in the TPC itself. Don't use KTool to convert TPCs. Fully extract the texture archives (leaving them as TPCs) to a folder. Download TPCView and run it. Go to where you extracted all the TPCs. Select them all, left-click drag them over the TPCView window, hold down the ALT key, release. TPCView will convert them to TGAs plus TXIs.

  • Like 1

Share this post


Link to post
Share on other sites
49 minutes ago, DarthParametric said:

TXI data is stored in the TPC itself. Don't use KTool to convert TPCs. Extract the texture archives (leaving them as TPCs. Download TPCView and run it. Go to where you extracted all the TPCs. Select them all, left-click drag them over the TPCView window, hold down the ALT key, release. TPCView will convert them to TGAs plus TXIs.

Wow thanks! I think I got it!

The principle is clear! I will play with the settings.

swkotor 2022-11-09 15-19-11.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.