Sign in to follow this  
Knepig

Loading/storing static objects

Recommended Posts

Hi. Im trying to make a simple but efficient 3d-engine mostly for fun and i've got some questions :). I'm fairly new to game-programming and directx so some of these questions might be stupid but here we go... Q1: I would like to read static objects from one or more files and then create a octree to store them. I got the tree-structure working pretty well but i cant decide how i should store the objects in it. My first attempt was placing each mesh-object in the correct leaf-node but im not sure that's really a good idea. If i make a large scene and export it to an .x file it places the whole scene in one leaf-object and that isn't very clever. Secont attempt: Reading the filess manually and storing all vertices in the same vertexbuffer and place the indices for every face in a leaf-object. This seems to be working alot better than my first attempt. Now i've been thinking about maybe creating a mesh-object for each leaf-node. This way i could use the simplification-function to create low-poly versions of the leaf-nodes. I'm not sure if this would be efficient at all though. How would you guys do this? Q2: If i have two faces that use the same vertex but with different texture-coordinates, do i have to make 2 vertices in the vertexbuffer or is there a way to specify 2 different coordinates for the same vertex? It kinda ruins the point of having a indexbuffer if each index points to different vertices doesn't it? Thanx in advance // Knepig

Share this post


Link to post
Share on other sites
Q1: Placing the meshes in the leav nodes is the correct way to do things. If you have a large object (like a map or room or something), you should consider splitting it into several smaller meshes.

Q2: Nope, you need to duplicate the vertices unfortunately. That's the standard way of doing it.

Share this post


Link to post
Share on other sites
Quote:
Original post by Knepig
Q2:
If i have two faces that use the same vertex but with different texture-coordinates, do i have to make 2 vertices in the vertexbuffer or is there a way to specify 2 different coordinates for the same vertex? It kinda ruins the point of having a indexbuffer if each index points to different vertices doesn't it?

Well, if your geometry format supports more than one texture coordinate set, it is possible. However, the .X format does not. I believe 3ds does, though. This 2nd set of texture coords is also very handy for things like lightmapping and ambient occlusion mapping.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this