VERC: Model Transparency Tutorial Last edited 15 years ago2003-05-07 23:47:00 UTC by Penguinboy Penguinboy

This article was recovered from an archive and needs to be reviewed

  1. The formatting may be incorrect as it was automatically converted to WikiCode from HTML, it needs to be revised and reformatted
  2. Some information may be out of date as it was written before Half-Life was available on Steam
  3. After the article is re-formatted and updated for Steam HL, remove this notice
  4. Please do not remove the archive notice from the bottom of the article.
  5. Some archive articles are no longer useful, or they duplicate information from other tutorials and entity guides. In this case, delete the page after merging any relevant information into other pages. Contact an admin to delete a page.
Note! Currently, the only way to view a model with its masked areas shown properly is to view it in the Day of Defeat 1.0 / retail mod. When other tools are available, this article will be updated.
Model transparency is a useful new addition to the Half-Life engine that will allow any model - player, weapon, or prop - to become "see through" in certain parts designated by the model's texture. This ability was normally only available with BSP polygons - world poly's. With the addition of this feature to models, an extra amount of detail can be added to any Half-Life environment without a significant loss of performance.

There are two types of transparency available in the Half-Life engine. The first form, Masked, will make certain pixels of your texture completely transparent - Masked will be the most common form since it allows you to add detail to a model without adding extra polygons. An example use of "Masked" trasnparency is with vegetation - a few polygons can now define entire branches full of leaves, while before they had to be made with world polygons.

The second form of transparency, Additive, allows you to achieve a full range of transparency. With Additive transparency certain pixels can be semi-transparent, which cannot be achieved with Masked transparency. An example use of Additive transparency is a vehicle window - a situation where you would want the glass to still remain semi-opaque.

You can achieve model transparency in two Steps.

Step 1. Prepare your model texture for transparency.

Taking your already textured model, you'll need to edit the peices that you want to be transparent. If you're using masked transparency, you'll need to fill in those areas with a solid color - I suggest using a pure color, something bright and obvious. I usually use either pure blue or pure red. Only a single color can be transparent - other colors, even if they are close to your transparent color, will not be transparent.

IMPORTANT: The color you choose to be your transparent color needs to be the LAST color listed on the color table for your final indexed .bmp. To change the last color in your color table in Adobe Photoshop, go to "Image", then "Mode", and select "Color Table." Double click the color square in the bottom-right corner (the last color), and change it to what you want to use for your transparency. Remember the RGB value of the color you've chosen.
color_table.jpgcolor_table.jpg
Next, you'll need to take that color and fill in the sections of texture that you want to be transparent. I suggest using the 'pencil' tool since it does not create wet-edges. Do NOT use the paintbrush tool - the soft edges of the brush won't read as transparent in the final model.

Save your texture, making sure its the correct format - BMP, 8 bit indexed color.

Examples of a 'masked' texture before and after editing:
non_masked.jpgnon_masked.jpg
masked.jpgmasked.jpg

Step 2. Prepare your .qc file for transparency.

This part is easy - all you need to do is add a line to let studiomdl know what textures will use which transparency. The general format goes like this:

$texrendermode "texturename.bmp" "<rendermode>"

So in the case of my hedgehog model which uses one transparent texture, the line in my .qc file would read as such:

$texrendermode "hedgehog_test.bmp" "masked"

That's it for 'masked' mode. Make sure you're using a compiler ( studiomdl.exe , attached below) that is compatible with model transparency.

Step 1 for additive transparency isn't as straightforward as masked. Generally, the color white will be opaque while the color black will be totally transparent. You'll need to experiment with your texture to get the right effect. No editing of the color table is required for additive transparency.

Step 2 for additive transparency is the same as masked except that the rendermode in your .qc will be "additive", not "masked". Textures that do not use transparency should not be listed in the .qc.

download

This article was originally published on the Valve Editing Resource Collective (VERC).
TWHL only archives articles from defunct websites. For more information on TWHL's archiving efforts, please visit the TWHL Archiving Project page.

Comments

You must log in to post a comment. You can login or register a new account.