Skip to content
Dev Archive

The Dam - Bump bump, Bump bump

by Angry Beaver

Archived from the original dev blog and left as it was written, so it reflects the game as it stood in 2008.

So were up to the second week of displacements, people have often asked why I don’t cover more advanced stuff or the in depth stuff and really it’s for the simple reason I feel the need to build core topics and set precedence for my terminology and way of describing things. I have so much information I could spend years on just 1 advanced topic because I haven’t said anything before about how to handle the intermediary steps. To keep blogs intelligent and brief I’m building up a base of topics that I will move past once I believe enough has been said for a more advanced topic to be handled. Without having some good way to group together the pieces of ideas you end up with articles like last week that only laid ground work. This week should prove to be much more advance and useful; we’ll start with the 3 major sins of displacements.

The first thing that people often get wrong when doing displacements is that they displace the entire brush, this is a mistake, there are very few circumstances where you want the entire brush a displacement. The best thing to do is cover the entire brush in nodraw, then select only the visible faces and apply the grass/rock texture and displace those faces. The reasons for this are 2 fold, optimization and lighting. Displacement faces are a lot of triangles and should be avoided when then their not going to be seen for simple FPS reasons. The lighting issues come from a point I mentioned last week, light is always blended between the vertices on a displacement when they line up, and this creates a sort of smoothed look. Below is a picture that illustrates the problem. The left is a normal brush, the middle is just a displacement brush, notice the rounded edges, the last is four displacement brushes together, as I haven’t removed the hidden faces the lighting is smoothed with those faces, as those faces are dark it creates a dark seam between the displacements which I’m sure everyone has seen a post about in a forum if not made It themselves. If only the visible faces were displaced this problem would not occur.
http://members.shaw.ca/dvdgillen/BMS/Dam_DispShade.jpg


The next major sin of displacements is the displacement power. So you all will know the seriousness of my warning, I shall say this in English. You do NOT need 32 power 4 displacements to make that field, just no. You work at the lowest level of power you can get away with and only increase it when you find the shape you’re trying to make needs more resolution. You start coarse and work your way to fine. In fact ignore displacements for a second, YOU ALWAYS start coarse and work fine, you will never have your final effect first time round and you can’t build the details for a map until you’ve built the rest of it. Hammer out the rough shape (get it) and if it’s too rough increase the power, if power 4 isn’t good enough, you’re either doing something horribly wrong or you need to split the brush into several pieces. Heads will roll if I catch any of you ignoring the above.

The third and final sin of displacements is “placement failure”. To create realistic displacements that have few to no lighting glitches all your displacements should be able to sew to the other displacements, this creates a form of continuity that you can see and it helps form the terrain as one cohesive whole rather than a bunch of faces put together, it also allows several of the advanced features to work. In order for faces to be able to sew they must have matching edges or half of the edge must match. To take an example below, the first is what not to do, some people start with that then paint geometry until it looks put together properly, don’t be one of those people people! The second shows the matching edge version where all the edges line up, a good solution. The third shows a closer approximation to the first because it uses the half edge rule to allow some extended faces beyond the second examples, a layout like that might be necessary if regular brushwork were adjacent to the displacements.
http://members.shaw.ca/dvdgillen/BMS/Dam_DispAlign.jpg


Now we’ve covered the major things done wrong lets show you how to do some things the right way. The first thing is the subdivide tool, this simply ignores any geometry painting you’ve done and smoothes out the selected displacement edges that can be sewn. With something like a Cube it forms a sphere; with an L shape it would form a hockey stick like shape. Any edge that cannot be sewn to another selected face is not subdivided. So a tall brush with only the sides displaced and not the top/bottom makes a cylinder that goes form the original square into a rounded cylinder and back into a square again. It’s a very useful tool for 1 thing alone. Saving Time. A subdivide does not make a displacement, it will save you the time it takes to manually round an edge but after subdividing you still need to adjust the displacement either by trimming off excess with the clip tool or by adding more interesting and realistic shapes. For those unsure what a Subdivide might do below are a few examples of before and after; however, an important note is that subdividing does not like half edges and concave shapes. The more of either included before you subdivide the more likely an incorrect shape will be created.
http://members.shaw.ca/dvdgillen/BMS/Dam_DispSubd.jpg

Now I’ve told you manually editing displacements will need to be done so lets tell you the best way to do it, and that’s think small. The bigger the type of change you try to make at once the more problems you’re going to run into. I’m not talking radius of effect I’m talking move distance, instead of things like 15 and 20 as your move distance you should be working at about 1 or maybe even 0.2, the gradual movement of the vertices allows you infinitely more control and the ability to correct your mistakes quickly. Another reason its important is because of the soft edge when geometry painting, unless your affecting a large area the adjacent vertices will move little comparatively to the vertex your actually painting, this means your prone to creating a very jagged effect when moving things large values. The best process is to use the small value and move your brush across the surface that you want to build up, slowly building up the brush moving it across the area you want to build up, this takes a bit longer but usually produces an uneven effect that lends realism but also keeps the vertices very close to one another preventing sharp ugly drop offs. The smooth tool is another that requires small amounts. It takes the height of every vertex within its radius and averages them and moves them close to it relative to the smooth value. Values of 1 can completely flatten some cliff faces. As it flattens along the axis it’s rarely used as it will demolish smooth curves by instead turning them into angular steps when used by an inexperienced hand. The final note is that the paint geometry tool does not like decimals, it can use them fine but whenever you adjust a setting it will convert your move distance or radius to an integer, working at 0.2 that changes it to 0 meaning your painting no effect at all.

Now when you get down to using displacements practically there are a couple of tricks most people hadn’t realized. When the episode one engine was introduced there became a whole big mess about the collisions on displacements. The functionality was added to ignore certain types of collisions on displacements; this unfortunately meant that any map compiled for a pre ep1 game with the ep1 tools had non solid displacements unless they added –novirtualmesh to their compile parameters. Because of the whole kerfuffle over that issue most people missed the capabilities of the new displacements, being able to choose solidity added new and interesting ideas like having snow in your level that people actually sunk into. I have yet to see a map take full advantage of it so here’s a picture of Antlions in the snow with Santa hats.
http://members.shaw.ca/dvdgillen/BMS/Dam_DispCollide.jpg

Another thing to remember is that not every piece of rock everywhere is nice and smooth, some have jagged edges, having a sharp turn in your rock doesn’t always need more polys thrown at it so it can be smooth, to create the most realistic rock pick a type of rock or a geographical area, then study pictures. Some rock formations are sharp and pointy everywhere, others are nice rolling subtle hills, and others are like steps where the layers in the rock have eroded differently. I can’t ever say “make natural rocks by doing X” All I can advise is going to the source for inspiration.

One of the final things I’m going to advise on is dealing with stretch marks, each vertex gets a U/V co-ordinate on the texture, this means no matter where the vertex moves that part of the texture will remain with it. There’s not really much you can ever do about texture stretching in fact the only way to solve it is to make the problem worse. When a single row of your vertices gets moved too far from another then the texture stretches, the only thing to do is move that vertex closer, but then that stretches the texture with the vertex behind that. In order to “fix” it you adjust all the vertices so that the stretching present is actually uniform in its manner. When the texture is equally oversized/undersized along its length then it will look like it doesn’t have a problem at all, it only looks like a problem when the stretching is uneven across the face, the picture below shows the problem and solution on an easily visible texture.
http://members.shaw.ca/dvdgillen/BMS/Dam_DispStretch.jpg

And finally don’t do too much with one face, really. It will allow you to keep detail in your face and prevent texture stretching. Say for example you want to make a sharp hill ridge; you try this with one face and to get any height you either have horrendous texture stretching up the side, an extremely high power displacement, or have it build up slowly so people could walk up it defeating the purpose. Instead of trying to pull the shape of that 1 displacement out sooooo far, instead block out the shape you want. In the picture below the blue lines represent the underlying faces.
http://members.shaw.ca/dvdgillen/BMS/Dam_DispMulti.jpg

Now that seems simple enough but re read everything that’s been said, matching edges, blocking things out, all the technical things to track. It makes you wonder how anything like a cave ever gets built out of displacements, and the answer is simple “I hope you like jigsaws”, some people instead build the displacements out of cube building blocks but this creates a lifeless uniformity that requires too much work to break IMHO. Always keep in mind that it takes 4 displacements of the same power to equal one displacement of a higher power, and with that I’ll leave you with a shot of BM related jigsaw if you can guess where it’s from.
http://members.shaw.ca/dvdgillen/BMS/Dam_dispjigsaw.jpg