Sign in to follow this  
  • entries
    375
  • comments
    1136
  • views
    297496

Skirts

Sign in to follow this  
superpig

67 views

There's a thread over in GP&T about solving cracks between patches in standard GMM systems. Naturally, one of the methods discussed has been skirts.

For the uninitiated, a skirt is basically a 'side' bolted to your terrain patch, usually made by taking the vertices along the side of the patch and 'extruding' them downwards. For small cracks this works OK - just filling in the extra pixels - but as the gaps get larger it looks worse and worse, as the texturing on the skirt is usually just a one pixel line stretched vertically.

So I'm wondering about skirts that actually join patches together instead of extruding downwards. If you've got each patch in a seperate vertex buffer, you can select two neighboring patches in as two streams. If you can pick out vertices from those streams in the right kind of way, you might be able to build a skirt that accurately 'bridges the gap,' which would include some degenerates but should be perfectly seamless.

One problem is that simply selecting both buffers in as streams will cause vertices to be read in pairs, one from the each buffer. If we were to assume that both patches were at the same LOD (i.e. had the same number of vertices along each edge) we could construct a strip by sampling each of those vertex pairs twice, and first using the first value, then the second, then the first, etc. I think this is possible using the new instancing API in D3D9, the SetStreamSourceFreq() function, though I've not quite figured out how yet - something about a third stream with a repeating { 0, 1 } 1D texcoord value that the shader can use to alternate between the first two streams. The first two streams would thus be 'instance data' while the {0, 1} stream would be the 'indexed data.' Yeah, you'd need a {0, 1} IB as well. The thing I'm really not sure about is whether you'd be allowed to set up two streams as instance data.

The next question is whether that can be extended to different LOD levels on neighbouring patches. I don't see why not; it requires that the repeater frequency be set up differently on the two primary streams, and again you have your {0, 1} buffer to pingpong between the two. Once again I don't know if this is something that D3D will actually let you do.

Oh well. If you try it, let me know [smile]
Sign in to follow this  


2 Comments


Recommended Comments

I'm not getting the point. People use skirts because they're easy to implement. If you're gonna invest some time in a more complex solution to solve cracks, do it "the correct way", for example by adjusting the index buffers. If you place the restriction that neighbooring patches cannot differ by more than one level, this gives you 16 index buffers combinations, that can be precalculated. Actually i should say that i do not understand people who use skirts at all, it looks like an horrible solution to a problem that is not that hard.

Share this comment


Link to comment
I agree that skirts are a generally poor solution, but what I'm really talking about here is a generalised solution for dynamically generating a strip between two edges with a mismatch in vertex frequency. I don't think that's limited to terrain as a problem domain; skirts are just what got me thinking about it.

Share this comment


Link to comment

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