Comments and answers for "2D noise function to generate voxel circles"
http://answers.unity.com/questions/1451704/2d-noise-function-to-generate-voxel-circles.html
The latest comments and answers for the question "2D noise function to generate voxel circles"Comment by Dray on Dray's comment
http://answers.unity.com/comments/1452844/view.html
I'm sorry, I overlooked that you are trying to generate *multiple* planets. In fact though, this is not much more complex than just one.
---
I can imagine two ways to do this:
1. Apply the method described above to each of your planets. In other words, for each cell find the closest planet and then use the distance to this planets origin. Be aware that this approach could make your performance suffer a lot depending on the platform you are targeting and the count of planets you are going for.
2. Dig into noise generation in general. Understand how noise functions are actually based on primitive mathematical functions that are combined together. Find a Noise library for unity that lets you build your own noise and make a generator that produces almost spherical shapes. This will require some reading but might provide you with the more performant solution for your problem. You won't be able to actually *place* planets where you want them like this though.
---
I found [thebookofshaders.com][1] to be a nice source to understand how certain shapes can be generated from noise. Have a look at the *algorithmic drawing* section if you are interested.
---
[LibNoise][2] could be the right library for you to play around with noises a little bit. There are some Unity ports of it out there, just google it
---
[SimplexNoise][3] is another nice approach to provide noise in a more performant way, the tutorial I linked looks quite promising even though I didn't have time to read it yet. If you don't like reading there are some finished Unity implementations of SimplexNoise too I'm pretty sure ;)
---
To answer the question what the radius would be; in the example above it would be simply 1 unit. To change the radius of your planet you could *divide the distance* by the actual radius you want before dividing the noise functions result by it. Like this:
float value = Noise(p.x, p.y) / (Vector2.Distance(p, origin) / radius);
[1]: https://thebookofshaders.com/
[2]: http://libnoise.sourceforge.net/
[3]: http://catlikecoding.com/unity/tutorials/simplex-noise/Wed, 10 Jan 2018 12:29:16 GMTDrayComment by RevivedBear on RevivedBear's answer
http://answers.unity.com/comments/1452472/view.html
Also, I would like the noise function to provide me with planet centers rather than me having to pre-define them somehow.Tue, 09 Jan 2018 14:12:25 GMTRevivedBearComment by RevivedBear on RevivedBear's answer
http://answers.unity.com/comments/1452448/view.html
from this, what defines the radius of the planet then?Tue, 09 Jan 2018 13:39:19 GMTRevivedBearAnswer by Dray
http://answers.unity.com/answers/1451908/view.html
Use any generic 2D noise function and divide the result for each point by the distance to your planets center:
// p is the current x, y coordinate, origin is the planets center
float value = Noise(p.x, p.y) / Vector2.Distance(p, origin);
if (value > 0) {
// add block at p ...
}
This should provide you with a sphere that is being deformed by your noise function.Mon, 08 Jan 2018 11:16:24 GMTDray