[FIXED] Bilinear Interpolation

  • EDIT: This has been fixed. In fact, I'm so happy with the solution, here's the capx for everyone to use!

    Hey Everyone!

    I've been working on an experiment to get a good procedurally generated level in C2. I've decided to start with a simple random noise, smoothed with bilinear interpolation, then rounded off for hopefully nice flowing terrain.

    The bilinear interpolation is giving me a headache however. At some points the result is looking OK but there are lots of incongruencies and artefacts, so something is wrong with my formula.

    Here's what it looks like now. (I haven't gotten to the thresholding yet, so obviously it's not going to look like terrain ;) )

    <img src="http://i.imgur.com/FzHhg.png" border="0">

    So, if some of the math brains would be so kind as to give this Capx a look, I'd be most grateful.

    *Cough* Yann R0J0hound *Cough*

  • Is there a formula you are using?

    Something like diamond square?

  • It's the general bilinear interpolation algmorithm - I don't know what its called, but you can see what I did in the capx.

    EDIT: Although... that DOES look interesting! Might make a good practice of recursion as well. Hmm...

    EDIT 2: But it won't work, because I'm hoping to have a large/infinite world.

    EDIT 3: I forgot to change a 5 to a 4. It works well now. I hate myself :D

  • This looks interesting! But when I run your .capx I only get a few black dots in the top left corner, am I doing something wrong or is the wrong file?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nimtrix, I'm sorry, I was editing the wrong file. It's fixed.

  • Ah, I suspected that might be the case. <img src="smileys/smiley20.gif" border="0" align="middle" /> Works great now, thanks for sharing this!

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