josebasierra / voxel-planets

Generation of planets with dynamic terrain
MIT License
109 stars 14 forks source link

How to achieve a more playable surface for a planet? #1

Open dev-bre opened 1 year ago

dev-bre commented 1 year ago

Hi, I stumbled upon this project and looks amazing. I am spending some time on it and trying to come up with a planet with a more playable surface.

If you think about astroneer, there are parts of the planet that are are more like valleys or a bit more flatten instead of having mountains and caves everywhere.

Can you give me some advice on how to achieve this?

josebasierra commented 1 year ago

Hello Andy,

I'm glad you like the project. About how to achieve more variety in the generated terrain, it's something I didn't explore in much depth. You would need to play with different noise functions, and perhaps override some specific zones with unique shapes. A simple example: You generate the basic terrain with something as Perlin Noise. At some location you want a hole or big depression, so you can intersect / subtract the data there with a deformed sphere (sphere + some noise), so you will have a deformed hole there.

Taking this idea, instead of using Perlin Noise 3D as of now, which generates as you say a lot of caves, holes etc. You could just use Perlin Noise 2D to modify just the 'elevation'/mountains of the sphere/planet, without creating holes. Then add randomly different shapes or 3D noise over the planet to generate caves or whatever. At some specific zones/biomes, you can use different noise functions if you want to achieve something more flattened, etc.

In summary:

El jue, 31 ago 2023 a las 17:38, Andy @.***>) escribió:

Hi, I stumbled upon this project and looks amazing. I am spending some time on it and trying to come up with a planet with a more playable surface.

If you think about astroneer, there are parts of the planet that are are more like valleys or a bit more flatten instead of having mountains and caves everywhere.

Can you give me some advice on how to achieve this?

— Reply to this email directly, view it on GitHub https://github.com/josebasierra/voxel-planets/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALOLU36S54RFORUXQBZNGZLXYCVYZANCNFSM6AAAAAA4GIXRBE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

dev-bre commented 1 year ago

Thank you so much for your reply.

Let's assume I would go with the simpler approach if using multiple noise functions for now.

This is something I am trying to do at the moment, with poor results. 😁

I am currently applying noise in this line: https://github.com/josebasierra/voxel-planets/blob/b5e9c1d64a059561be2c08b60ae017c8726b2a0e/Assets/Scripts/VoxelPlanet/ProceduralGeneration/SignedDistanceField.cs#L50

First question is, is this the right place where I should apply my "new" noise?

If yes:

Assuming I would like to apply a very flat noise as base terrain, with low freq. and call it N1.

Assuming I will also create another noise with higher freq for the mountains, and call it N2.

Finally a control noise NC, which will decide when to apply N2 and when not.

I was thinking to lerp between N1 and N2 using NC.. but the result is really bad and mostly broken.

Any chance you could guide me on this maybe with a code snippet? I think it would be really good for your project in general as well.

Tha ks again for your time on this. I think you should consider selling this on the unity store. I am sure ppl will buy this asset. I would.

dev-bre commented 1 year ago

Any suggestion about the above? :)

I am currently trying to lerp noises together, even though it does something, the result is far from interesting to see:

  float noiseValueFlat = ComputeNoise(projectedPointToSphere, new NoiseSettings { type = Noise.Type.perlin, frequency = 0.005f, octaveCount = 5, amplitude = 10f });
  float noiseValueMountains = ComputeNoise(projectedPointToSphere, new NoiseSettings { type = Noise.Type.perlin, frequency = 0.007f, octaveCount = 0, amplitude = 200f }); 

  noiseValue = Mathf.Lerp(noiseValueFlat, noiseValueMountains, 0.3f); 

I am really interested in what you said about:

"At some location you want a hole or big depression, so you can intersect / subtract the data there with a deformed sphere (sphere + some noise), so you will have a deformed hole there."

which also refers to:

"3D noise at specific planet zones to generate 3D data, such as holes, cave ramifications, etc."

Any chance you could expend a bit on this? I am pretty new with SDF and I would like to learn more on how to achive good results.