• entries
    422
  • comments
    1540
  • views
    488798

3D Pipes in Direct3D 10

Sign in to follow this  
jollyjeffers

132 views



It's been a while since I last posted simply due to not having anything exciting to write about! I'm not entirely sure what I've been doing but I seem to have had a general lack of free time, and any free time has been a a case of vegetating in front of the TV or reading a book. Damn those endless repeats of CSI [lol]

Anyway, the above screen shot is from this build of my '3D Pipes' in Direct3D 10 sample code. It's not much to look at yet as its still just necessary plumbing before I can get to the juicy bits...

The main points:

1. This is just proving e2e of data. All the geometry is (re-)created on the CPU whenever it changes. Essentially it's just brute-forcing the data into a VB/IB pair and dumping it onto the GPU. It gets quite slow as the grid size and number of pipes increase, but this is intentional as I'd like to have a contrast for later methods.

2. It's rotating individual pipe segments (software transform mind, none of this 'hardware TnL' rubbish [razz]) but not joining them together. That makes the above image a little difficult to interpret and it's only made marginally easier by seeing it draw in real-time.


The latter point is the interesting one for now. I basically need to implement a form of vertex blending on the CPU (hint: this will eventually be GPU based).

I don't have time for proper diagrams, so here's some 1337 ascii "art":


+---+---+
| X | X |
| X | X |
| X | X |
+---+---+
| X | |
| X | |
| X | |
+---+---+


The X's indicate the pipe segments and the outlines are the boundaries for it's particular part of the grid. The next diagram shows where the initial screenshot is:


+---+---+
| X | |
| X |XXX|
| X | |
+---+---+
| X | |
| X | |
| X | |
+---+---+


It basically does simple analysis of "where am I going" and rotates itself to point towards the next segment. One segment has one matrix transform.

The next step is to have two matrix transforms ("current" and "next") and interpolate between them:


+---+---+
| | |
| XX|XXX|
| X | |
+---+---+
| X | |
| X | |
| X | |
+---+---+


It's not too difficult to implement, but just a bit of a PITA to get all the bits and pieces lined up etc..etc..

My task for this evening is to sit down with pen-and-paper and work this through properly and then I'll hopefully implement it correctly first time.

All going well I'll post back some better diagrams explaining how it works...

Oh, just FTR, I did consider doing this in a purely mathematical form using splines and so on, but it was harder to map that to a pure GPU implementation as well as get the results and controls I wanted. Would probably have been more elegant and looked cleverer though [rolleyes]
Sign in to follow this  


2 Comments


Recommended Comments

Quote:
Original post by jollyjeffers
just necessary plumbing before I can get to the juicy bits...


I sincerely hope that was an intended pun [lol].

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