In this second part I will explain how to properly clip the model by making a clipmodel...

By default ALL models that you import into your map or not clipped

- In other words - Players can walk right through the model and also bullets, grenades and smoke / airstrike canisters can be thrown through the model. To avoid this we need to clip the model.

 

When clipping your model it is extremely important to keep the clip around your model as simple as possible. As a rule don't create any clips that are 2 units or less in size and try to avoid any clips containing complex shapes.
There are two reasons for this: Firstly, because all collision data is stored inside the bsp file it will make your compiled map larger in file size when using complex clipping. Secondly, Complex clipping will have a huge impact on your ingame 'fps'. Although current pc processors can handle this, there are still many players out there that are using an old pc for playing w:et. So again, Try to keep your clipping as clean and simple as possible!

There are Basically 3 different ways to clip the model:

1) Creating clip brushes around the model.

This is the best way to clip your model and you should always try to use this method first if possible, but sometimes not the easiest nor the fastest way. If you intent to rotate the model you will notice it can be a real pain to manual place clipbrushes around the model. Particular when your model already has an irregular or organic shape ( like rocks).

2) Using the "autoclip" feature.

There are 2 different ways to clip your model automatically:

1) By adding the keyword "q3map_clipmodel" in your model's shader For example :

models/castlemap/sewerpipe
{
q3map_clipmodel
implicitMap textures/xlab_wall/xconcrete_c58m.tga
}

If you apply the above shader to any brush - or any face of that brush - It will block players after compiling your map.

 

2) By adding the key/value "spawnflags 2" inside the Entity Window for the model.
Although this is probably the fastest and easiest way to clip your model, You should never ever use this method for small decorative models - like our wirepole for example - You should only use this for large chunks of terrain or bigger structures. If you use this for several small models you will soon run into the problems that I mentioned above. The problem with the autoclip method is that it will clip every single face on your model, again, if your model contains faces smaller than 2 units or contains complex shapes you will eventually run into problems because of this.

 

 

This is the method I will be using for our wirepole model. This method has been used for years with idtech4 games (doom3, quake4,Quake Wars & Wolfenstein) and is in my opinion the best way to properly clip your model without running into fps problems or ending up with an unnecessary large bsp file of your map. Basically it contains the same steps we did in the first part of the tutorial.

 

Let's start by re-opening our 'wirepole.map' file in gtkradiant. (figure 1a) I placed some simple caulk brushes around the wirepole: These brushes will eventually be our clipmodel ( figure 1b). Put metal textures on the surfaces that are metal and put wood textures on the surfaces that are made out of wood (figure 1c). For the moment these textures are just placeholders and will later be replaced by proper clip-shaders..
Delete the wirepole so we only end up with the brushes we just created. Save this map as "wirepole_clip.map" , do a bsp compile and convert this bsp file into an ASE file - Just like we did in the first part of the tutorial- In your etmain/maps directory there should now be a file called "wirepole_clip.ase". Move this file to your etmain/models/mymodels directory.

Now we need to create some new shaders for the clipmodels. The reason why we need to do this is that the wirepole model contains metal and wood surfaces. If a player shoots at the pole we want to have wooden hitsounds and bulletholes for the wooden parts and metal hitsounds for the metal parts of the wirepole.

Open up notepad, copy and - after adjusting your paths - paste the shaders below:

This is the clip shader we use to block players AND to have wooden hitsounds.
textures/wirepole_model/aseclip_wood
{
qer_editorimage textures/common/clipweapwood.tga
surfaceparm nodraw
surfaceparm nomarks
surfaceparm woodsteps
}
This is the clip shader we use to block players AND to have metal hitsounds.
textures/wirepole_model/aseclip_metal
{
qer_editorimage textures/common/clipweapmetal.tga
surfaceparm nodraw
surfaceparm nomarks
surfaceparm woodsteps
}

 

Save this file as a shader file - for example: mymodels.shader or mapname_models.shader - in your etmain/scripts Directory. In my case I saved it as "wirepole_model.shader"

In the same Directory look for the file called "shaderlist.txt" , Open it up in notepad and at the bottom add your just created shader by typing "mymodels" or "mapname_models" In my case I just added "wirepole_model". By adding our shader to the shaderlist we've made sure that the clipmodels on the texture will be displayed inside gtk radiant....

The shaderlist.txt file is ONLY used by the radiant editor and NOT by the game engine! In other words the only reason why we add a new custom shader to the shaderlist is to make the shader appear within the radiant Editor: When compiling a map the compiler completely ignores the shaderlist.txt file, instead it goes through the "etmain/scripts" Directory.
For the final step in this tutorial we need to assign the shaders we just created to the clipmodel. We do this by opening up the wirepole_clip.ase model with wordpad - NOT notepad! For some reason notepad can't handle ASE files correctly, so use Wordpad instead!-
After opening up the wirepole_clip.ase file in wordpad search for this line "*MATERIAL_NAME" behind the material name is the shader we gave the clipmodel when we compiled it in gtkradiant. We now need to replace these shaders with the new ones we just created.

Replace and save the file... We're almost done now. Open up gtkradiant and import the "wirepole.ase" file as a misc_model. Use angles to rotate the model. At the same spot import the "wirepole_clip.ase" file and use the same angles for rotation. In the entitybox use a key / value of spawnflags 2 to autoclip the model...

After compiling our wirepole will now block players and give the appropriate hitsounds when shooting the metal or wooden parts of the model.