Click to See Complete Forum and Search --> : Conversion of 2D map to 3D
iScreem
Jul 16th, 2001, 08:38 AM
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?
plenderj
Jul 17th, 2001, 08:25 AM
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.
kedaman
Jul 17th, 2001, 08:34 AM
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.
Jotaf98
Jul 17th, 2001, 02:56 PM
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? ;)
kedaman
Jul 17th, 2001, 04:41 PM
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.
Fox
Jul 17th, 2001, 07:16 PM
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...
Jotaf98
Jul 20th, 2001, 06:55 PM
If you're using true voxel, you won't need to draw polygons that way ;)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.