Q3bsp

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Demonmage

Q3bsp

Post 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.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post 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); ?
WhytWulf
Posts: 51
Joined: Mon Sep 08, 2003 11:14 am
Location: Australia, Tamworth, NSW
Contact:

Post 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
WhytWulf
Posts: 51
Joined: Mon Sep 08, 2003 11:14 am
Location: Australia, Tamworth, NSW
Contact:

Post 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..
Demonmage

Post 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
rt
Posts: 150
Joined: Sun Nov 30, 2003 6:54 am
Location: canada
Contact:

half a solution to a half triangle problem

Post 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
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Ah, cool. Finally a solution for this problem. We'll point the next 1000 users with this question to this thread. :)
SkyFlash
Posts: 3
Joined: Sun Dec 14, 2003 5:03 pm

Post 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
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post 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;
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

wow, nice level!

Post by buhatkj »

wow...where do you get these levels? i have been having trouble finding good free levels on the web.
-Ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

I found it on planetquake.com
fretnoize
Posts: 43
Joined: Sun Feb 01, 2004 4:57 am
Location: Los Angeles

Post 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.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Did you apply the patch I posted above? And you still have missing faces?
fretnoize
Posts: 43
Joined: Sun Feb 01, 2004 4:57 am
Location: Los Angeles

Post 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 :)
fretnoize
Posts: 43
Joined: Sun Feb 01, 2004 4:57 am
Location: Los Angeles

Post 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 ;)
Post Reply