• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
kennyb2142

3D Perlin Noise Map Ridges

10 posts in this topic

[code][/code] Hey so, I've been reading everything I can find on how to use the 3d perlin noise to generate overhangs and ridges but I seem to be not on the right track?
This is what I got using this method:
Add two perlin octaves together. If they are under 0 I turn them into blocks. If they are over 0 I continue and move on to the next one.

Once the sum is under 0, I add the amplitude to them and then proceed. If they are under the water level I draw a lake/ocean over that certain level.. But
It seems I'm missing something, there are lots of random blocks everywhere and only some attached ridges.
[img]http://i130.photobucket.com/albums/p244/kennyb10/ridges.png[/img]

It used to look like this with my old method:
[img]http://a1.sphotos.ak.fbcdn.net/hphotos-ak-ash4/319988_10150854396240237_646780236_20888775_1654179159_n.jpg[/img]

What could I doing wrong? Here's my code for creating cubes:
[code]
for (byte chunkX = 0; chunkX < xyChunks; chunkX++)
{
for (byte chunkY = 0; chunkY < xyChunks; chunkY++)
{
biomeType = r.Next(0, 5);
for (int xAxis = 0 + (16 * (int)chunkX); xAxis < chunkWidth + (16 * (int)chunkX); xAxis++)
{
for (int yAxis = 0 + (16 * (int)chunkY); yAxis < chunkLength + (16 * (int)chunkY); yAxis++)
{
for (int zAxis = 0; zAxis < 5; zAxis++)
{
//15,10 | 30, 8 | 20, 5 <----- Octave 4/5 combos that are good so far
//float octave1 = PerlinSimplexNoise.noise((xAxis + worldSeed), (yAxis + worldSeed), 1, 0.0001f);
//float octave2 = PerlinSimplexNoise.noise((xAxis + worldSeed), (yAxis + worldSeed), 1, 0.0005f);
//float octave3 = PerlinSimplexNoise.noise((xAxis + worldSeed), (yAxis + worldSeed), 1, 0.005f);
float octave4 = PerlinSimplexNoise.noise((xAxis + worldSeed), (yAxis + worldSeed), zAxis, 0.009f);
float octave5 = PerlinSimplexNoise.noise((xAxis + worldSeed), (yAxis + worldSeed), zAxis, 0.03f);

//float cubeGroundBase = octave1 + octave2 + octave3 + octave4 + octave5;
float cubeGroundBase = octave4 + octave5;
if (cubeGroundBase > 0)
continue;

octave4 *= 20f;
octave5 *= 5f;

cubeGroundBase = octave4 + octave5;
if (67 + cubeGroundBase < 59)
cubeGroundBase = -8;

if ((67 + (int)cubeGroundBase) <= 64) //Check if water
{
int sandLevel = (waterLevel + 3) + (int)cubeGroundBase; //update sand level from base

Sand[chunkX, chunkY].Add(new Vector3(xAxis, sandLevel, yAxis)); //Add to water list

cubeCollision[chunkX, chunkY][xAxis, yAxis].Add(new BoundingBox(new Vector3(xAxis - .5f, sandLevel - .5f, yAxis - .5f)
, new Vector3(xAxis + .5f, sandLevel + .5f, yAxis + .5f))); //add bounding box to list

Water[chunkX, chunkY].Add(new Vector3(xAxis, waterLevel, yAxis)); //Also add to list
}
else //it's grass or dirt
{
int groundLevel = groundBase + (int)cubeGroundBase; //update ground level with base

Grass[chunkX, chunkY].Add(new Vector3(xAxis, groundLevel, yAxis)); //Add grass to list

cubeCollision[chunkX, chunkY][xAxis, yAxis].Add(new BoundingBox(new Vector3(xAxis - .5f, groundLevel - .5f, yAxis - .5f)
, new Vector3(xAxis + .5f, groundLevel + .5f, yAxis + .5f))); //add cubeboundingbox to list

Dirt[chunkX, chunkY].Add(new Vector3(xAxis, groundLevel - 1, yAxis)); //Add grass to list
}
}
}
}
}
}
[/code]

I'm only doing 5 for the height? I'm not sure if that's even how you would go about doing this?
0

Share this post


Link to post
Share on other sites
[quote name='Suspense' timestamp='1318699772' post='4872906']
How did your old method work? What did you change from then to now?
[/quote]

Hey, thanks for the reply my old method was not using the "density" idea, I just sent the x and y coords into the perlin noise then multiplied them and used the result for the cube height.

Now though I gave up on the density and added an octave using the old method (and modified it a little to give more variation) to produce maps like this:
[img]http://i130.photobucket.com/albums/p244/kennyb10/ContinentalProgression1.png[/img]

Although I'm still trying to figure out the whole cliffs and overhangs thing if you could give me some pointers from here?
0

Share this post


Link to post
Share on other sites
Is it something like this you're after?

[img]http://i.imgur.com/zIocp.jpg[/img]

That's done by adding 3d noise to a 2d heightmap. The 3d noise is generated like you would 2d noise, just with a third dimension (im sure you'll find ways to do this).
0

Share this post


Link to post
Share on other sites
[quote name='Calneon' timestamp='1319077366' post='4874528']
Is it something like this you're after?

[img]http://i.imgur.com/zIocp.jpg[/img]

That's done by adding 3d noise to a 2d heightmap. The 3d noise is generated like you would 2d noise, just with a third dimension (im sure you'll find ways to do this).
[/quote]

Yeah that's what I want, but I'm so confused.. What value do I input for the third dimension? And how do I go about looping the perlin values.. like x, y, then z?
0

Share this post


Link to post
Share on other sites
I gather that Calneon's approach is to generate a 2D heightmap so that there is a general landscape (no caves etc). After that they generate a 3D Perlin noise field which is only used for subtracting from the existing landscape. So you literally generate a "density change" figure for every x, y, z. If that co-ordinate is already empty, you ignore it (you don't want lumps of rock just hanging in the air). If the co-ordinate contains rock you remove that rock if the Perlin noise at that spot exceeds a certain threshold. You could of course increase or decrease density of the rock as well, to allow a more interesting digging or erosion mechanic.
0

Share this post


Link to post
Share on other sites
that kind of landscape is not hard to make, took me a while to figure it out also, worst than a company secrect, no one want to tell [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img]

you need to use a 3d perlin function, in combination with a 2d perlin function.

whit 2d perlin you make a height map, just like you are now. So you probably do something like

[CODE]
for x = 0 to widht
for z = 0 to depth
get perlin 2d for height
for y = 0 to perlin2d
make cube
[/CODE]

In order to add the 3d, you need to call one 3d perlin value and use it as density.

[CODE]
for x = 0 to widht
for z = 0 to depth
get perlin 2d for height
for y = 0 to perlin2d
get perlin 3d for density
if density > 0 then
make cube.
[/CODE]

You would normally also want to use the perlin 3d after you have some ground under you, otherwise you will get empty spaces as in your first screen.

[CODE]
for x = 0 to widht
for z = 0 to depth
get perlin 2d for height
for y = 0 to perlin2d
if y > waterlevel+(some number lets say 8, so you have some nice beach)
get perlin 3d for density
if density > 0 then
make cube.
else
make cube (density is not important on lower levels)
[/CODE]

Now in order to avoid some of the anoying floating islands you just apply a gradient to the density of the 3d perlin such as

[CODE]
for x = 0 to widht
for z = 0 to depth
get perlin 2d for height
for y = 0 to perlin2d
if y > waterlevel+(some number lets say 8, so you have some nice beach).
get perlin 3d for density
make gradient (y-waterlevel+somenumber)/(perlin2dheight-waterlevel+somenumber)
if (density*(1-gradient)) > 0 then
make cube.
else
make cube (density is not important on lower levels)
[/CODE].

Which this you will have your 3d terrain in no time.


Calneon, how the hell you did the lighting... that thing is killing me.... Edited by winsrp
1

Share this post


Link to post
Share on other sites
I wrote a [url="http://www.gamedev.net/blog/33/entry-2227887-more-on-minecraft-type-world-gen/"]couple[/url] [url="http://www.gamedev.net/blog/33/entry-2249106-more-procedural-voxel-world-generation/"]articles[/url] about this type of thing some time back, that served as the basis for an article in Game Developer magazine. I also [url="http://accidentalnoise.sourceforge.net/minecraftworlds.html"]re-wrote[/url] the thing for my Accidental library, if you are interested.
0

Share this post


Link to post
Share on other sites
hi,
i don't understand this lines of code:
[quote name='winsrp' timestamp='1340129721' post='4950662']
get perlin 2d for height
for y = 0 to perlin2d
[/quote]

perlin returns a value between 0 and 1 so how do you implement the for statement?
i also try to create such a world like on the screenshot but it looks strange.
[img]http://www.alrik-online.de/javaw%202012-03-12%2023-20-44-24.jpg[/img]
0

Share this post


Link to post
Share on other sites
well perlin normally return a number from -1 to 1.. if yours returns from 0 to 1, then maybe some conversions have been applied to it.

something like (0.5 + 0.5 * perlin value.)

and that line means set a variable with the perlin height number

normaly in this step you would also the above transformation and a height amplification

like (0.5 + 0.5 * perlin value.)* max height value.

Then make a look from 0 to the pelin value, assuming that your height array starts at 0. where 0 value = bottom of the world, some number in between lets say 64 = water level and 128 would be something like the highest mountain value. Edited by winsrp
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0