I need help with developing an algorithm for converting a 2D topographical map into a 3D surface. I want to use VB for doing that
Can anyone help me with it?
Printable View
I need help with developing an algorithm for converting a 2D topographical map into a 3D surface. I want to use VB for doing that
Can anyone help me with it?
Well you would need to store the height of each pixel somewhere/somehow. Probably the easiest way would just to have a seperate textfile/binary file that contains a list of values that are the heights of each pixel.
What is normally done however (eg. Voxel) is that there would be a second picture, and the colour of each pixel would decide the height of the pixel.
Then when you put the two pictures together, one picture for the colour of the terrain, and the other for the height, you get the 3D co-ordinates. So then all you have to do is plot it.
In case you just need an isometric projection, you nest loop trough each dimension and plot the pixel for each value at sum of each dimensions screen projections as 2d vectors. A simple elegant and fast projection would be x+y,x-y-z.
In case you need perspective, I've got a voxel engine laying around on my hdd.
Hey, wouldn't it be cool to use that algorythm to detect if a point is inside a polygon so that a voxel engine supports polygon-based models? ;)
Really? The hard part comes when voxel rendering has to be rendered at the same time as the polygons. I'm not even sure if there's hardware that supports that, although I think there is because i've seen games with polygons and voxel landscape.
Well voxelspace-accelerator cards are too expensive (and rare) but like in DeltaForce you can render voxels and polygons together. I'm not sure but I think they directly access the ZBuffer so the card cares about this problem...
If you're using true voxel, you won't need to draw polygons that way ;)