Collision shapes

Until now, on pdEngine, there were three choices when it came to collision shapes: a box around the whole objects, a sphere around the whole object or an accurate triangle mesh. The first two do not produce accurate results for complex shapes, and the last being slow for physX to handle.
What I have been wanting to do for a while, and something I have now achieved, is rather than generate a bounding box around the whole mesh, generate one for each subset. I have also done this using spheres, although it’s more academic and I can’t see this type of bounding actually being used.
In the attached screenshot there are three objects of the same mesh, a biplane that comes with the DirectX SDK. The leftmost uses spheres, the middle uses boxes and the one on the right uses the mesh.
The trouble with this technique I have experienced is converting between the physX coordinate system and the Direct3D coordinate system, one of which is twice the other. At the moment, this only works for axis-aligned bounding boxes, so it is not very useful for some objects, but I shall experiment with alternatives.
collision

Confusion?!

I get very confused when debugging these days. This is because I can no longer tell the difference between my Direct3D 9 and 10 renderers. That’s a good thing 🙂
In terms of progress, fluids are coming along in DX10 but are not yet done. Models now support multiple subsets per mesh, and the next thing to do is to get the physics to use these too.

In other news, I recently reinstalled StumbleUpon. I have not had it since Windows 7, as I saw it as something of an addiction I needed to free myself from. However, I do very little at soem points on the computer, and StumbleUpon is better than Omegle or 4Chan or wherever else I am tempted to go.

Debugging

It turns out the reason PIX didn’t work with Direct3D 10 programs was that I was using a D3DDEVTYPE_NULLREF device. I binged this and found nothing, so I assume I am the first person in eh world to find out that PIX does not like these. Simply changing it to a HAL device worked fine. Now I can debug it in PIX, it looks like I regurgitated the index buffer somewhere, because that is messed up :/.
What I have done today successfully is generate adjacency data for my meshes. Adjacency indices are passed into the geometry shader, and normally this is done by DirectX with meshes. But as we know, meshes are being phased out in DX10?! Following a thread at GameDev it was quite simple, just a case of doubling the size of the index buffer and putting in the index for the adjacent triangle in between each other.

Mesh format

When Direct3D 10 was released way back in 2007, lots of people were surprised at the lack of a decent mesh class. Whilst there is one, it cannot load from file in the same way that Direct3D 9’s could, and it is essentially more of container for the vertex and index buffers.
With this is mind, designing an engine that supports both Direct3D 9 and 10 is difficult. What I was doing was loading everything through DirectX 9, then converting in to 10 when that was running. The problem with this is that two Direct3D devices need to be running simultaneously, which not only hits the performance but also makes it very difficult to debug using PIX.
What I have been working on for pdEngine today is my own mesh format that can render to Direct3D 9 and 10 (and hopefully 11 when I buy a card that supports it), and can load from file. The file loading is not yet done, but it won’t be .x, it will be my own format probably similar to .sdkmesh.

New blog!

I felt a desperate urge to blog something today, so I made a new blog. The old one won’t be back up again anytime soon, and I doubt I’ll update it even if it does come back, now I’ve made this. What happened was that the web hosting expired, and I forgot to take a backup before it did, so I’ve lost everything on their unless it gets renewed soon.
I used blogger once before, ages ago, and it was recommended to me by a friend again recently, so I thought “why not”.
For anyone interested, pdEngine is still beign worked on, and every now and then I will update the SourceForge SVN. The entire source is available at SourceForge: http://sourceforge.net/projects/pdengine/