Terrain collision


Terrain models collide quite happily now. Meaning you can walk around on them as you’d expect. This isn’t the heightmap terrain, but a mesh made in Blender.

For some reason, q3map2 seems to treat terrain meshes as planar surfaces/triangle fans instead of triangle soup, so adding the meshcollide surfaceparm to the terrain shader directly did nothing. Only when I added a dedicated collision mesh with the meshcollide shader on it did things work. I don’t presently know why that happens.


In this image from Blender, white is the collision mesh.

The terrain has about 5000 tris, which I find acceptable for something this size, and the collision mesh was decimated to about 1200 tris. So the entire terrain has the polycount of 2 or 3 character models. That’s pretty efficient.

Heightmaps are somewhat limited in a number of ways. On the upside, they’re easy to make. On the downside, they must be made separately from the rest of the environment so there is guesswork involved, and they can’t be as detailed. You also can’t have vertical terrain or caves with a heightmap.

I’ll have to figure out a way to blend textures on terrain meshes still, otherwise I might go with a megatexture-like approach. We’ll see. I can probably use vertex colours to vary the brightness of the surface.

In other news, I’m still writing SJ’s quest system, and I started using a different method to create visportals in my maps. I found that severely reducing the number of visportals / leaves brought a large gain in performance, especially in very large and detailed levels. The reduction of the vis data is done by disabling blocksize (which keeps the compiler from automatically chopping the map into blocks, aka leaves) and instead operating more with hint portals, antiportals and areaportals. The polycount of a scene rarely seems to matter anymore. What matters more is batching. I got the idea to use larger vis leaves from looking at Call of Duty (and Doom 3) with their visportals / cell based occlusion.

Call of Duty also gave me a number of other ideas, regarding for example AI navigation and scripting. It must be one of the most impressive idtech-based games (I’m talking CoD 1 and 2 here.)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: