Skip to main content
Tweeted twitter.com/StackGameDev/status/1166364889625104384
updated title; added edit
Source Link
kei
  • 235
  • 1
  • 7

Ploting points in a 3D Mapping noise fieldto sphere surface

I'm attempting to create a sphere with terrain (aka planet). I managed to procedurally create an icosahedron, and I am able to subdivide it (yay), but now I'm stuck on terrain.

My current idea iswas to create a Perlin like "3D Noise Field" and sample noisedensity where each of the spheres vertices fall (as a height-map value). this way i should be able to tweak the noise (add octaves, etc) to roughen the "NoiseField" and thus the spheres surface.

pseudo example and result:

public void Terrain(float Scale)
{
    if (Scale < 0.01) return;
        
    List<Vector3> terrain = new List<Vector3>();
    for ( int i = 0; i < surface.vertices.Count; i++)
    {
        Vector3 vert = Original[i];sphere.verts[i];
        Vector3 direction = vert.normalized;
        Vector3 newpoint = vert * Sample3DNoise(direction, Scale);
        terrain.Add(newpoint);
    }

    //this line replaces the original shape!        
    surface.vertices = terrain;

    Debug.Log("terrain Update");
}

public float Sample3DNoise(Vector3 point, float scale)
{
    //Vector3 direction = point.normalized;

    float u = point.normalized.x * scale;
    float v = point.normalized.y * scale;
    float w = point.normalized.z * scale;

    //poor attempt at 3d noise field
    //PerlinNoise(float, float );
    float x = Mathf.PerlinNoise(u , 0f);
    float y = Mathf.PerlinNoise(0f, v);
    float z = Mathf.PerlinNoise(u , v);

    //the average of the coords, returns "density at this point"
    return (x + y + z) / 3;
}

enter image description here

edit:

so while it appears i was able to achieve this, it's is clearly not the "terrain on surface of sphere" look I was lookingaiming for. Any suggestions on how can I change the "noise field" so my surface is more planet like? or how else can i achieve this?

Ploting points in a 3D noise field

I'm attempting to create a sphere with terrain (aka planet). I managed to procedurally create an icosahedron, and I am able to subdivide it (yay), but now I'm stuck on terrain.

My current idea is to create a Perlin like "3D Noise Field" and sample noise where each of the spheres vertices fall. this way i should be able to tweak the noise (add octaves, etc) to roughen the "NoiseField" and thus the spheres surface.

pseudo example and result:

public void Terrain(float Scale)
{
    if (Scale < 0.01) return;
        
    List<Vector3> terrain = new List<Vector3>();
    for ( int i = 0; i < surface.vertices.Count; i++)
    {
        Vector3 vert = Original[i];
        Vector3 direction = vert.normalized;
        Vector3 newpoint = vert * Sample3DNoise(direction, Scale);
        terrain.Add(newpoint);
    }

    //this line replaces the original shape!        
    surface.vertices = terrain;

    Debug.Log("terrain Update");
}

public float Sample3DNoise(Vector3 point, float scale)
{
    //Vector3 direction = point.normalized;

    float u = point.normalized.x * scale;
    float v = point.normalized.y * scale;
    float w = point.normalized.z * scale;

    //poor attempt at 3d noise field
    //PerlinNoise(float, float );
    float x = Mathf.PerlinNoise(u , 0f);
    float y = Mathf.PerlinNoise(0f, v);
    float z = Mathf.PerlinNoise(u , v);

    //the average of the coords, returns "density at this point"
    return (x + y + z) / 3;
}

enter image description here

so while it appears i was able to achieve this, it's is clearly not the "terrain on surface of sphere" I was looking for. Any suggestions?

Mapping noise to sphere surface

I'm attempting to create a sphere with terrain (aka planet). I managed to procedurally create an icosahedron, and I am able to subdivide it (yay), but now I'm stuck on terrain.

My current idea was to create a Perlin like "3D Noise Field" and sample density where each of the spheres vertices fall (as a height-map value). this way i should be able to tweak the noise (add octaves, etc) to roughen the "NoiseField" and thus the spheres surface.

pseudo example and result:

public void Terrain(float Scale)
{
    if (Scale < 0.01) return;
        
    List<Vector3> terrain = new List<Vector3>();
    for ( int i = 0; i < surface.vertices.Count; i++)
    {
        Vector3 vert = sphere.verts[i];
        Vector3 direction = vert.normalized;
        Vector3 newpoint = vert * Sample3DNoise(direction, Scale);
        terrain.Add(newpoint);
    }

    //this line replaces the original shape!        
    surface.vertices = terrain;

    Debug.Log("terrain Update");
}

public float Sample3DNoise(Vector3 point, float scale)
{
    //Vector3 direction = point.normalized;

    float u = point.normalized.x * scale;
    float v = point.normalized.y * scale;
    float w = point.normalized.z * scale;

    //poor attempt at 3d noise field
    //PerlinNoise(float, float );
    float x = Mathf.PerlinNoise(u , 0f);
    float y = Mathf.PerlinNoise(0f, v);
    float z = Mathf.PerlinNoise(u , v);

    //the average of the coords, returns "density at this point"
    return (x + y + z) / 3;
}

enter image description here

edit:

so while it appears i was able to achieve this, it's is clearly not the "terrain on surface of sphere" look I was aiming for. Any suggestions on how can I change the "noise field" so my surface is more planet like? or how else can i achieve this?

added 666 characters in body; edited title
Source Link
kei
  • 235
  • 1
  • 7

plotting Ploting points in a 3d3D noise field

I'm attempting to create a sphere with terrain (aka planet). I managed to procedurally create an icosahedron, and I am able to subdivide it (yay), but now I'm stuck on terrain.

My current idea is to create a Perlin like "3D Noise Field" and sample noise where each of the spheres vertices fall. this way i should be able to tweak the noise (add octaves, etc) to roughen the "NoiseField" and thus the spheres surface.

roughpseudo example and result:

public void Terrain(float Scale)
{
    if (Scale < 0.01) return;
        
    List<Vector3> terrain = new List<Vector3>();
    for ( int i = 0; i < spheresurface.VertCount;vertices.Count; i++)
    Sphere{
        Vector3 vert = Original[i];
        Vector3 direction = vert.verts[i]normalized;
        Vector3 newpoint = vert * Sample3DNoise(Spheredirection, Scale);
        terrain.verts[i]Add(newpoint);
 * scale;  }

    //ehhthis line replaces the original shape!        
    surface.vertices = terrain;

    Debug.Log("terrain Update");
}

public float Sample3DNoise(Vector3 point, float scale)
{
    //???Vector3 direction should= probspoint.normalized;

 work ???  float u = point.normalized.x * scale;
    float v = point.normalized.y * scale;
    float w = point.normalized.z * scale;

    //poor attempt at 3d noise field
    //PerlinNoise(float, float );
    float x = Mathf.PerlinNoise(point.xu , 0.0000f0f);
    float y = Mathf.PerlinNoise(0.0000f0f, point.yv);
    float z = Mathf.PerlinNoise(point.xu , point.yv);

    //the average of the coords, returns "density at this point"
    return (x + y + z) / 3; 
}

that should work, right? I'm not just doing something absurd? is there a better way to do this?enter image description here

(as a side question how do i render a Textrue3D? so while it appears i populated one using my noise as the textels (alpha value)was able to achieve this, but how do i display itit's is clearly not the "terrain on surface of sphere" I was looking for. Any suggestions?)

plotting points in a 3d noise field

I'm attempting to create a sphere with terrain (aka planet). I managed to procedurally create an icosahedron, and I am able to subdivide it (yay), but now I'm stuck on terrain.

My current idea is to create a Perlin like "3D Noise Field" and sample noise where each of the spheres vertices fall. this way i should be able to tweak the noise (add octaves, etc) to roughen the "NoiseField" and thus the spheres surface.

rough example:

for (int i = 0; i < sphere.VertCount; i++)
    Sphere.verts[i] = Sample3DNoise(Sphere.verts[i]) * scale;//ehh

public float Sample3DNoise(Vector3 point)
{
    //???  should probs work ???
    float x = Mathf.PerlinNoise(point.x, 0.0000f);
    float y = Mathf.PerlinNoise(0.0000f, point.y);
    float z = Mathf.PerlinNoise(point.x, point.y);

    //the average of the coords, returns "density at this point"
    return (x + y + z) / 3; 
}

that should work, right? I'm not just doing something absurd? is there a better way to do this?

(as a side question how do i render a Textrue3D? i populated one using my noise as the textels (alpha value), but how do i display it?)

Ploting points in a 3D noise field

I'm attempting to create a sphere with terrain (aka planet). I managed to procedurally create an icosahedron, and I am able to subdivide it (yay), but now I'm stuck on terrain.

My current idea is to create a Perlin like "3D Noise Field" and sample noise where each of the spheres vertices fall. this way i should be able to tweak the noise (add octaves, etc) to roughen the "NoiseField" and thus the spheres surface.

pseudo example and result:

public void Terrain(float Scale)
{
    if (Scale < 0.01) return;
        
    List<Vector3> terrain = new List<Vector3>();
    for ( int i = 0; i < surface.vertices.Count; i++)
    {
        Vector3 vert = Original[i];
        Vector3 direction = vert.normalized;
        Vector3 newpoint = vert * Sample3DNoise(direction, Scale);
        terrain.Add(newpoint);
    }

    //this line replaces the original shape!        
    surface.vertices = terrain;

    Debug.Log("terrain Update");
}

public float Sample3DNoise(Vector3 point, float scale)
{
    //Vector3 direction = point.normalized;

    float u = point.normalized.x * scale;
    float v = point.normalized.y * scale;
    float w = point.normalized.z * scale;

    //poor attempt at 3d noise field
    //PerlinNoise(float, float );
    float x = Mathf.PerlinNoise(u , 0f);
    float y = Mathf.PerlinNoise(0f, v);
    float z = Mathf.PerlinNoise(u , v);

    //the average of the coords, returns "density at this point"
    return (x + y + z) / 3;
}

enter image description here

so while it appears i was able to achieve this, it's is clearly not the "terrain on surface of sphere" I was looking for. Any suggestions?

Source Link
kei
  • 235
  • 1
  • 7

plotting points in a 3d noise field

I'm attempting to create a sphere with terrain (aka planet). I managed to procedurally create an icosahedron, and I am able to subdivide it (yay), but now I'm stuck on terrain.

My current idea is to create a Perlin like "3D Noise Field" and sample noise where each of the spheres vertices fall. this way i should be able to tweak the noise (add octaves, etc) to roughen the "NoiseField" and thus the spheres surface.

rough example:

for (int i = 0; i < sphere.VertCount; i++)
    Sphere.verts[i] = Sample3DNoise(Sphere.verts[i]) * scale;//ehh

public float Sample3DNoise(Vector3 point)
{
    //???  should probs work ???
    float x = Mathf.PerlinNoise(point.x, 0.0000f);
    float y = Mathf.PerlinNoise(0.0000f, point.y);
    float z = Mathf.PerlinNoise(point.x, point.y);

    //the average of the coords, returns "density at this point"
    return (x + y + z) / 3; 
}

that should work, right? I'm not just doing something absurd? is there a better way to do this?

(as a side question how do i render a Textrue3D? i populated one using my noise as the textels (alpha value), but how do i display it?)