Tutorial #4: Adding Reflect and Glow

There are some rather fine meshes out there that sometimes leave me wishing they supported refl and glow textures. In this tutorial we’ll cover adding these effects to meshes that never had them. First a note on terminology. Freedom Force has always referred to ‘refl‘ textures. The NIF file format and 3DSMax exporter refer to them as ‘gloss‘ textures. I’ll use that terminology here.

We choose to add effects to Gni’s magnificent Alien mesh. Download this beauty from http://membres.lycos.fr/gniz713/PageWeb.htm
We need to do some preparation. First create a copy of the alien folder, call it alien_test. Then we need gloss, lightmap and glow textures to use with the mesh. Pick an existing lightmap and copy it into the standard folder. Rename it alien_lightmap.tga. For testing you want very bold effects textures so you can easily see it all works. Use a copy of the alien.tga as alien_refl.tga. It’ll be really shiny if it works. For the glow I recommend copying the alien.tga to alien.glow.tga and putting a white blob on his head.

The easiest way to proceed is to use an existing effects mesh as a guide and source of reference nodes. Open female_basic_effects in NifSkope. Select file, open new window and open the alien_test mesh in this second window. Set your textures directories so both are textured. Then select view,blockdetails. You are going to be working a lot in those block details, so it’s worth the tiny preview.

First we’ll add the glow and gloss textures.
In female Basic_effects, open scene root,female basic,editable mesh,NiTexturingProperty. You’ll see the three textures we all know as children of NiTexturingProperty. Do the same for the Alien. Scene principale,Alien,__NDL_MultiMtl_Node,Alien:1,NiTexturingProperty reveals only a single texture. We need to add the gloss and glow. Adding the glow is easy. Left click on (Alien window) NiTexturingProperty, then right click, Texture,add glow map. It’s that easy. Click on the purple flower, browse to the skins,standard directory for the mesh and select alien_glow.tga. You’ll notice the preview change. Instant glow. Compare the new NiSourceTexture with the version in female basic. Notice that a flag, ‘use Mipmaps‘ is different in the alien. Double click on MIP_FMT_DEFAULT and change it to MIP_FMT_YES. Now click on NiTexturingProperty in both windows and click the plus next to ‘glow texture’ Notice the difference? Change Filter mode from FILTER_NEAREST to FILTER_TRILERP.Then change unknown 1 to and you are done. What about the wireframe? The UV map? By default, when you add textures it will use the same UV map as the existing base texture. This is really conveniant. So don’t change the ‘UV set’ on the NiTexturingProperty node for the added textures. Leave it as the default of 0.
The gloss texture is a little trickier. Texture,add texture does NOT have a gloss texture option, so we need to add another base texture and designate it a gloss texture. Left click on NiTexturingProperty and then right click, block,insert. A HUGE submenu will pop up. Select S,NISourceTexture. A new NiSourceTexture appears but it is attached to node 0. Don’t worry, we’ll soon fix that. Note the node number of the new texture. Mine is 170. Look in the block details for the Aliens NiTexturingProperty. Find ‘HasGlossTexture’. It’s set to No. Double click and change it to yes. Now click the + on the next line to open up the gloss texture parameters. Source is set to ‘none’ or -1. Click on it and change the -1 to 170. Instantly the new texture node appears in the right place. Click on the purple flower to assign the right texture, Alien_refl.tga. Note there was no change to the preview. Compare the female basic and Alien parameters on the NiSourceTexture (change Use Mipmaps) and NiTexturingProperty (Clamp mode from CLAMP_S_CLAMP_T to WRAP_S_WRAP_T; Filter mode from FILTER_NEAREST to FILTER_TRILERP and PS2 K from to 65461. The last step is doubtless irrelevant unless you plan converting FF to work on a PS2). Save your work (remember to be sure of the directory) and check it in the character tool. If all went well you will see a glow effect but no gloss. Why? We need to add some light and a lightmap for it to work. Close Character tool and roll you sleeves up once more.

Adding the lightmap
Examine female_basic_effects. You’ll see several nodes the Alien does not have: Omni01 and an NiTexture effect. Actually you’ll see the same nodes with the same numbers twice. It’s down to the way the lights were added to the scene. Inspection of several different effects meshes will reveal several slightly different but equally valid ways of laying out the lights. We’ll go with what we see in female_basic_effects and we’ll do it the easy way by copy-paste. You could build the light nodes up from scratch if you liked.
Click on the NiNode Omni01 in female_basic_effects. Right click, block,copy branch. Then in the Alien window, left click on Node 0. Right click block,paste branch. An exact but renumbered copy of the nodes appears, including a reference to female_basic_lightmap.tga in the NiSourceTexture! Double click on this and change it to Alien_lightmap.tga. Now left click on NiAmbientLight in the female_basic_effects window and again copy the branch. Paste the branch on node 0 of the alien. As we copied nodes, the settings are correct for Freedom Force. But Look. There is only one set of nodes. What’s wrong? Left click on Alien node 0. Look at the very bottom of the block. Num effects is . On female_basic_effects it is 2! Change number of effects to 2 on the alien. You then right click on effects on the next line down and select array,update. Now there is a plus sign next to effects. Click to open it and you’ll see two ‘ref’s to ‘none’. Double click on each one in turn and change the -1 to the numbers of the new NiAmbientLight and NiTextureEffect nodes. (for me 180 and 178). The ‘extra copies’ of the nodes now appear in the tree view, just like female_basic_effects.
Save your work and check character tool. Go have a rest, you’ve earned it. Then do some proper effects textures for the nice Alien. It’s earned it.