Nice topic, there are lot stuf to talk about 3d collision.

You currently have a .X file for draw your world, in this case the only info you have available to test collision is the same you have for render your word which is called "a triangle soup".

Doing some kind collision with triangles soups can be done, not any kind collision but some, for FPS type games for example is good enough where the collision your are doing is testing if you can go forward or not, backward or not, upward or not, downward or not etc, but identifing some kind geometry in your world for doing for example climbing is hard.

With triangle soup basically what you do is to use the normal (the vector that tell where the triangle is pointing to) for identify which triangles can be considered as wall, floor, ceiling or even slants, for example you can know that any triangle with normal (0,1,0) is a standable floor cos it is pointing stray UP, and any triangle with normal (0,-1,0) is a ceiling cos it is pointing stray down, for any triangle where the "Y" component is 0 you can say it is a stray wall.

Along with the normal there is also some usefull data like the "plane EQ" witch is used with the normal and one vertex triangle coordinates to calc is any position is in fornt or behind that triangle; there is also the distance formula which calc the distance between the triangle and any desired position.

Now, if your .x file has lets say 2,000 triangles then testing collision every frame is is very slower, so it is best that your soup triangle have to be pre-processed some how to allow to reject triangles as much as posible before doing test with the triangles that are really near to the player position.

A popular pre-procces is the so called BSP trees, which sort the triangle soup in a very complicated binary tree using the normal and the plane EQ of every triangle, that will allow to check very fast for any position you want which triangles are closer in front, back, up and down.

The problem i found with BSP trees is that this algorith is hard to understand and implement when one is a newbie.

More easier algorithms are for example the quadtrees and octreess which sort the triangle soup in recursive sectors so using the distance formula and calculating in which sector the player currently is you can test only the traingle that belong to that sector.


Where there are more techniques where is not involved a triangle soup, but most the time that will mean you have to do the word geometry for rendering (triangle soup) and the collison data separated but that is stuff for another post,