Results 1 to 7 of 7

Thread: Conversion of 2D map to 3D

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Location
    Islamabad, Pakistan
    Posts
    1

    Exclamation Conversion of 2D map to 3D

    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?

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    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.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Do you need a voxel engine?

    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.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    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?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    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...

  7. #7
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    If you're using true voxel, you won't need to draw polygons that way
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width