How to create Voxel Terrain Generation in Unity
up vote
1
down vote
favorite
That is the code that I am using for generating the terrain. But I can't manage to use the 2D Perlin Noise, it is creating a lot of no-needed blocks and does not look quite quadratic.
As a GrassCube I am using the default unity 3D Cube. I Will add texture later
Terrain picture
public GameObject GrassCube;
public GameObject RockCube;
public GameObject DirtCube;
void Start ()
CreateCube(16, 16, 16);
public void CreateCube(int sizeX, int sizeY, int sizeZ)
for (int x = 0; x < sizeX; x++)
for (int y = 0; y < sizeY; y++)
for (int z = 0; z < sizeZ; z++)
float PerlinNoise = Mathf.PerlinNoise(x * 0.2f, z * 0.2f) * 3;
GrassCube = Instantiate(GrassCube, new Vector3(x, PerlinNoise, z), Quaternion.identity);
GrassCube.name = "Cube:" + x + ", " + y + ", " + z;
c# unity3d terrain perlin-noise voxel
add a comment |
up vote
1
down vote
favorite
That is the code that I am using for generating the terrain. But I can't manage to use the 2D Perlin Noise, it is creating a lot of no-needed blocks and does not look quite quadratic.
As a GrassCube I am using the default unity 3D Cube. I Will add texture later
Terrain picture
public GameObject GrassCube;
public GameObject RockCube;
public GameObject DirtCube;
void Start ()
CreateCube(16, 16, 16);
public void CreateCube(int sizeX, int sizeY, int sizeZ)
for (int x = 0; x < sizeX; x++)
for (int y = 0; y < sizeY; y++)
for (int z = 0; z < sizeZ; z++)
float PerlinNoise = Mathf.PerlinNoise(x * 0.2f, z * 0.2f) * 3;
GrassCube = Instantiate(GrassCube, new Vector3(x, PerlinNoise, z), Quaternion.identity);
GrassCube.name = "Cube:" + x + ", " + y + ", " + z;
c# unity3d terrain perlin-noise voxel
1
Hi, I am afraid I am not clear what problem you are trying to solve, can you expand on what issues you are having?
– Loofer
Nov 11 at 15:43
I mean you are looping 3 dimensionally for what appears to be a 2 dimension problem, and since your "y" of your cubes comes from perlin noise I think it is safe to remove that loop.
– Eddge
Nov 11 at 17:38
I want to create voxel world like this one using 2D Perlin Noise Voxel world
– MadForLife
Nov 11 at 19:26
Nevermind I managed to fix it now I need to add more depth and mountains to the world WorldGen
– MadForLife
Nov 12 at 6:55
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
That is the code that I am using for generating the terrain. But I can't manage to use the 2D Perlin Noise, it is creating a lot of no-needed blocks and does not look quite quadratic.
As a GrassCube I am using the default unity 3D Cube. I Will add texture later
Terrain picture
public GameObject GrassCube;
public GameObject RockCube;
public GameObject DirtCube;
void Start ()
CreateCube(16, 16, 16);
public void CreateCube(int sizeX, int sizeY, int sizeZ)
for (int x = 0; x < sizeX; x++)
for (int y = 0; y < sizeY; y++)
for (int z = 0; z < sizeZ; z++)
float PerlinNoise = Mathf.PerlinNoise(x * 0.2f, z * 0.2f) * 3;
GrassCube = Instantiate(GrassCube, new Vector3(x, PerlinNoise, z), Quaternion.identity);
GrassCube.name = "Cube:" + x + ", " + y + ", " + z;
c# unity3d terrain perlin-noise voxel
That is the code that I am using for generating the terrain. But I can't manage to use the 2D Perlin Noise, it is creating a lot of no-needed blocks and does not look quite quadratic.
As a GrassCube I am using the default unity 3D Cube. I Will add texture later
Terrain picture
public GameObject GrassCube;
public GameObject RockCube;
public GameObject DirtCube;
void Start ()
CreateCube(16, 16, 16);
public void CreateCube(int sizeX, int sizeY, int sizeZ)
for (int x = 0; x < sizeX; x++)
for (int y = 0; y < sizeY; y++)
for (int z = 0; z < sizeZ; z++)
float PerlinNoise = Mathf.PerlinNoise(x * 0.2f, z * 0.2f) * 3;
GrassCube = Instantiate(GrassCube, new Vector3(x, PerlinNoise, z), Quaternion.identity);
GrassCube.name = "Cube:" + x + ", " + y + ", " + z;
c# unity3d terrain perlin-noise voxel
c# unity3d terrain perlin-noise voxel
edited Nov 11 at 15:59
Loofer
4,51354489
4,51354489
asked Nov 10 at 22:36
MadForLife
63
63
1
Hi, I am afraid I am not clear what problem you are trying to solve, can you expand on what issues you are having?
– Loofer
Nov 11 at 15:43
I mean you are looping 3 dimensionally for what appears to be a 2 dimension problem, and since your "y" of your cubes comes from perlin noise I think it is safe to remove that loop.
– Eddge
Nov 11 at 17:38
I want to create voxel world like this one using 2D Perlin Noise Voxel world
– MadForLife
Nov 11 at 19:26
Nevermind I managed to fix it now I need to add more depth and mountains to the world WorldGen
– MadForLife
Nov 12 at 6:55
add a comment |
1
Hi, I am afraid I am not clear what problem you are trying to solve, can you expand on what issues you are having?
– Loofer
Nov 11 at 15:43
I mean you are looping 3 dimensionally for what appears to be a 2 dimension problem, and since your "y" of your cubes comes from perlin noise I think it is safe to remove that loop.
– Eddge
Nov 11 at 17:38
I want to create voxel world like this one using 2D Perlin Noise Voxel world
– MadForLife
Nov 11 at 19:26
Nevermind I managed to fix it now I need to add more depth and mountains to the world WorldGen
– MadForLife
Nov 12 at 6:55
1
1
Hi, I am afraid I am not clear what problem you are trying to solve, can you expand on what issues you are having?
– Loofer
Nov 11 at 15:43
Hi, I am afraid I am not clear what problem you are trying to solve, can you expand on what issues you are having?
– Loofer
Nov 11 at 15:43
I mean you are looping 3 dimensionally for what appears to be a 2 dimension problem, and since your "y" of your cubes comes from perlin noise I think it is safe to remove that loop.
– Eddge
Nov 11 at 17:38
I mean you are looping 3 dimensionally for what appears to be a 2 dimension problem, and since your "y" of your cubes comes from perlin noise I think it is safe to remove that loop.
– Eddge
Nov 11 at 17:38
I want to create voxel world like this one using 2D Perlin Noise Voxel world
– MadForLife
Nov 11 at 19:26
I want to create voxel world like this one using 2D Perlin Noise Voxel world
– MadForLife
Nov 11 at 19:26
Nevermind I managed to fix it now I need to add more depth and mountains to the world WorldGen
– MadForLife
Nov 12 at 6:55
Nevermind I managed to fix it now I need to add more depth and mountains to the world WorldGen
– MadForLife
Nov 12 at 6:55
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244112%2fhow-to-create-voxel-terrain-generation-in-unity%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Hi, I am afraid I am not clear what problem you are trying to solve, can you expand on what issues you are having?
– Loofer
Nov 11 at 15:43
I mean you are looping 3 dimensionally for what appears to be a 2 dimension problem, and since your "y" of your cubes comes from perlin noise I think it is safe to remove that loop.
– Eddge
Nov 11 at 17:38
I want to create voxel world like this one using 2D Perlin Noise Voxel world
– MadForLife
Nov 11 at 19:26
Nevermind I managed to fix it now I need to add more depth and mountains to the world WorldGen
– MadForLife
Nov 12 at 6:55