Today I would like to give you a step-by-step tutorial how to light up certain parts of a ready compiled static world model for Half-Life.
And, no, this is not the usual and well-known trick to brighten up the texture (which will not work as good for the lamp as this technique) or to brighten the whole model with a light entity.

First things first here is the list of the programs you will need in order to do what I will describe further down:

You can choose between a short version and a long version of this tutorial.

I will explain this technique on a lamp post as an example.
In Hammer the lamp post will look like this:
looking just right in Hammer

As you can see the sample lamp post has a very bright texture for the faces that are facing down, in fact it is nearly pure white color.

However, if you compile the map it will look similar to this in Half-Life:
not working as expected

Maybe you will have to brighten up the picture to see that the faces that are facing down are completely black!

Now how to solve this problem?
Short version:
  1. Decompile the MDL file so you have access to the reference SMD file.
  2. Replace the fourth value from the right (sixth from the left) for every face that is facing down in the triangles section
  3. Recompile the model with the edited reference SMD file




Now the long version, that describes all with more detail:
  1. In order to brighten certain faces up you will need access to the reference SMD file of the model.
    So, you will have to decompile the model. Luckily, the Milkshape3D has a built-in MDL decompiler.
    You can reach it via: Tools->Half-Life->Decompile Normal HL MDL Model File... menu
    Just to let the decompilation do not mess up your existing MDL/SMD files (the decompiler overwrites existing files without warning!) put a copy of the MDL file in a new created folder.

    Now execute the above mentioned menu path and point at the to-edit MDL file that is located in the new created folder.
    Check all four checkboxes and press OK

    Now, go to the new created folder where the copy of MDL file is. You will find at least two SMD files, at least one texture in BMP format and a QC file there.

  2. You want to edit the reference SMD file, to find out which SMD file is the reference one open up the QC file in Notepad.
    Search the QC file for the following term: $bodygroup body
    Below this you will surely find a pair of brackets that is enclosing the studio command followed by a name in quotation marks.
    To put it in a nutshell it should look like this:
    $bodygroup body
    {
    studio "test3-ref"
    }

    In this case, this tells us that the reference SMD file is called test3-ref!

    test3-ref.smd is the next file you have to open in Notepad, it should be in the same folder as the QC file, if not check if you have checked all four checkboxes on the decompilation-window.
    Search the reference SMD file for the word: triangles
    Below this should be a huge pile of figures and somenames.bmp lines

    Search the texture that the faces that are facing down are using. If there is only one single texture you will have a hard time to figure out which number corresponds to which face.


    In order to add another texture to the model and let the faces that are facing down use that texture you will have to import the reference SMD file into Milkshape3D: File->Import->Half-Life SMD..., save it as a MS3D file.
    Go to the Materials tab, press the button labeled new, press the first <none> button (the top one) and point at the new texture (BMP format with 256 colors).
    Select the faces that are facing down, go back to the materials tab and select the texture for the faces that are facing down, and press the assign button.
    Now export to SMD file format: File->Export->Half-Life SMD: Reference
    (maybe you should use the same name as the original reference SMD file, just to avoid hassles with compiling the model).


    Open up the new reference file and go to the line that states the name of the texture that the faces are using that are facing down.
    Replace the fourth value from the right (sixth from the left) for every face that is facing down in the triangles section

    Here is an example:
    facing-down.bmp
    3 3.5900 7.1211 21.8750 1.0000 -0.0000 0.0000 0.0000 1.0000
    3 3.5900 7.1211 16.2850 1.0000 -0.0000 0.0000 0.0000 0.0313
    3 3.5900 14.3111 21.8750 1.0000 -0.0000 0.0000 0.9688 1.0000

    Should look like this after editing:
    facing-down.bmp
    3 3.5900 7.1211 21.8750 1.0000 15.0000 0.0000 0.0000 1.0000
    3 3.5900 7.1211 16.2850 1.0000 15.0000 0.0000 0.0000 0.0313
    3 3.5900 14.3111 21.8750 1.0000 15.0000 0.0000 0.9688 1.0000

    Do this for all lines that are using the texture for the faces that are facing down.

  3. Recompilation of the model with the edited reference SMD file can quickly be achieved with:
    Tools->Half-Life->Compile QC file
    and pointing at the QC file from the decompiled MDL file, if you have used the exact same names as the decompiled components.


If you made everything right and use the new MDL file it should look like this in-game:
now working correctly

This concludes this tutorial. I hope you had a good time reading this.
In case you want to have a more in-depth description of the SMD file format and what all figures mean, see the tutorial about the SMD file format I have written.
If have found anything wrong in here, be sure to let me know via a private message or E-mail.

regards,
Sobek

Thanks to Rat for proof reading this tutorial, and to danmitch1 for using his pictures in this tutorial.