You are not logged in.
Pages: 1
Yes! Thanks for pointing my in the right direction hehehe
Thank you! I have so much to learn, still experimenting and trying to understand it completely
That was really advanced code
Some questions I have about the code, maybe you can help me to understand it better:
object0 - Create event{
maxdistortion = 0.4; // maximum amount of distortion to apply
octaves = 4; // number of fractal noise octaves
scale = 2/256; // scale of fractal noise Why this number? I meant the 2, because 256 is the size of the texture right? If I make a smaller texture, should i change all 256 by 128 for example?
noise_init();
surfWind1 = -1;
surfWind2 = -1;
row = 0;
}
object0 - Draw event{
if (surface_exists(surfWind1) && surface_exists(surfWind2))
{
var i,j,k;
if (row < 256)
{
// select surfWind1 for the texture
var tex = surface_get_texture(surfWind1);
draw_set_color(c_white);
surface_set_target(surfWind2);
draw_primitive_begin_texture(pr_pointlist,tex);
// find the vertical texture coordinate for the pixel
var v = row/256;
// modulate the distortion to be minimal at the top and bottom edges
var distortion = maxdistortion * (1 - abs(2*v-1));
// draw a row
for (i=0; i<256; i+=1)
{
// find the horizontal texture coodinate for the pixel
var u = i / 256;
// map the pixel to a point in solid texture spaceOk, the values here are related to the previous scale variable and the pixel position on the "grid"
var px = scale * i;
var py = scale * row;
var pz = 0;
// perturb the horizontal texture coordinate with fractal noise Here is where i imagine the horizontal distortion is produced right?
var uu = u + distortion * fbm(px,py,pz,0.85,2.0,octaves);
// map the pixel to a different point in solid texture space Why this values?
px += 1.2;
py += 1.5;
pz += 1.8;
// preturb the vertical texture coordinate with fractal noiseAnd here the vertical distortion
var vv = v + distortion * fbm(px,py,pz,0.85,2.0,octaves);
// draw the pixel with the perturbed texture coordinate
draw_vertex_texture(i,row,uu,vv);
}
draw_primitive_end();
surface_reset_target();
// advance to next row
row += 1;
}
draw_surface(surfWind1,0,0);
draw_surface(surfWind2,256,0);
}
else
{
draw_set_color(c_red);
draw_set_font(font0);
draw_text(10,10,"SURFACE ERROR");
}
}
Thank you very much!
Thank you very much! I downloaded the example and im going to study how do you did it, I will tell you if I manage to understand how it works
Hello all, im trying to make a world generator and im following the steps done here:
http://www.nolithius.com/game-developme … ion-teaser
But im stuck with the wind map thing, it says that has been inspired by:
http://www.dungeonleague.com/2010/03/28/wind-direction/
But i dont know even where to start, i made a surface similar to this:
And found this perlin noise script:
http://gmc.yoyogames.com/index.php?showtopic=508813
And the idea is to distort the surface X times to achieve this effect:
But i have no idea at how to apply the noise on the gradient to be able to distort the surface simulating wind patterns, i read on some places that i need to create 2 noise, one for each coordinate, and distort the gradient with the matching cells from the noises, any advice?
Thanks!
More info:
This is the step where i get lost:
http://www.dungeonleague.com/2010/02/11 … e-samples/
When i have to use 2 noise functions, "the second function is used to distort the coordinates before being put into the first function"
Pages: 1