A simple height map mesh engine

This forum is currently in read-only mode.
  • Just a uber simple way to generate a mesh from a height map.

    Note:

    This uses Image Manipulator, so its a bit too slow to be used all the time.

    Also note Image manipulator is a bit quirky... The image must be resized, and flipped to work.

    Plus this sets the distort map to 60x60, and that's pushing its limits. Finally its set to check values from 0 to 255... 100 is supposed to be max, 255(pure white) will be off screen.

    [attachment=0:sowq06ay][/attachment:sowq06ay]

  • That is so cool!

  • That's crazy. Very impressive

  • and displacing a different sprite instead of the heightfield pretty much gives you textured 3D backgrounds.

    Wohoo! Now we can talk about something else

  • very awesome

    I never knew the image manipulator could do anything cool at all

    I thought it was just for slowdowns and crashes

    btw, the h loop is unneeded, so this is a probably a little more efficient:

    http://dl.dropbox.com/u/1013446/spritefont/Capture2.PNG

    this is badass though

    awesome work

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah that will work, ....even simpler with an array.

    + Array: For Each element
    -> Sprite: Set relative displacement at (Array.CurrentX-1, Array.CurrentY-1) to XYZ(0, 0, ImageManipulator.GetR(Array.CurrentX-1, Array.CurrentY-1)) UV(0, 0) 100 % [/code:3cig86vh]
    
    Ok perhaps not as simple to figure out for those who have trouble with 0 based stuff, but ehh..
    Keep in mind you would still need a third loop if you want to do some comparisons, like applying a color filter to a certain range, etc.
    
    

    and displacing a different sprite instead of the heightfield pretty much gives you textured 3D backgrounds.

    Wohoo! Now we can talk about something else

    All you have to do is change the frame after wards, unless you want to export the mesh.

    Also, I might point out, that this doesn't have to be just for grayscale. You could use this for bumpmapped, or baked maps(aka normal maps) as well, by adding a green loop, and a blue, but of course it would take much longer to process.

  • Awesome? Yes. Image manipulator is actually useful, I didn't know it could read individual pixels!

    edit: I tried making the distort map 255x255, to make it just z-distort each pixel pretty much, and construct doesn't seem to allow it. 70x70 appears to be the limit.

  • Yeah, each row/column is what 4 vertex's, so even 60x 60 was pushing it. You can add multiple meshes, but,......and its a big but, they wont line up even if the z heights are the same.

    Your best bet is to stretch the mesh, and then apply a different texture to it, but you will need a z multiplier, since z scales with the mesh.

  • You can add multiple meshes, but,......and its a big but, they wont line up even if the z heights are the same.

    That makes both baby jesus cry, and kills kittens at the same time as clubbing seals. This doesn't apply to the way things are done in your terrastruct does it?

  • I'm talking about placing meshes next to each other like a tile map. If you place one right after another, you will get a line where the background shows through. It has something to do with 3d layering, not sure if its a bug tho...

  • I'm talking about placing meshes next to each other like a tile map. If you place one right after another, you will get a line where the background shows through. It has something to do with 3d layering, not sure if its a bug tho...

    Well that's just made meshes useless for what I intended to use them for.. Back to the shader idea *sighs*

  • If you turn off 3d layering it will work, but that's limiting as well. What you can do is place a background behind those sprites. As long as its the same texture you wont notice anything much. Still your best bet is stretching a mesh, that in conjunction with them being tiled should solve most everything. A few big mesh's are still way better than an fx.

  • If you turn off 3d layering it will work, but that's limiting as well. What you can do is place a background behind those sprites. As long as its the same texture you wont notice anything much. Still your best bet is stretching a mesh, that in conjunction with them being tiled should solve most everything. A few big mesh's are still way better than an fx.

    It's just as bad with 3D layering turned off

    Think I'll just go remake Deuteros, that's just a bunch of pictures and numbers, lol.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)