Newbe DirectX Questions

ROB_GP

Newcomer
Joined
Mar 10, 2004
Messages
5
Location
Cirencester, Gloucestershire, England
Hi Everyone,

I've looking through these threads and it seems like theres some pretty complex 3D stuff out around so I thought I'd aska few simple questions.

Firstly, I have no experience using DirectX, but am a fairly reasonable programmer, so I think I should pick it up quite quickly, but before I bother I want to just make sure it will be able to do the things I want.

I'm interested in building an application that uses real-world data as a source for heights, so that one can roam around a virtual representation of a real place.

So heres the questions:

1. Is it simple to supply a raster image (like a tiff or bmp) and create a height model based on its pixel values?

2. is it possible to supply a cartesian coordinate system to a 3d model?

3. would it be possible input a series a points and display them either as points or a joined line between the points?

4. Would it be feasible to be able to feed a real time data input (like a GPS feed) and have the 3D scene update for every new input?

and finally....

5. is it possible to make an animation follow a set track across a 3D plane?

Thats all for now

Thanks for the help Guys (& Girls :D )

Rob GP
 
1) dont know
2) yes, you can do left and right handed
3) yes, i think its called a linelist or something O_O
4) dont understand, but if you mean, get input from the user and change the position of something, then yes
5)im prettty sure you can

lol, sorry for being breif, :) i gotta go somewhre now
 
replying to #1, you could use a displacement map. this'd require hardware support (DirectX 9 video cards only)

or eventually if you can't accomplish that, you could just go around a dense plane and go setting the vertex's heights one by one based on the pixel color of the image at that correspondent point. like parsing the image to the vertex buffer manually
 
Last edited:
Thanks for the replys...

...The last method you describe is how I thought about doing it (because it is the most logical sounding to me), but I didn't know if there was another way around it...

...I've looking around and have seen things like BitBlt's and something like ImageToSurface, but I'm ot sure that these mean a 3D surface!!!

I'm going to continue to investigate...
 
You will have to lock the surface, read the colors, and set the appropriate heights in your vertex data. Make sure you take a look at the billboard sample in the sdk.

A good starting point for terrain visualizations is www.vterrain.org. It's not about Managed DirectX in particular but has general algorithms that you might find useful.
 
I should mention something - DirectX is a LOW level API, for the most part. It does provide some "high" level functionality for things like meshes and drawing lines (as opposed to drawing a line yourself, one pixel at a time).

For the most part, you're looking at a LOT of work to get the 4 items you mentioned. Setting up DirectX can be a pain in its own right - easier if you know the hardware you'll be running on.

Building a heightmap can be done, but unless you find some already written code, you're looking at custom code at locking a surface to read the color bits (as mentioned), then building up a triangle list yourself to fake the heights of each vertex on your heightfield.

Moving around in 3D can take a bit of code as well. Look at even the simplest "interactive" 3D samples and you'll see a couple of screens full of code. Meaning, there's no "move camera left, move camera right" kind of functionality. Everything will have to be done by multiplying matrices to move around. Again, DirectX is fairly low level in this regard.

Have the camera track against a path is going to be the hardest part, in my opinion. It will involve the most math to get the camera to follow the path and, potentially, change orientation to "watch" some point on the screen.

I'm not trying to discourage you - just giving you a heads up on what's involved with using DirectX by itself. Trust me, if you can get a textured cube just spinning on the screen, you'll jump for joy :)

Having said that, there are lots of free libraries and, I'm sure, some cheap commercial ones that might make your life easier. I'd spend some time investigating what's out there that might help you create a heightfield or move the camera.

If nothing else, precreate the heightfield in some 3D application (Milkshape is only $20) and export as a .X file and just read that in.

-nerseus
 
Well, the whole idea is still just a concept, but I don't really want to spend any money on anything, because that will defeat the object of me doing the work!!!

I'd also rather keep away from the idea of having to use other programmes to 'convert data', I've been down this route before (where 'A' will only with 'B' after being run through 'C' & 'D' & 'F') and it just tedious.

There are lots of very clever people out there who I'm sure can think of a way (or have already found a way) to do this type of thing with the minimum of fuss.

Maybe I'll take on your advice though and try to look for some custom stuff.

Besides I ned to actually render the images is 2D first!!!! :)
 
Back
Top