# Calculating which vertices corrospond to which triangles in .bsp

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

## Recommended Posts

Hi,

Im loading in vertices from a quake3 .bsp file. I calculate the number of triangles in the bsp by dividing the number of indices by 3.

I want to calculate the tangents and bitangents of the vertices but I cant figure out how to find which verts corrospond to each triangle.

Is there some algorthim for calculating this?

##### Share on other sites
I haven't worked with BSP files before but I found this detailed layout of the file format used in Quake III. Hopefully it helps.

http://www.mralligator.com/q3/

##### Share on other sites
Thanks yeah I looked at that alot to load the .bsp file but the file only contains a list of vertices and indices etc but doesnt store triangles so rendering it is fine but then when I come to wanting to get the tangents and bitangents of each vertice I get stuck because I dont know how I could figure out which other vertices I need to factor into the equation when only faced with vert / indices.

Its not really specific to .bsp but I just thought It was worth mentioning where my vertex information was coming from.

I thought there might be some way of figuring out which vertices apply to each triangle based on the indices?

##### Share on other sites
I am pretty sure this describes exactly for what you are looking.
Face data is used to create the triangles of that face and are in “triangle fan” format. If a face has 20 vertices, it has 18 triangles. All triangles start with the first vertex in the list of vertices in the face.

So if you have a face with 4 vertices indexed as follows:
0 1 2 3

Then you have triangles:
0 1 2
0 2 3

L. Spiro

##### Share on other sites
Thats it exactly thank you ! I must have missed that when I read the document.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
A4L
14
5. 5

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633767
• Total Posts
3013735
×