Rendering Doom 3 models, HORRIBLE texture seams.

Started by
7 comments, last by ankhd 11 years, 1 month ago

This is something I've been wondering for a while as I was using some Doom 3 models for testing my renderer.

Here's a screenshot.

http://i.imgur.com/J7O3iK9.jpg

Notice how down the middle, he has those seams. This is using my deferred shading engine and when I look at the normals in the Gbuffer, the normals are also full of seams there, while the diffuse output looks fairly OK.

The legs also have some nasty texture seam artifacts going on, and I can see these horrible seams when I render the specular gBuffer as well and see how the specular textures map on. The insides of the arms look especially bad.

I remember back in the day on my shitty graphics card, I'd have some seams down the middle of models and it seems to be a complaint around the web people have had. Forcing the normal maps to be uncompressed seems to have been the fix, and nowadays when I play Quake 4 and Doom 3 on higher than ultra settings by tweaking some cvars, I never see these seams.

My renderer is just loading the normal maps as they are in tga format in the .pak. I saw some dds textures in the paks as well and I assume Doom 3 actually uses those, but I don't have a dds texture loader just yet. (I'm also surprised at how much scratch work and useless stuff is inside the pak files that isn't really used by the game, but I'm also really greatful it's there)

Here's a forum post where they actually say to enable some sort of compression on normal maps.

http://forums.cgsociety.org/archive/index.php/t-182031.html

Advertisement

From what I can gather from the links and info you posted, this texture seam is also in the Doom 3 engine and is a result of the way the normals in the model resource file are compressed? I believe they used normal mapping, where they modelled the actor at a higher polygon level, then reduced the polygon count but kept the normals at the higher level and baked them into a normal map.

So the question is how are you rendering these models? Have you loaded the normal map and are you decompressing it (and how) and how do you adjust the normals based on the values in the normal map?

This is a common problem when baking normals, and can be improved by blending the connected pieces to together.

This is usually avoided by placing the seams in a unseen place like below the arm on the side, the only reason I can think of doing it like this is if a model is viewed from behind 95% of the time.

Notice how down the middle, he has those seams.

You need to take care of mirrored normal maps, e.g. the chest is mirrored at the middle line. In this case your engine needs to take care of two things:

1. Correct handling of handness of the tangent space.

The tangent space of a normal mapped model often uses left-handed and right-handed tangent spaces together. If you strictly use only one handness, some normals will point into the model resulting in wrong lighting (often the whole half of a model is wrongly lit, this seems to be not an issue here).

2. Vertex splitting.

I don't know if the doom model format already take care of it, but you need to split vertices when the handness of the tangent space switches, which is the case when using mirrored normal maps. In this case some vertices will share the same texture/normalmap uv coords, but will have different tangent spaces.

OK, I was actually using Assimp to convert the md5s to my own format. Maybe Assimp is messing something up. I might try to take a look. I can try debug drawing the tangents on the model and making sure they face opposite directions, which I think would indicate the handedness switch?

I'm not sure how to explain the ugly seams at the legs though.

To be honest, it is really hard to notice your seams in your image, it does not help to render 10.000 models with an psychedelic color scheme tongue.png. Try to render a single model and mark the seams.

One problem with md5mesh format is that it does not store normal vectors, so the mesh needs to be smoothed after it is loaded. If the artist used some custom smoothing schemes when baking the normals, the renderer has no chance of getting the correct results. I guess that Doom 3 smoothes the meshes uniformly or uses some sort of fixed threshold smooth angle, which is then also used when baking the normal maps.

Note that at texture seams, there are degenerate vertices, which should have the same normal. To properly smooth the mesh, it is not sufficient to compare if two faces share the same vertex index, but you must actually compare the vertex positions, possibly with some threshold distance.

OK, maybe Assimp needs to be tweaked. I don't really intend on using Doom 3 models for ever though, just while I'm developing because they're so friggin cool. Our artist would export things as Dae, With Normals, and then this would probably not be a problem for our real assets.

looks like when you make half of a body in 3d and you dont weld the vertices at the seam.

This topic is closed to new replies.

Advertisement