4
\$\begingroup\$

I'm using Unity, although this question is not really specific to that engine.

Im also using an asset from the store called Coherent Noise. It has some neat noise functionality built it.

I am using those functions to produce some noise values. I am getting a value between 0 and 1 (floats).

I have an array of blocks (for minecraft like voxel terrain) and I am confused on how to use this float value for terrain?

Do I do something like <= 0 == Solid block etc?

I am confused on how to use the floating values that the noise functions produce to use for height values of an array of say a height of 16.

\$\endgroup\$
  • \$\begingroup\$ Are you generating 2d or 3d noise? \$\endgroup\$ – Raven Dreamer Nov 18 '12 at 6:20
  • \$\begingroup\$ I am trying ti implement 3D. \$\endgroup\$ – therealjohn Nov 18 '12 at 13:35
3
\$\begingroup\$

If you're using the noise for height values (2D noise), then you multiply the float value by the maximum height of your world. This will give you a height value somewhere between 0 and the maximum height of your world.

If you're using the noise to determine if a voxel is solid or not (3D noise), you can do as you suggest and pick a threshold value that defines when the breaking point is between solid/air. Since your values are from 0 to 1 you'd want to pick some small value that's greater than zero, otherwise you won't be getting any empty voxels.

The second option is going to be harder to get right. You'll need to implement the noise generation in a controlled manner. i.e. you'll want to have voxels more likely to be solid at small y values and more likely to be air at large y vaules. If it's completely random you'll have land and ground so mixed up the landscape won't resemble landscape at all. See my answer here to learn more about implementing terrain using noise as a density function.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Awesome, thanks for explaining. I will check out the link to your other answer. I am seeing exactly what you are describing that my values are not quite right and my landscape is not resembling anything like landscape; its so mixed up (too random). \$\endgroup\$ – therealjohn Nov 18 '12 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.