Hello.
I ran across an interesting problem. To get the idea, download the
following test maps:
http://screenshots.rq3.com/tti/badtris.pk3http://screenshots.rq3.com/tti/badtris4.pk3
You'll need both paks. The first one contains all the assets (scripts,
textures) and the latter has a slightly simplified version, which made
easier for me to track down the problem.
So what's going on? Let's see... If a misc_model has more than one
surface and if some of them are made of non-meta triangles, Q3Map2 spews
out a bsp which has "bad triangles".
--
Surface has bad triangles, originally shader
models/mapobjects/tti/vic/light_front 20 tris 16 verts, now 12 tris
Surface has bad triangles, originally shader
models/mapobjects/tti/vic/patrol/main 705 tris 558 verts, now 693 tris
--
Interesting numbers. 705 triangles is the total polygon count of my
misc_model. The first surface has 12 tris.
705 - 12 = 693.
Oddly enough, if your map has too many of these bad triangles (let's say
about 20k), it freezes the game. Or better yet, if you happen to have an
nvidia card and Windows 7, it crashes the drivers too! Windows XP users,
on the other hand, are greeted with a Blue Screen of Death.
I didn't compile the vertex-lit surfaces as meta, because it detaches
the adjacent triangles from each other and thereby kills the smoothness
of shadows. However, the lightmapped surfaces, in turn, have
q3map_forceMeta applied to them via shaders, because they need it,
otherwise they would appear full-bright.
http://screenshots.rq3.com/tti/badtris5.pk3
Here's the same map as badtris4, except with meta surfaces. The bad
triangles are gone, but as expected, it also broke the smooth shadows.
--
SmileTheory is the fine fellow who backported XreaL's VBO stuff to ioq3.
His thoughts on the subject:
<SmileTheory> actually, I'm looking at
http://www.qeradiant.com/cgi-bin/trac.cgi/browser/GtkRadiant/trunk/tools/quake3/q3map2/surface.c
, specifically EmitDrawIndexes()
<SmileTheory> and it looks like the middle of that function,
"bspDrawIndexes[ numBSPDrawIndexes ] = 0;" is where the bad tris are
coming from
<SmileTheory> it seems to me that triangles with bad indexes should be
stripped, not just have the bad indexes set to 0.
<SmileTheory> I'm thinking there are three bugs here, one in ioquake,
one in the nvidia drivers, and one in q3map2, and they all should be
fixed, though probably only one will be. :)
--
Regards
Tomi Isoaho
tti at rq3.com