Breaking_Reality
Breaking_Reality

Reputation: 21

Adding noise to marching cubes isn't influencing terrain

I'm using marching cubes and 3D noise to generate modifiable/interesting terrain. Why isn't my noise being applied to my marching cubes?

Please keep in mind I followed GPU Gems implementation for noise.

I've tried using 2D noise to get atleast some sort of effect but I have the same issue. My issue is that everything just appears flat. I'm following GPU gems on marching cubes except I'm not using a shader. I set the point isovalues to -point.y (position) and get flat terrain which is normal. Then I add noise with unitys built in perlin noise and I get flat still. My iso level is at 0 by the way. I added a 3D perlin noise method and used that and still get nothing. I'm not sure what I'm doing wrong.

This is the code I use for 3D noise in unity:

 float Perlin3D(float x, float y, float z)
    {
        float AB = Mathf.PerlinNoise(x, y);
        float BC = Mathf.PerlinNoise(y, z);
        float AC = Mathf.PerlinNoise(x, z);

        float BA = Mathf.PerlinNoise(y, x);
        float CB = Mathf.PerlinNoise(z, y);
        float CA = Mathf.PerlinNoise(z, x);

        float ABC = AB + BC + AC + BA + CB + CA;

        return ABC / 6.0f;
    }

This is the code I use to apply the isovalue to the points:

isovalue = -transform.position.y + Perlin3D(transform.position.x * 0.9f, transform.position.y * 0.9f, transform.position.z * 0.9f);

My iso level is set to 0.

My marching cubes seems to be working fine. I've tried a lot of the different out comes but editing points myself to check if I get correct outputs and I do. Not sure what to do or what I'm doing wrong.

I expect to have some terrain from this. No error messages are seen and the only issue I think could be wrong is the noise itself. Because everything else in my marching cubes work like expected. Thanks!

Upvotes: 1

Views: 257

Answers (1)

Breaking_Reality
Breaking_Reality

Reputation: 21

Thanks for everyone who stopped by to read! I've fully implemented marching cubes in to my project. It's alot simpler then I thought. Though adding 'good' looking noise was a struggle I still didn't add this amazing terrain. Only ok noise. Thought with the correct implementation of noise this could come out to be amazing. For anyone looking for an answer what I found to add some noise was to just multiply the output of the nosie. It doesn't look great but its a start. Thanks!

Upvotes: 0

Related Questions