1

Ive read many tutorials on this concept but I feel none of them go into too much depth on how to do it. I already know how 3d programming (rasterizing, projection matrix, etc.) raycasting (using euclidean geometry and vectors) and raytracing work I just need to know how a voxel landscape is generated and rendered using perlin noise. Also, I know that maps are created with 2d arrays but does each element of the array represent each vertical column of voxels or just a generalized point on the map (like the peak of a mountain or a hill top). Thanx in advance for the answers!

ZachariahRS
  • 65
  • 2
  • 8

3 Answers3

1

I don't know what you're after. Are you looking for basic terrain mapping like any video game or are you looking for "voxels" like Minecraft voxels? Games like Minecraft use 3d Perlin noise not 2-d as you seem to believe. The 3-d noise is what helps generate caves and caverns underground. If you're just talking about height maps, the way those work is, yes, the "color" or value on a 2-d plane represents the height of the grid point. Dark points on a 2-d noise map will often be valleys and light points mountains or whatever you want.

Here's a great source on implimenting 3-d Perlin noise that helped me a great deal to understand it. If you haven't had multivariable calc you might be a little more confused by it, but judging by the other stuff you're talking about, it should be a breeze for you. I'd probably be able to do it, but I'd sweat a lot if I were trying to program view frustums: http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf

Here's a great video of someone mapping 3d Simplex noise in space: https://www.youtube.com/watch?v=GTAqjyG2oOc

Both Perlin and Simplex (made by the same guy) establish an algorithm where you can sample values at coordinates. You can then use these values for whatever you want and the potential of them is really quite varied. From generating terrain to easily tiled textures, to clouds or making millions off your dorky dig and place blocks game.

Here was my first test of my 3-d Perlin noise. I used it to sample the density of the 3-d noise at all the places on the surface of a sphere. Since the sphere is, abstractly, "placed in a 3-d cloud" sampling the value of the cloud on the sphere's surface produces a perfectly tiling and not stretched map of noise for the sphere: http://imageshack.com/a/img908/4101/75e2a4.png

There's an example of both how 3-d noise and 2-d noise can be used. The 3-d noise is used to create the seamless texture on the sphere and then the texture on the sphere is used to generate a height and color map for the very badly sketched out planet (it was just a test of the noise, not something to be used).

Anyway, I don't know if you mean "voxels" as in generating minecraft like content or if you simply mean voxels in the mathematical sense. For general terrain generation on your standard game where you don't have to be digging around in the dirt for blocks, 2-d noise would generally be implimented similar to how my planet uses the 2-d texture which is generated from 3-d noise. It simply maps heights of the terrain mesh to a 2-d plane. For finer details, normal maps and bump maps create the illusion of deformations in the underlying mesh by rendering shadows on otherwise flat surfaces.

EDIT: I'm confused what you mean by "I know the voxels are stored in 2-d arrays"... If you mean vertices on a map, well, that would make sense because you have the x index of the array, the y index of the array and the value index of the z (height). Most terrain I've seen has absolutely no skewing of the z coordinates on terrain meshes. That's why you sometimes get that nasty stretched texture look on the sides of mountains in older games like WoW: http://img90.imageshack.us/img90/7000/155n.jpg The face of the mesh has been stretched because the x and y of the "z" value are clamped (I would assume to integers) for convenience.

ThisHandleNotInUse
  • 1,135
  • 1
  • 10
  • 23
0

You can get a height map based voxel landscape using the amplitude of the return value of a 2D perlin noise fed with a 2d grid. The higher is the returned value, the more you add voxels vertically. If you want 3d landscape with caving effects, then you need an extra dimension (ex: feeding 3D perlin with the vertex positions of a 3D grid) and add voxels where your noise surface lies (ex: where the return value is 0, if your perlin implementation returns between -1 and 1).

0

3d noise function returns 1 to -1 for any XYZ point in space...

run the noise function for chosen xyz spaces.

if it's more than 0, it contains a voxel.

when xyz returns a density field like -1/1 its called isosurface function.

look for isosurface tutorial online for images and infos.

bandybabboon
  • 2,210
  • 1
  • 23
  • 33