Archived

This topic is now archived and is closed to further replies.

Quake 3 .bsp rendering

This topic is 5337 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

well as the topic says, im trying to write a quake 3 .bsp loader/renderer. i started by following digiben''s (of www.gametutorials.com) guide to the format and rendering. the format appears to be correct and im loading all data correctly, and i can even correctly render the maps that he supplies with his tutorials. however when i tried compiling my own map (with gtkradiant/q3map2), i get a few rendering problems. quake3 renders the map fine, so i know its not something wrong with the file. the map is a simple 6 walled room with one light in it. when i render all the faces as triangle fan''s, but for some reason, every face but the floor is missing a big triangle out of it. kinda like this: |\ /| |x\/x| |xxxx| where X is where the polygon is rendered correctly. am i right in assuming to draw faces as triangle fans? has anyone else encountered this problem before? unfortunatly there is a lacking of articles on the internet about rendering quake3 bsp''s. all help is greatly apprecited, please ask questions about anything unclear.

Share this post


Link to post
Share on other sites
well i''ve made some headway in figuring this out...

apparently the faces index the verticies in the wrong order... instead of going around the verticies in a clockwise or even counter clockwise order, the indicies jump around so that your face is drawn wrong. let me attempt another visual:

lets say that the 4 numbers are actually a square face, and the number is the index of that vertex from the face.

a normal face should index like this:
12
43
or:
14
23

but the way the bsp face is coming out, it looks like:
12
34

so you can see it woudln''t fill in the polygon correctly...

the only way i can think to counter this is to check the clockwise order of each face''s indicies and swap as necessary. not too hard, but it seems a very ugly way of doing it. i know quake3 is known for its ugly hacks (even though they work amazingly well), but for quake 3 to load a bsp and correct face indicies at runtime just seems to ugly.

any idea on what *should* be done, or at least how quake3 handles this?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The answer is easy. Those gamemaker tutorials contain wrong ineformation on how the faces are stored and must be rendered.
They are NOT stored as triangle fan! They are stored as indexed triangle list. They need to be rendered using glDrawElements() and GL_TRIANGLES as element type. The "meshverts" they describe in the tutorial are in fact the needed indices.

skynet

Share this post


Link to post
Share on other sites
well it turns out mr.(or mrs.) Anonymous was right. i was laying in bed last night (before he posted it) and realized that that must be what the mesh verts were for, and thanks goes to him for clarifying that they are actually triangle lists.

thanks anonymous

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Meshverts are triangle lists, but the other vertex list of a type 1 face is supposed to be a triangle fan.

Share this post


Link to post
Share on other sites
Type 1 surface is a normal triangle surface. It is not a triangle fan... it is, as they said, an indexed triangle list. What it does have going for it, however, is it''s ordered in triangle strip order whenever possible. Take a look at the Aftershock source code if you want to see what I mean.

R_BackendStripmine in:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/new-aftershock/src/renderback.c?rev=1.28&content-type=text/vnd.viewcvs-markup

Share this post


Link to post
Share on other sites