Sign in to follow this  
sirlemonhead

General directx queries(static buffers, transforms)

Recommended Posts

Just a few questions on things i'm a little unsure of.. When people refer to using static buffers, do they mean loading all static level geometry into a VB, and then for each frame just applying transformations to it, rather than having to rewrite vertex data? This makes sense to me, but I'm not sure how much you actually put into a static buffer. Surely the entire level isn't loaded in? but then how do you control when additional level geometry is loaded into the static buffer? ie, if you load your first half of the level, are you supposed to check when the player reaches the second half, and then load it? 2) Are stuff like destructable models, elevators, doors and other such things then put into dynamic vertex buffers? 3) Does each individual object have its own model->world transform matrix that changes per frame? for going from world to view, is there only one matrix, and likewise for view to screen/projection? 4) Is it possible to perform one of these transforms in software, and the rest on the GPU? ie transform from model to world on the CPU and then let the GPU do the rest? 5) Are there any matrix multiplication or manipulation functions available in directx that could be 'plugged' into pre T&L code that could perform these functions on the GPU without having to do Set Transform and whatnot? ie, offloading some of the software T&L process to the GPU without going the whole hog..do some transformations on the GPU but still use pretransformed vertex data with DX (the XYZRHW) That's all I can think of at the moment. If anyone could answer some or all of these, that'd be cool :)

Share this post


Link to post
Share on other sites
Quote:
Original post by sirlemonhead

When people refer to using static buffers, do they mean loading all static level geometry into a VB, and then for each frame just applying transformations to it, rather than having to rewrite vertex data?



Well it doesn't mean necessarily loading everything into a single VB, but it does mean that you're not modifying the vertex data once it's in a VB.

Quote:
Original post by sirlemonhead

This makes sense to me, but I'm not sure how much you actually put into a static buffer. Surely the entire level isn't loaded in? but then how do you control when additional level geometry is loaded into the static buffer?
ie, if you load your first half of the level, are you supposed to check when the player reaches the second half, and then load it?



You're probably not going to be using a single vertex buffer for anything but trivial situations. A single vertex buffer for all static geometry could be huge, and won't be good for performance. Plus you usually need to maintain the ability to cull out portions of the geometry that aren't visible, which is hard to do if you have everything in one giant buffer. How you split up your geometry and when you load more will very much depend on your engine architecture, what you're loading, what the level looks like, how quickly you move through it, etc.

Quote:
Original post by sirlemonhead

2) Are stuff like destructable models, elevators, doors and other such things then put into dynamic vertex buffers?



Probably, it depends on how these things are implemented.


Quote:
Original post by sirlemonhead

3) Does each individual object have its own model->world transform matrix that changes per frame? for going from world to view, is there only one matrix, and likewise for view to screen/projection?



Usually this is the case. However there are many reasons to have multiple view and projection matrices, which include shadow maps and reflection maps.

Quote:
Original post by sirlemonhead

4) Is it possible to perform one of these transforms in software, and the rest on the GPU? ie transform from model to world on the CPU and then let the GPU do the rest?



Sure, if you really want to. Just set the corresponding transform matrix to identity. But it means you would have to store the post-transformation vertices in a vertex buffer, which means using a dynamic VB. Keep in mind that when you use a vertex shader, calculations that will come out the same for every vertex are "pulled out" and performed on the CPU as a pre-shader.


Quote:
Original post by sirlemonhead

5) Are there any matrix multiplication or manipulation functions available in directx that could be 'plugged' into pre T&L code that could perform these functions on the GPU without having to do Set Transform and whatnot?



Not really, this is pretty much exactly what a vertex shader is for.

Share this post


Link to post
Share on other sites
So how is static level data generally handled? multiple static buffers? What's the standard approach to easily cull unseeable polygons?

Cheers for the answers :)

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