Jump to content
  • Advertisement
Sign in to follow this  
Kazade

Holes when rendering Quake 3 maps?

This topic is 3889 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I've got a strange problem in my engine. I can load and render some quake 3 maps without any problems. At the moment I'm not rendering meshes, patches or billboards; only faces are loaded. While some maps render fine, others render with holes I can't find anything in any of the Q3 map specs that explains this, anyone have any ideas? Here is a "normal" map: and here is a "holey" map: finally here is the code that takes a Quake map polygon and splits it into triangles:
for(vector<stQ3Face>::const_iterator it = faces.begin();
					it != faces.end(); ++it) {

	//At the moment only handle normal polygons
	if ((*it).type != 1) {
		continue;
	}

	int end = (*it).startVertexIndex + (*it).totalVertices;

	for (int i = (*it).startVertexIndex; i < end - 1; i++) {
		WorldTriangle newTriangle;
		newTriangle.m_Index[0] = (*it).startVertexIndex;
		newTriangle.m_Index[1] = i + 1;
		newTriangle.m_Index[2] = i;

		newTriangle.m_TexCoords[0] = vertices[newTriangle.m_Index[0]].texCoord;
		newTriangle.m_TexCoords[1] = vertices[newTriangle.m_Index[1]].texCoord;
		newTriangle.m_TexCoords[2] = vertices[newTriangle.m_Index[2]].texCoord;

		newTriangle.m_TextureName = path(textures[(*it).texID].file).leaf();

		slVec3 vec1, vec2;
		vec1 = m_VertexData[newTriangle.m_Index[1]].m_Pos - m_VertexData[newTriangle.m_Index[0]].m_Pos;
		vec2 = m_VertexData[newTriangle.m_Index[2]].m_Pos - m_VertexData[newTriangle.m_Index[0]].m_Pos;
		slVec3Cross(&newTriangle.m_FaceNormal, &vec1, &vec2);
		slVec3Normalize(&newTriangle.m_FaceNormal, &newTriangle.m_FaceNormal);


		m_TriangleData.push_back(newTriangle);
	}
}

Share this post


Link to post
Share on other sites
Advertisement
You said you weren't rendering Bezier patches - could the holes be places where patches would normally be rendered?

Share this post


Link to post
Share on other sites
No I don't think so, it's as if every other triangle in the mesh is missing. I thought it could be to do with the winding of the vertices alternating but disabling backface culling does nothing.

Share this post


Link to post
Share on other sites
Why do you split the triangles from the maps into triangles? This makes no real sense, except for subdivision.

I just had a look at my Quake3 loader and it doesnot load any "polygons" or triangles strips from the files. Only the triangles are loaded and used for rendering and this is the way to go... there are no holes or any other render errors in my applications with this.

I had a very short look at your code, so only another small question: Why are you calculating normal vectors? These are already saved in the map file...

Share this post


Link to post
Share on other sites
No, notice I use i + 1 as an index. The end - 1 prevents me reading past the end of the vertex array.

Share this post


Link to post
Share on other sites
Oops, shoulda refreshed...

OK, my engine internally only deals with triangles internally. Whereas Quake 3 represents polys as triangle fans. That is why I break them down into triangles they are then easier to deal with. I generate the normal because as far as I know there is no guarantee that all triangles in the fan will lie on the same plane (although it is likely).

Share this post


Link to post
Share on other sites
It seems to me the problem is with Quake3's shaders. Did you check that all of the 'textures' specified in the .bsp are loaded correctly? Because in q3 maps some textures are not really textures on the disk, but rather 'shaders' which describe special texture properties like blending, animation, etc.


Ivan

Share this post


Link to post
Share on other sites
Hmm, well that would explain why I am always missing a load of textures from the maps I'm downloading, but I doubt that the geometry would be entirely missing. My engine just binds a texture ID of 0 (i.e. draws it white) if the material is missing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!