Tiled distormaps...(solved)... pretty much

This forum is currently in read-only mode.
  • Either my understanding of how U, and V work, or how to implement a tiled texture on a distort map, using either a loop, or array is wrong.

    In the cap here:

    http://dl.dropbox.com/u/666516/perlintiledsprite.cap

    perlin noise plug here:

    http://www.box.net/shared/3y6ogomhbi

    I've tried to set the u and v coords with the thinking they are either one of two, then the rows are even or odd.

    In a distort map set 4 columns/ rows it would start like this:

    0,0 |1,0 |0,0 |1,0 for the first row

    then

    0,1 |1,1 |0,1 |1,1 for the second.

    And then making a bigger map should be fairly straight forward following the formula:

    (y is even or odd, then a variable is either 1 or 2)

    Well apparently not, in the cap I've tried it in a loop, and an array with limited success, but it's far from being right.

    If any one would like to take a look at it and see if they can figure out what I'm doing wrong I'd appreciate it.

    Keep in mind you need the perlin plug to open the cap.

    http://www.scirra.com/phpBB3/viewtopic.php?f=2&t=4836&st=0&sk=t&sd=a&hilit=perlin

  • Ok figured out something I was doing wrong. Instead of doing is even, or is odd on just y, I should have had it set to x, and y.

    I've also had an epiphany. You could actually have several textures all on one sprite, then set u, and v based on the noise that was generated. Although the math for that is a bit much for my feeble mind.

    But imagine an almost infinitely scaleable map, with as many textures as you please. Land, trees, water, all in semi 3d, and all taking the ram of just the one sprite!

  • Funny how looking at other people's code can confuse the hell out of you.

    You've given me some ideas, and how I would go about achieving what you have, but I'll be buggered if I can understand how yours works, lol.

    Cool though.

  • Land, trees, water, all in semi 3d, and all taking the ram of just the one sprite!

    Which would be about the same ram of multiple sprites, minus power-of-two padding.

    :s yeah.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is a cap of what I have been able to figure out. It tiles, but not perfectly.

    http://dl.dropbox.com/u/666516/dtm.cap

    I think I've figured out about as much as I can with what little experience I have.

    I still would like to be able to get this to tile like the bg object.

    Dunno perhaps there's a bug with distort maps?

    Any way, if any one wants to give a go at figuring it out it would be much appreciated.

  • - [CHANGE] Sprite: distort maps now tile the texture when distorting outside the texture area. Allows for sprites to be used as rotating or animated tiled backgrounds.

    Does this do what you want?

  • Actually..., wait whut?

    What about 0,0?

    The thing is I'm trying to set z heights over many rows/columns.

    So will it automatically set the first vertex then?

    mmmkay off to experiment, thanks.

  • 0,0 is already using texture co-ordinate 0,0 - the top left of the image is still at the top left!

    If you want more control over the Z heights, you'll need more columns and rows in the mesh, and you'd have to loop to set the U/V of each cell. lerp might help there.

  • I tried lerp a bit, and it seems to be working much better, Im not sure If I have it set up exactly right but It does seem to be getting there.

    for x, and y loops

    set u and v to lerp(0, maxtilesize, loopindex(x, and y)*0.1

    That gives me a decent showing, but Im unsure of using loopindex, as the percentage.

  • Update:

    Epiphany, crushed.

    Ok figured out something I was doing wrong. Instead of doing is even, or is odd on just y, I should have had it set to x, and y.

    I've also had an epiphany. You could actually have several textures all on one sprite, then set u, and v based on the noise that was generated. Although the math for that is a bit much for my feeble mind.

    But imagine an almost infinitely scaleable map, with as many textures as you please. Land, trees, water, all in semi 3d, and all taking the ram of just the one sprite!

    Seems you cant use multiple textures, its always going to use the whole texture.

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