Perlin Noise plugin 1 - Zooming

For questions about using Classic.

Post » Tue Jul 03, 2012 2:46 pm

Hi all!


Well I've reached a snag while fooling around with the perlin noise plugin. The first version.

Let's say you have a display size of 640x480.
The noise is 1 pixel big. So the noise map is the same as the display size.

I have two loops generating the noise one for X and one for Y.
They read the noise in the noise map and then create 1x1 pixel tiles.

So if I wanted to be able to zoom the landscape, how would I go about doing this? I know that frequency will allow you to zoom in and out.

BUT.

When I zoom in(lowering the frequency), the whole map moves up towards the left corner. But I want to be able to zoom in on the what ever is in the CENTER of the SCREEN, at coordinates 320x 240y.

How would I go about doing this and what formula is used?

Thanks in advance! :)

/MJOne
B
5
S
1
G
2
Posts: 28
Reputation: 806

Post » Tue Jul 03, 2012 3:32 pm

Nevermind I fixed it! ;)=

I can post a solution if anyone want one... :)

However it only works when I take the noise frequency * 0.5....

It would be nice to see if someone could make a smooth zoom in a sin wave motion. In and out. :)
MJOne2012-07-03 15:39:40
B
5
S
1
G
2
Posts: 28
Reputation: 806

Post » Tue Jul 03, 2012 10:18 pm

You're creating a sprite for each pixel?
That's like over 300000 tiles.

You might want to check out the Canvas plug, or even a sprite distort map.
That many tiles is just crazy. I'm surprised it even ran.
Also you might check out Noise 2 @Arsonide added functions for changing the rez.newt2012-07-03 22:30:37
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Wed Jul 04, 2012 4:32 pm

Don't worry about computer-power... I have that...
It's brain-power Im lacking. ;P

It runs perfectly smooth when using the canvas...
But it takes 1-2 seconds to update the map ;P
But it's just for testing...

My main issue is how to write a formula or set it up to be able to zoom into the noise. Like a map zoom. Like 1x 2x 3x 4x 5x 6x 7x 8x zoom etc...

or maybe everything in between like 1.1x 1.2x 1.3x etc... :)

I can't figure out the relationship between the display size, the frequency in perlin noise plug ver 1 and the center point on where I am zooming.

And noise plugin version 2 is out of the question right now...
Because my project will be tile based.

This 1x1 pixel is just for fun right now.

Any ideas?
MJOne2012-07-05 08:50:08
B
5
S
1
G
2
Posts: 28
Reputation: 806

Post » Wed Jul 04, 2012 6:31 pm

[QUOTE=MJOne]I can't figure out the relationship between the display size, the frequency in perlin noise plug ver 1 and the center point on where I am zooming.[/QUOTE]
Think of the Perlin noise as a scene with unlimited resolution. The scene is created by octave, frequency and seed. If you keep those values and only change width and height, you change the resolution, thus zooming in or out. Width will change the horizontal zoom, height the vertical.

Let's say, perlin was set to 64x64. If you now change it to 128x128, you see the same scene, just with more detail. If you keep the output size at 64x64 (e.g. drawing in a canvas), you effectively zoomed in. To still present the center, you wouldn't draw 0 to 63, but 32 to 95. You calculate that like so:

1x zoom was presented with a 64x64 perlin, area shown was 64, center is at 32
2x zoom is presented with a 128x128 perlin, area shown still is 64, center is 64. Half of the area is 32, ergo 64 - 32 is the left/top-edge, 64 + 32 - 1 is the right/bottom-edge.

Here's a very rough example cap:
perlinzoom.cap

(I wish English was my native language, I could explain it so much more understandable)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Jul 05, 2012 8:54 am

I wish English was my native language as well :)

Of course... Dang why didn't I think of that...
Thanks a munch of a bunch! ;P

I'll experiment on all the things you said there...

I let you know if I figure it out. ;)

That cap isn't readable on my end. I downloaded the latest official r2 release of construct classic.

"Failure to load..."
"This cap was saved with a newer version of construct"

How come?
I just downloaded the latest...

Anyways, thanks alot for your help and explanation!
B
5
S
1
G
2
Posts: 28
Reputation: 806

Post » Thu Jul 05, 2012 9:35 am

[QUOTE=MJOne]That cap isn't readable on my end. I downloaded the latest official r2 release of construct classic.

"Failure to load..."
"This cap was saved with a newer version of construct"

How come?
I just downloaded the latest...[/QUOTE] Hmm, that's strange. I built the cap with R2 and only used Perlin Noise plugin of the 3rd party plugs. Anyone else having problems to open it?
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Jul 05, 2012 10:44 am

@tulamide
Works just fine on my PC.
B
54
S
11
G
4
Posts: 250
Reputation: 5,074

Post » Thu Jul 05, 2012 1:24 pm

@Wolod
Thank you, I was wondering if I'd done something wrong :)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Jul 05, 2012 1:42 pm

That's weird...

I did the same thin just to make sure...

Fresh install of Construct + perlin plug...

Still the same error...

I'll investigate my registry for old inputs...
I have a 64bit OS but I'm sure that got nothing to do with it...

"I'll be back"MJOne2012-07-05 16:53:53
B
5
S
1
G
2
Posts: 28
Reputation: 806

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests