# [FIXED] Bilinear Interpolation

Get help using Construct 2

### » Mon Dec 31, 2012 10:50 pm

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 ;) )

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*sqiddster2013-01-01 01:00:15
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,749

### » Mon Dec 31, 2012 11:00 pm

Is there a formula you are using?
Something like diamond square?
B
179
S
50
G
208
Posts: 8,724
Reputation: 128,816

### » Mon Dec 31, 2012 11:14 pm

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 :Dsqiddster2013-01-01 00:37:16
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,749

### » Tue Jan 01, 2013 3:53 pm

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?
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

### » Tue Jan 01, 2013 4:52 pm

@Nimtrix, I'm sorry, I was editing the wrong file. It's fixed.sqiddster2013-01-01 16:54:35
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,749

### » Tue Jan 01, 2013 5:03 pm

Ah, I suspected that might be the case. Works great now, thanks for sharing this!
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Return to How do I....?

### Who is online

Users browsing this forum: No registered users and 7 guests