VERC: Poor Man's Shiny Floors Last edited 5 years ago2019-05-13 13:16:56 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.
A shiny floor that seems to reflect that which is above it adds an impressive touch to many Half-Life levels. It is quite easy to do by simply cloning and inverting everything above it to a 'mirror image' below the floor, then making the floor a func_wall set to only partially render its texture (much like a window is made). You can find a tutorial on this method here. While the result is quite nice looking, it practically doubles the number of polygons rendered, and in some cases the effect is almost too good: the floor looks too cleanly polished for the environment it's in.

If you have ever ventured out of your cave where you sit all day at your computer making Half-Life maps, you will certainly have noticed that, in the real world, there are very few floors that are so well polished that they reflect everything above them perfectly. (I personally have seen only one such floor, in the F/A-22 hangar at Nellis AFB. Some 'clean rooms' might have floors this shiny as well.) More often, you'll find that the floor only reflects the very high-contrast objects above it: most notably, the overhead lights. There are plenty of hallways (in a hospital or a gym, perhaps) that have slightly polished floors with bright lights overhead; the only reflection you'll see in the floor is a sort of bright haze right below the lights. There might be no other detail visible in the reflection - sometimes not even the walls or ceiling. This is because the floor has not been spit-shined: it's only been waxed and buffed enough to make people slip and fall when they walk on it after coming in from the rain.

Thus, the floor's reflectivity is partially diffuse, as opposed to specular (mirror-like) reflectivity obtained with the first method described.

The method in this tutorial takes advantage of the fact that the Half-Life engine will render glowing sprites behind a func_wall set to rendermode solid: it will render them as perfectly as if the func_wall was not there at all. Thus you can make your floor totally opaque (except to VIS, of course) but the glowing reflection of the lights above will be visible through it.

Begin by creating a simple room or hallway, as usual. Mirror it below, but build only a rough construction: walls and anti-ceiling are enough. It won't matter about texture alignment, or even what textures you use down there, since the player will never see the mirrored room below. Create the floor; make it into a func_wall with rendermode solid and renderamount 255 (as if you were making a transparent/masked object, but use a normal floor texture). And please use a texture that looks like it could reflect somewhat - tile, linoleum, varnished wood, etc. If you use carpet, dirt, or concrete, it will look ridiculous. Now wherever you had lights overhead in the room, mirror them with an env_sprite set to rendermode glow and renderamount of whatever you want, in the cavity below:
User posted image
Compile and run; the end result is as follows:
User posted image
This is not the best example, but it serves to illustrate the basic concept. You will need to experiment with the sprite choice, scale, and renderamount until you get an effect you like. Note that the sprite needs to be as far from the upper surface of the floor as the lights above are - otherwise, it won't look like it's reflecting light, but like there are some glowing things embedded in the floor. This is why you need to build the room beneath as tall as the room overhead.

Some considerations and issues I have noticed:
  1. Try to make the walls below line up flush with the walls above. Because the floor is an entity and VIS can see through it, you'll want the visportals and leafs to be made as you expect. If you make the walls flush, then the effect on VIS will be none other than it would have been had you simply extended the walls downward.
  2. Since a model's lighting conditions are based on the closest world brush (non-entity brush) directly below it, two compile tool features cannot be used. The first is the ZHLT Lightflag option on the floor entity. The second is MHLT's null texture usage on the floor of the under-room. Either of these conditions would result in all models in the room (monsters, player's weapons, etc) not being lit and appear pitch black.
  3. Experiment with the textures you use on the under-room. Although the player will never see them, radiosity light will still bounce off them and illuminate (or fail to illuminate) the room above. I generally use textures similar to those in the room above; experiment with different things. The effect might be subtle, but it's there and should therefore be used to your advantage.
  4. Experiment with the ambient lighting in the room above. The hallway in the example map is dark, but it might have looked better were it brighter (the sprites will still be visible).
  5. With the floor made like this, it will not take decals in-game. Thus, bullet holes, scorch marks, and blood splatters will not appear on it. You may want to use it in an area where there won't be a lot of combat.
  6. The floor will not stop anything spawned by a shooter or similar process. The glowing sprites from the tau cannon will fall through the floor - and will be visible down there, which looks very weird and will ruin the effect. Shell casings from your weapons will seem to disappear as soon as they hit the floor. So will gibs from monsters or func_breakables. Use of a func_monsterclip over the floor does not seem to help. If anyone knows how to fix this, please comment.
Its drawbacks aside, this is a relatively interesting way to add some detail to your maps. It can be useful in no-combat stages as the game unfolds, in your mod's hazard course, in cutscenes, etc. I would not recommend it for use in a multiplayer map.
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.