# How do I create the terrain mentioned in GPU Gems 3

So, i want to create this style of terrain: Nvidia GPU Gems 3 - Chapter 1

However, as much as I scour the web trying to find ways to implement this inside Unity, I can't find it.

My current understanding of 3d noise is that it is just an array of 2d noise that uses a range of -1 to 1 to determine density values (if there should be ground or air at a point in space (x,y,z), and 2d noise is just a heightmap of where you want the terrain to go.

I currently have generated simplex noise in unity that I think works (it seems to go through -1 to 1 when i call the coherentNoise() function): I would love some review on it however: pastebin.com/SiX2C31t (currently, I haven't implemented the marching squares algorithm either, would love some tips on that as well).

I've been looking at several forum questions and Unity answers, but never found anything.

All I want to do is create fascinating ridges and overhangs for an underwater terrain, and I also preferably would like to know how to do it with a lower LOD, (I want it to be low poly).

Thanks.

This question will probably be closed, but I want to provide you with some pointers anyway:

I have done an OpenGL implementation of that article in question, back when the geometry stage was new. It was quite heavy to do, and then I was not constrained by an existing enginge but did my implementation from scratch.

The article contains everything you need to know, I think you may be over your head with this one.

"how do i get this 'density function'?" The article descbribes throughly how to use a small 3d texture with octaves to generate a 3d texture that represents the density volume. Take your time, read through it again, and make sure you're versed in the how the geometry stage of shaders works and how to render to 3d textures.

Edit:

I believe NVidia has an implmentation in DirectX lying around somewhere, is it not linked from the article?

• I have a vague idea of what the density function is, it produces a single floating point value that when positive, symbolizes solid terrain and when negative symbolizes empty space. I don't see anything there mentioning on how to create noise to apply the algorithm with (figure 1-8). How do I implement 3d perlin noise? I have some knowledge with regular perlin noise (UnityEngine's MathF.PerlinNoise()) Jun 30, 2016 at 19:11
• The GPU gems article does not seem to explain the noise that they use, so i'm quite confused on how to start. I want to see if I can maybe use LibNoise (the unity ported version) to generate a type of noise to apply the marching squares algorithm. Jun 30, 2016 at 23:36
• You create a framebuffer that is bound to a 3d texture, 32*32*32 (something like this), then you render 32 2d slices into this texture using 3d noise. Now you got your density volume for a single cell! Jul 1, 2016 at 7:41
• I think you should start with just setting up geometry stage feedback in Unity, and maybe look into other techniques. You say you want something with overhangs? Is it important that it is also procedural? Jul 1, 2016 at 7:42
• Yes, I want it to be procedural because I want infinite underwater terrain (I liked the way the terrain had a warped shape and complex overhangs) I currently have generated simplex noise in unity that I think works: I would love some review on it however: pastebin.com/SiX2C31t (currently, I haven't implemented the marching squares algorithm either, would love some tips on that as well) Jul 1, 2016 at 7:58