Skip to content

Lighting Props made with Propper

McGravel edited this page Jan 29, 2019 · 20 revisions

Table of Contents


This Article lays out the process by which you can bake lightmaps onto props in Counter-Strike: Source or any other Source 2013-based game.

This lays out only what I did to achieve the goal, there are many ways to achieve the same results.
Take what you can from this and use it to your own advantage.

The tools you will need and ones that are suggested are:

This can be useful for increasing the fidelity of generated models and to make them a more viable option for mappers.
The main audience for this article is surf mappers who use Propper to convert world brushes into models, mainly the ramps themselves.
This process will allow your Propper models to support lightmapping without any manual UV edits.

The reason Propper models do not lightmap correctly by default is because they use tiling textures, which involve the UVs going outside of the texture region where lightmaps are created.

In addition, Propper will compile multiple materials into the model, we can only use one for lightmapping. To get around this, we adjust the UVs of the model into the texture region so that we can bake all the textures down into one that’s inside the lightmap’s texture region and thus able to be lightmapped correctly.

There is a way to do this using Blender by:

  1. Decompiling
  2. Baking a UV texture
  3. Recompiling

If the textures you used were a stock part of the game you are mapping for, you will need to use GCFScape to extract them.


Step 0

If you have the source files from Propper you can skip this step.

The files you need are *_ref.smd *_phys.smd and the *.qc file for the models you are fixing.

Make sure you select the option for disabling normal mapping in propper_model options.

Open up Crowbar and make sure you are one the Decompile tab.
Once there, click the browse button upper right to pick the model you want to fix.
Leave the other options the way they are and click the "decompile MDL file" button on the bottom left.

You should now see some files in the "decompile 0.XX" subfolder in the folder where your original compiled model was.

The "decompile 0.XX" folder will have the version number in it.
For example, this Article uses version 0.24, so the folder is called "decompile 0.24".

Back to the Table of Contents


Step 1

Open up Blender, and go to File > Import > Source Engine.
Select the *_ref.smd or *_reference.smd file in the subfolder or from Propper source folder and import it.

Go into Edit mode and Select All, open the Image Viewer and you should see the UV islands.
You will probably get something ugly like this:

Notice how the UV islands are outside the texture region, this is what we want to correct:

We will replace these UVs with ones that are inside the texture region and we will replace the texture(s) with one that combines the textures and old UVs.

Back to the Table of Contents


Step 2

We need to get the textures used for the model in order to bake them into a single lightmappable texture.
First go to the Materials tab in the Properties window and mark down the name(s).

We will need to use VTFEdit to save image format versions of those textures.
In VTFEdit, open the .vtf file you need to export. Export it anywhere you want.

Back to the Table of Contents


Step 3

Now, in the Materials tab in the Properties window, select each of the materials and add the texture you extracted.
To do this, select the material and go to the Textures tab in the Properties window.

Click the + New button, then open the texture you extracted for the material.

Back to the Table of Contents


Step 4

Next, while in edit mode, go the the Data section in the Properties window. Add a UV map and give it a name.

Now in the Edit window, go to Mesh > UV Unwrap > Smart Unwrap Project.
Your UV map should look something like this:

The textures on your model will look a little weird right now but they will be fixed in the next step.

Now, in the image editor window, click the New button to create a blank image.
Name it something and pick the size you want.

The size you choose is important since it'll determine the end quality of the texture, higher size is better quality but higher file size.

You should now see a black background behind your UV islands.

Back to the Table of Contents


Step 5

Now select all of the UV islands and keep them selected for this step.
Go to the properties window and to the render tab.
Open the bake section and change the mode to textures.
Click bake and you should see the textures being baked onto the new image you created.
Notice that the textures are all lined up like they should be.

Now go to Image > Save as image in the image editor window and save the baked image somewhere.
Add a new material and name it something good, like the name of the model.
This will become the name of your .vmt file.
Now change to Edit mode and select the model, click the "Assign" button in the Material tab whilst you have the new material selected.

At this point, you can optionally add the image you saved previously as a texture to check it works.

If your texture is completely black, check the "Shadeless" box in the materials tab.

Back to the Table of Contents


Step 6

In the scene tab of the Properties window, go to the Source Engine Export section.
Specify the folder you decompiled your model to and also specify the /bin folder for the game you're mapping for in the Engine Path box.
Click the Export button and choose the model.

Back to the Table of Contents


Step 7

Now go back to Crowbar and switch to the Compile tab. Select the .qc file that was generated during decompilation.
Click compile.

If you know how, you could change the name in the ..qc file so you don't overwrite the old model.

Back to the Table of Contents


Step 8

Finally, import your baked texture and save it to the materials/models folder where the materials for the Propper model were saved.
Create a .vmt file for the texture and name the same as the material your chose in Blender.

At this point you should be ready to go.

Load up Hammer and place your prop_static, enable lightmapping on the prop by selecting Yes in the dropdown next to "Generate and use lightmaps".
Set the size of the lightmap texture that will be generated, there is a trade off here too, bigger size means bigger file but more quality.
Run with -StaticPropLighting in VRAD options and the model should have lightmaps baked into it.

You should get decent results off the bat, with some lights to tweak what it looks like you will have nicely lit props.

Back to the Table of Contents

Clone this wiki locally