Page 1 of 2

Q3bsp

Posted: Tue Sep 09, 2003 5:28 am
by Demonmage
:cry: Hi,people!
Do its level in GtkRadiant 1.2.11, load in Irrlitch 0.4 and see that halfs of triangles no. I think this because of CULL FACE.
Please help.

Posted: Tue Sep 09, 2003 8:32 am
by niko
It seems that some people have this problem. Is it getting better when you disable backface culling? Like yourQuakeSceneNode->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false); ?

Posted: Wed Sep 10, 2003 1:46 am
by WhytWulf
Nope, I just played around with it and I got the same result.. actually not quite true. first time I put my q3node->setMaterialFlag(video::EMF_BACK_FACE_CULLING, false); in teh wrong place... got a nice crash out of it :)

second time in the right place, but no visiable change. It looks almost like the vertexs are getting sorted wrong, causing the some face normals to point inside a brush while others point the correct why ..hmmm

Posted: Wed Sep 10, 2003 2:01 am
by WhytWulf
I just used a different BSP compilier, it fixed all the problems and seems better too

http://www.inficad.com/~mnichol/dummies/index

It works and is simple to understand..

Posted: Wed Sep 10, 2003 5:49 am
by Demonmage
WhytWulf wrote:I just used a different BSP compilier, it fixed all the problems and seems better too

http://www.inficad.com/~mnichol/dummies/index

It works and is simple to understand..
:shock: Please, put tools me on mail, but that reference does not work!
tsantsinger@mail.ru

half a solution to a half triangle problem

Posted: Fri Dec 12, 2003 12:17 am
by rt
WhytWulf wrote:I just used a different BSP compilier, it fixed all the problems and seems better too
http://www.inficad.com/~mnichol/dummies/index
It works and is simple to understand..
i think that q3map2 is actually the compiler that GtkRadiant uses. i came across the problem you mentioned of a bsp level being loaded with only half of it's triangles showing. the following image is a simple hollow box room created in gtkRadiant and exported to bsp then loaded in irrlicht
Image

i started playing around with the command line switches and came up with a solution that seems to work. it seems the problem is that the first bsp build option in gtkradiant has the -meta command which apparently doesn't work well with irrlicht. what i did was create my own .bat files to create the bsp like so:
build_basic_bsp.bat

Code: Select all

 "C:/Program Files/GtkRadiant-1.3/q3map2" -v -game quake3 -fs_basepath "C:/Program Files/Quake III Arena/" "C:/Program Files/Quake III Arena/baseq3/maps/my_irr_map.map" > "C:/Program Files/GtkRadiant-1.3/junk.txt"
pause
basically i jus removed the -meta switch :) .. note that this does not create any lighting effects. if you want lighting then create another .bat with the -light switch, then run the basic_bsp.bat first followed by the lighting.bat file.(http://www.teamtomko.com/lighting_bsp.jpg) for more info read this http://shaderlab.com/q3map2/manual/

here is a shot of the same level without the triangle trouble
Image

Posted: Fri Dec 12, 2003 9:38 am
by niko
Ah, cool. Finally a solution for this problem. We'll point the next 1000 users with this question to this thread. :)

Posted: Sun Dec 14, 2003 6:34 pm
by SkyFlash
Is is possible to find the cause for this bug and fix it in Irrlicht?
I am not a 3D programmer, but I can debug fairly well, so if someone will point me in the right direction I may find it. I am a complete Irrlicht newbie though so I will have to go through reading the source code first.

Its really an annoying bug, cause I am currently lacking the Q3 editor and the bsp tool to fix it for me... I am on dialup, and have problems downloading a 34MB file... :(

SkyFlash

Posted: Wed Jan 21, 2004 11:02 am
by niko
SkyFlash wrote:Is is possible to find the cause for this bug and fix it in Irrlicht?
Last night, I made a long debugging session, and I've found the bug. I'll include a fix into the next release of the engine, but for all of you who can't wait, I'll post the corrected code into here. In CQ3LevelMesh.cpp, there is a method called CQ3LevelMesh::constructMesh(). In the big switch inside, replace the case 3 and case 1 with the following code:

Code: Select all

case 3: // mesh vertices
			case 1: // normal polygons
				{
					for (s32 tf=0; tf<Faces[i].numMeshVerts; tf+=3)
					{
						s32 idx = meshBuffer->getVertexCount();
						s32 vidxes[3];

						vidxes[0] = MeshVerts[Faces[i].meshVertIndex + tf +0] 
							+ Faces[i].vertexIndex;
						vidxes[1] = MeshVerts[Faces[i].meshVertIndex + tf +1] 
							+ Faces[i].vertexIndex;
						vidxes[2] = MeshVerts[Faces[i].meshVertIndex + tf +2]
							+ Faces[i].vertexIndex;

						// add all three vertices

						for (s32 vu=0; vu<3; ++vu)
						{
							video::S3DVertex2TCoords currentVertex;
							tBSPVertex *v = &Vertices[vidxes[vu]];

							//currentVertex.Color = video::SColor(v->color[3], v->color[0], v->color[1], v->color[2]);
							currentVertex.Color.set(255,255,255,255);

							currentVertex.Pos.X = v->vPosition[0];
							currentVertex.Pos.Y = v->vPosition[2];
							currentVertex.Pos.Z =  v->vPosition[1];
							currentVertex.Normal.X = v->vNormal[0];
							currentVertex.Normal.Y = v->vNormal[2];
							currentVertex.Normal.Z = v->vNormal[1];
							currentVertex.TCoords.X = v->vTextureCoord[0];
							currentVertex.TCoords.Y = v->vTextureCoord[1];
							currentVertex.TCoords2.X = v->vLightmapCoord[0];
							currentVertex.TCoords2.Y = v->vLightmapCoord[1];

							meshBuffer->Vertices.push_back(currentVertex);
						}

						// add indexes

						meshBuffer->Indices.push_back(idx);
						meshBuffer->Indices.push_back(idx+1);
						meshBuffer->Indices.push_back(idx+2);
					}
				}
				break;

wow, nice level!

Posted: Wed Jan 21, 2004 5:15 pm
by buhatkj
wow...where do you get these levels? i have been having trouble finding good free levels on the web.
-Ted

Posted: Wed Jan 21, 2004 7:27 pm
by niko
I found it on planetquake.com

Posted: Tue Feb 03, 2004 8:15 am
by fretnoize
does this problem still happen sometimes with more complicated geometry, regardless of removing the -meta tag with q3bsp2? I started adding more complex geometry into my scene then noticed triangles disappearing on SOME faces, definately not 1/2 of them like the -meta problem, but occasionally. I can post a screenshot if needed. I'm wondering if my problem is related to this or if its caused entirely by something else.

Posted: Tue Feb 03, 2004 10:53 am
by niko
Did you apply the patch I posted above? And you still have missing faces?

Posted: Tue Feb 03, 2004 11:18 am
by fretnoize
No, I haven't applied the patch yet.
Sorry for the confusion, I was basically asking if these problems still occur ocasionally when you haven't installed the patch, but instead you are using the posted work-around, which was to remove the -meta flag from the q3map2 command line options.

I guess I'll try installing the patch anyway. Was a little hesitant, since I'm pretty new to the engine, didn't want to end up breaking something, heh :)

Posted: Tue Feb 03, 2004 12:51 pm
by fretnoize
My geometry looks fine with the patch installed.

So if anyone is using the work-around posted, be aware that the problem can still occur. I'd recommend installing the patch ;)