CaulkIf you've been following our tutorials about how to build a couple of rooms with a curved wall and curved archway, you will have noticed that we didn't use the caulk texture. They looked good, so what's the point? Why do we need caulk? Firstly, the caulk "texture" is just another shader with the nodraw surfaceparm. Remember Alien3, where the creature wouldn't touch Ripley because she was pregnant with an alien? Think of the creature as the VIS engine, ripping through your map and tearing your CPU apart. It comes upon a caulk shader (pregnant Ripley) and says, "Whoa! Can't touch this!" I know that's a far-fetched metaphor but that's exactly what's happening. Here's a facsimile of a room with a curved wall in one corner. If you were looking down into the room, this is how it would appear:
Notice where the curve meets the two walls? It is at those two points that a Z-buffer conflict will occur, since the flat walls and the curve ends both share the same plane. Without the caulk texture---and in a well-lit map---the player will see where the Z-buffer rendering engine can't "decide" which surface to display. It does the political thing by trying to show both textures, resulting in an ugly "ziggy-zaggy" effect. So what about behind the curve? Who cares? Note the screenshot below:
The red and yellow arrows are a simplistic representation of the Visibility process taking place. In layman's terms, VIS comes screaming into the room, sees the curved wall and does the math. However, since the curve is a one-sided mesh, it goes THROUGH the curve, finds more polygons (brushes) and calculates them also. In our very simple map, this is not a big deal. But in large maps, where you may have many meshes, those extra polygons will bog down the rendering engine unnecessarily. Enter the caulk shader.
The pink areas represent the caulk shader. In the example above, we've split the North and West walls into two brushes on each side and then applied the caulk shader to those areas behind the curved wall.
The illustration above may lead you to think that the engine will ignore the polygons behind the curved mesh, but this is not entirely the case. I won't pretend to understand the technical workings of the VIS process, but the caulked polygons are noted by VIS and subsequently not drawn by the rendering engine. This internal decision speeds up game rendering by not having to draw unseen polygons. Additionally, you won't have any cheesy-looking visual artifacts. We can begin a whole discourse on VIS, QBSP and such, but it would be beyond the scope of this tutorial. Like a car owner, it behooves one to have a basic working knowledge of what's going on under the hood, but It's not necessary to understand engine geometry and applied physics to be able to drive back and forth to work. The same goes for mapping. As long as you can grasp the "why's" and "how to's," you should become a relatively competent mapper. Copyright 1999, by Terry DeLaney. Permission is granted to distribute this file as long as the author receives credit. |